1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Suppress bogus [-Wlogical-op] warning from GCC

See GCC bug 69602: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69602
which emits the warning for (errno == EWOULDBLOCK || errno == EAGAIN)
which is the correct way of handling errors as the value of EWOULDBLOCK
and EAGAIN is implementation defined.

Therefore introduce a new macro function PHP_IS_TRANSIENT_ERROR()
which handles the case when EWOULDBLOCK and EAGAIN are identical.

Thanks to @twose for the idea.
This commit is contained in:
George Peter Banyard
2020-09-23 23:46:58 +01:00
parent f211f1586f
commit 150ebfdf77
5 changed files with 15 additions and 10 deletions

View File

@@ -49,6 +49,13 @@
# define EWOULDBLOCK EAGAIN
#endif
/* This is a work around for GCC bug 69602: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69602 */
#if EAGAIN != EWOULDBLOCK
# define PHP_IS_TRANSIENT_ERROR(err) (err == EAGAIN || err == EWOULDBLOCK)
#else
# define PHP_IS_TRANSIENT_ERROR(err) (err == EAGAIN)
#endif
#ifdef PHP_WIN32
#define php_socket_errno() WSAGetLastError()
#else