Skip to content

Extensions should have the final say on their compiler flags #6204

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

Closed

Conversation

Girgias
Copy link
Member

@Girgias Girgias commented Sep 24, 2020

Currently compiler flags passed by extensions using the standard PHP_NEW_EXTENSION and PHP_ADD_SOURCES m4 macros are prepended before the ones defined by Zend/Zend.m4. This was not really an issue before as Zend.m4 only included -Wall but since the addition of -Wextra various issue about disabling flags have been brought up, notably by @bwoebi and I've hit this once again in #6199

A preliminary attempt was 5c1cf76 but this turns out to be more or less irrelevant.

The root issue is that PHP_NEW_EXTENSION and PHP_ADD_SOURCES call the PHP_ADD_SOURCES_X macro and pass their flags as the 3rd argument which prepends the flags. There exists a 6th argument for this macro which appends them but from a cursory look at https://heap.space/search?full=PHP_ADD_SOURCES_X&project=php-src this is not used. Moreover, the comment describing this macro explicitly informs that this macro should not be used directly.

The proposal is to drop the 6th argument of PHP_ADD_SOURCES_X and move the special-flags argument to be appended instead of prepended.

@Girgias Girgias requested a review from remicollet September 24, 2020 12:41
@Girgias Girgias force-pushed the compiler-flags-extensions-override-zend branch from f2e7ca8 to 147bf84 Compare September 25, 2020 14:08
Copy link
Member

@nikic nikic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable to me at least. I've run into this problem as well.

@php-pulls php-pulls closed this in 07a2f30 Sep 28, 2020
@Girgias Girgias deleted the compiler-flags-extensions-override-zend branch July 17, 2023 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants