Extensions should have the final say on their compiler flags #6204
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently compiler flags passed by extensions using the standard
PHP_NEW_EXTENSION
andPHP_ADD_SOURCES
m4 macros are prepended before the ones defined byZend/Zend.m4
. This was not really an issue before asZend.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 #6199A preliminary attempt was 5c1cf76 but this turns out to be more or less irrelevant.
The root issue is that
PHP_NEW_EXTENSION
andPHP_ADD_SOURCES
call thePHP_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 thespecial-flags
argument to be appended instead of prepended.