-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Add some compiler flags which aren't included in -Wall or -Wextra #6199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
50bb316
to
ae48ad5
Compare
@dstogov could you just confirm that the changes in FFI, SOAP and the JIT are correct as some seem to be bugs and IIRC you are the maintainer of FFI and SOAP. |
3e5e0a4
to
e93f8d4
Compare
I've moved this to the 8.1 milestone, to avoid additional disruption for PECL extensions this late. |
ext/ffi/ffi_parser.c
Outdated
} else if (sym == YY___CONST) { | ||
sym = get_sym(); | ||
} else { | ||
} else { /* sym == YY_CONST || sym == YY___CONST || something else */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is auto generated. It shouldn't be edited directly.
FFI, SOAP and JIT looks proper except direct I'll merge these fixes. |
FFI, SOAP and JIT fixes are merged into PHP-7.3 and above. |
69cf664
to
2e37b20
Compare
How about this way: #if defined(EWOULDBLOCK) && EAGAIN != EWOULDBLOCK
#define IS_TRANSIENT_ERROR(err) (err == EAGAIN || err == EWOULDBLOCK)
#else
#define IS_TRANSIENT_ERROR(err) (err == EAGAIN)
#endif |
I found the same solution in libevent, but libuv not and it looks it's unnecessary to check if EWOULDBLOCK was defined |
660c2df
to
89763bb
Compare
Zend/zend_portability.h
Outdated
/* This is a work around for GCC bug 69602: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69602 */ | ||
#if defined(EWOULDBLOCK) && EAGAIN != EWOULDBLOCK | ||
# define IS_TRANSIENT_ERROR(err) (err == EAGAIN || err == EWOULDBLOCK) | ||
#else | ||
# define IS_TRANSIENT_ERROR(err) (err == EAGAIN) | ||
#endif | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could put the code here, it also works on ext/sockets
Lines 35 to 50 in 62c6d69
#ifdef PHP_WIN32 | |
# ifdef EWOULDBLOCK | |
# undef EWOULDBLOCK | |
# endif | |
# ifdef EINPROGRESS | |
# undef EINPROGRESS | |
# endif | |
# define EWOULDBLOCK WSAEWOULDBLOCK | |
# define EINPROGRESS WSAEWOULDBLOCK | |
# define fsync _commit | |
# define ftruncate(a, b) chsize(a, b) | |
#endif /* defined(PHP_WIN32) */ | |
#ifndef EWOULDBLOCK | |
# define EWOULDBLOCK EAGAIN | |
#endif |
BTW, the name is inspired by libuv, it defined on the C source file instead of a header file, so it's better to add a prefix on it, or named like ZEND_IS_EAGAIN (I am not sure, naming is not my strength...)
1682685
to
5a18e29
Compare
ext/imap/php_imap.c
Outdated
@@ -2746,7 +2746,7 @@ PHP_FUNCTION(imap_sort) | |||
} | |||
|
|||
array_init(return_value); | |||
if (slst != NIL && slst != 0) { | |||
if (slst != 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should either be != NIL
or != NULL
, as it is a pointer.
Zend/Zend.m4
Outdated
@@ -212,9 +212,12 @@ else | |||
AC_DEFINE(ZEND_DEBUG,0,[ ]) | |||
fi | |||
|
|||
test -n "$GCC" && CFLAGS="-Wall -Wextra -Wno-strict-aliasing -Wno-implicit-fallthrough -Wno-unused-parameter -Wno-sign-compare $CFLAGS" | |||
test -n "$GCC" && CFLAGS="-Wall -Wextra -Wno-strict-aliasing -Wno-implicit-fallthrough -Wno-unused-parameter -Wno-sign-compare -fno-common $CFLAGS" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the -fno-common here?
main/php_network.h
Outdated
#if EAGAIN != EWOULDBLOCK | ||
# define IS_TRANSIENT_ERROR(err) (err == EAGAIN || err == EWOULDBLOCK) | ||
#else | ||
# define IS_TRANSIENT_ERROR(err) (err == EAGAIN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a PHP_ prefix?
5a18e29
to
d527a00
Compare
azure/configure.yml
Outdated
@@ -61,7 +61,6 @@ steps: | |||
--with-imap \ | |||
--with-kerberos \ | |||
--with-imap-ssl \ | |||
--enable-werror \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop these now, or is there still something left?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is one remaining failure on 32bits:
/home/vsts/work/1/s/ext/sodium/libsodium.c: In function ‘zif_sodium_crypto_secretstream_xchacha20poly1305_push’:
/home/vsts/work/1/s/ext/sodium/libsodium.c:3181:71: warning: logical ‘or’ of equal expressions [-Wlogical-op]
3181 | if (msg_len > crypto_secretstream_xchacha20poly1305_MESSAGEBYTES_MAX ||
|
d527a00
to
fc67f11
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LG assuming CI happy.
Adds the following compiler flags: . -Wduplicated-cond . -Wlogical-op . -Wformat-truncation . -fno-common
fc67f11
to
ab5b59f
Compare
This adds
-Wduplicated-cond -Wduplicated-branches -Wlogical-op -Wformat-truncation
and-fno-common
compiler flags.-Wlogical-op
did seem to find some legit bugs.EDIT: Need to figure out a way to get around Windows for the GCC pragma