summaryrefslogtreecommitdiff
path: root/main/php_network.h
diff options
context:
space:
mode:
authorGeorge Peter Banyard <girgias@php.net>2020-09-23 23:46:58 +0100
committerGeorge Peter Banyard <girgias@php.net>2020-10-10 14:45:20 +0100
commit150ebfdf77320b24b0358f8a903e90d7940ad4a4 (patch)
tree06e83f7b7f4fed49bdc08033d093aa94dad9ac8f /main/php_network.h
parentf211f1586f1e93acee49df852b999b9402d32f5d (diff)
downloadphp-git-150ebfdf77320b24b0358f8a903e90d7940ad4a4.tar.gz
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.
Diffstat (limited to 'main/php_network.h')
-rw-r--r--main/php_network.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/main/php_network.h b/main/php_network.h
index 437069b4fc..5c8cee3fa8 100644
--- a/main/php_network.h
+++ b/main/php_network.h
@@ -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