Skip to content

Conversation

@dereckson
Copy link
Contributor

This fixes nine clang/llvm parentheses-equality warnings.

Example of warning

Zend/zend_vm_execute.h:59845:25: warning: equality comparison with extraneous parentheses [-Wparentheses-equality]
                        } else if ((op1_info == MAY_BE_LONG)) {
                                    ~~~~~~~~~^~~~~~~~~~~~~~
Zend/zend_vm_execute.h:59845:25: note: remove extraneous parentheses around the comparison to silence this warning
                        } else if ((op1_info == MAY_BE_LONG)) {
                                   ~         ^             ~
Zend/zend_vm_execute.h:59845:25: note: use '=' to turn this equality comparison into an assignment
                        } else if ((op1_info == MAY_BE_LONG)) {
                                             ^~
                                             =

@KalleZ
Copy link
Member

KalleZ commented Dec 22, 2016

You should update the zend_vm_execute.skl && zend_vm_gen.php instead, else its overridden the next time the executor is generated :)

@dereckson
Copy link
Contributor Author

Er, yes, it's indeed not really useful to correct an autogenerated file. Thanks to have pointed the source.

@dereckson
Copy link
Contributor Author

So, I've added to zend_vm_gen.php an helper function format_condition to add () only when needed, ie when the condition isn't already (...).

The zend_vm_gen.php generator now checks if the condition is already
enclosed by parentheses, and them only if needed.

This fixes nine clang/llvm parentheses-equality warnings.
@krakjoe
Copy link
Member

krakjoe commented Dec 23, 2016

Why target 7.1 ?

@php-pulls
Copy link

Comment on behalf of krakjoe at php.net:

labelling

@nikic
Copy link
Member

nikic commented Dec 23, 2016

@krakjoe This code has only been added in PHP 7.1.

@krakjoe
Copy link
Member

krakjoe commented Dec 23, 2016

If only I had read it properly, I see all the MAY_BE now ... thanks @nikic

@dereckson
Copy link
Contributor Author

dereckson commented Dec 23, 2016

@krakjoe Yes, the patch doesn't apply to 7.0 branch as zend_vm_set_opcode_handler_ex function didn't exist. It has been introduced at fc7cbdc, a squashed commit including f4475a2.

@php-pulls
Copy link

Comment on behalf of pollita at php.net:

Closed by 5d7c774

@php-pulls php-pulls closed this Dec 26, 2016
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.

5 participants