-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Enable -Wstrict-prototypes #5888
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
91ef875
to
4a088cb
Compare
ed10223
to
c2b8008
Compare
13d8f50
to
a014b7f
Compare
Ping Warning on master:
|
Ah no, I was the one introducing this one :/ |
cca34d0
to
7a0ecd7
Compare
814a15b
to
a7938ce
Compare
2119600
to
a4d1036
Compare
@Girgias what's the current status of this, milestone coming up, so if you intend to push on ... please push on ;) |
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.
After looking a bit closer at how this works, I'm okay with the direction, including changes to .c files. Can you please directly commit the parts that just dumbly add (void)
to signatures?
ext/mysqli/mysqli_warning.c
Outdated
@@ -129,7 +129,7 @@ MYSQLI_WARNING * php_get_warnings(MYSQLND_CONN_DATA * mysql) | |||
|
|||
for (;;) { | |||
zval *entry; | |||
int errno; | |||
int php_mysqli_errno; |
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.
Curious, why are these renames necessary?
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.
Or rather, I can see why it is necessary, the question is more why -Wstrict-prototypes
specifically makes it necessary. Does it contain some special check for errno?
Regarding the change itself, I don't think we should have a php_ prefix for local variables. This should be just mysqli_errno, or else some variation on the name (err_num).
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.
Can someone explain it to me also? Why are we renaming these?
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.
errno
is a global variable/macro defined by the implementation, as such redefining its prototype (here saying it is an int
) generates a Wstrict-prototypes warning.
Moreover, overridding the value of errno might have unintended consequence as you are working with a global value (although very unlikely here).
I'll rename the usage here and in LDAP after I merged rebased on the void changes.
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.
Isn't this a bug then? Should it not be fixed separately on its own and in 7.4?
6706858
to
14e0574
Compare
on macos |
fpm_event_kqueue_clean()
MacOS CI build seems to find more issues then the other ones...
14e0574
to
ee584d1
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.
Please first land the remaining code changes and then the build-system changes.
@@ -138,7 +138,8 @@ dnl | |||
if test "$PHP_GD" != "no"; then | |||
|
|||
if test "$PHP_EXTERNAL_GD" = "no"; then | |||
GD_CFLAGS="" | |||
dnl Disable strict prototypes as GD takes advantages of variadic function signatures for function pointers. |
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.
dnl Disable strict prototypes as GD takes advantages of variadic function signatures for function pointers. | |
dnl Disable strict prototypes as GD takes advantage of variadic function signatures for function pointers. |
@@ -1385,6 +1386,11 @@ void pcntl_signal_dispatch() | |||
sigprocmask(SIG_SETMASK, &old_mask, NULL); | |||
} | |||
|
|||
static void pcntl_signal_dispatch_tick_function(int dummy_int, ZEND_ATTRIBUTE_UNUSED void *dummy_pointer) |
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 is one of these marked as unused and the other isn't? As we disable this warning, I'd not add the attribute.
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.
Because somehow I thought this function used the first param, clearly being drunk. Will remove the attribute.
@@ -138,7 +138,8 @@ dnl | |||
if test "$PHP_GD" != "no"; then | |||
|
|||
if test "$PHP_EXTERNAL_GD" = "no"; then | |||
GD_CFLAGS="" | |||
dnl Disable strict prototypes as GD takes advantages of variadic function signatures for function pointers. |
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.
Can gd be fixed somehow too?
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.
No, because libgd does that and not the PHP implementation.
As I've been prompted by #5887
I'm not totally sure how to fix the GD and scanf ones.
pspell will need to have the warning disabled as we are working with system libraries.
Hopefully not too many more pop up from Azure.