Skip to content

Zend: convert op_type IS_* to an enum - #24696

Open
Girgias wants to merge 2 commits into
php:masterfrom
Girgias:2026-10-zend_op_type-enum
Open

Girgias wants to merge 2 commits into
php:masterfrom
Girgias:2026-10-zend_op_type-enum

Conversation

@Girgias

@Girgias Girgias commented Oct 25, 2026

Copy link
Copy Markdown
Member

No description provided.

Comment thread Zend/zend_compile.h Resolved
@ndossche

Copy link
Copy Markdown
Member

Want a hack to get rid of the warnings?

#define IS_UNUSED  IS_UNUSED
#define IS_CONST   IS_CONST
#define IS_TMP_VAR IS_TMP_VAR
#define IS_VAR     IS_VAR
#define IS_CV      IS_CV

put this after the enum definition.

Anyway, is it worth it doing these (=this PR) kinds of changes? It takes reviewer effort to check for correctness and debugging effort to resolve issues like the warnings from CI. For me, the code was already clear in the expectation of what is allowed to be passed tbh.

@Girgias
Girgias force-pushed the 2026-10-zend_op_type-enum branch from 58509e0 to b2335f1 Compare November 2, 2026 12:41
And use the new type to improve clarity rather than just a uint8_t
@Girgias
Girgias force-pushed the 2026-10-zend_op_type-enum branch from 0e74282 to 1b26907 Compare November 26, 2026 14:55
@Girgias
Girgias marked this pull request as ready for review November 26, 2026 14:55
@Girgias
Girgias requested a review from dstogov as a code owner November 26, 2026 14:55
@Girgias

Girgias commented Nov 26, 2026

Copy link
Copy Markdown
Member Author

Anyway, is it worth it doing these (=this PR) kinds of changes? It takes reviewer effort to check for correctness and debugging effort to resolve issues like the warnings from CI. For me, the code was already clear in the expectation of what is allowed to be passed tbh.

I do think it is worth as the parameter names aren't always obvious and it turns out some cases aren't just restricted to those values although their name might imply it. Arguably the fact the VM was using these to do some preprocessor logic is also a bit of a code smell :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants