gen_stub: Conditionally include zend_attributes.h to arginfo based on usage#21570
Open
dkulyk wants to merge 2 commits intophp:masterfrom
Open
gen_stub: Conditionally include zend_attributes.h to arginfo based on usage#21570dkulyk wants to merge 2 commits intophp:masterfrom
dkulyk wants to merge 2 commits intophp:masterfrom
Conversation
TimWolla
reviewed
Mar 29, 2026
Member
TimWolla
left a comment
There was a problem hiding this comment.
Yes, please. I don't necessarily agree with the implementation (it feels hack-ish), but the generated arginfo should absolutely be self-contained.
Author
|
I had a few ideas:
I would prefer the first option, since it also gives us room to add other features later. What do you think? |
Member
I don't have a strong opinion here, as I am not the maintainer of the gen_stub.php script and just make small fixes every now and then. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Conditionally include zend_attributes.h only when attributes are actually used.
Currently, zend_attributes.h must be explicitly included in C source files even when only common attributes (e.g. #[\Deprecated]) are needed. This introduces unnecessary coupling between extensions and attribute internals.
This change removes the requirement to manually include the header for common attributes, reducing boilerplate and avoiding unnecessary dependencies.
It does not affect behavior or runtime — only improves developer ergonomics and compilation dependencies.