Remove unreachable code after zend_error_noreturn calls.#20983
Conversation
iluuu1994
left a comment
There was a problem hiding this comment.
No strong opinion, some compilers do not understand ZEND_NORETURN and thus may fail with strange errors in some cases. Also, you missed a few similar instances. This regex may help. zend_error_noreturn\([^)]*\);\n\s*[^}\s]
Thank @iluuu1994 for the feedback. I noticed the codebase already has instances where Regarding the remaining instances from your regex, Would you prefer that I:
Happy to adjust based on your guidance. |
|
Fair enough. Please adjust the remaining cases then. |
|
That code was kept to avoid "warning: control reaches end of non-void function" on Windows. |
Thanks @dstogov for the feedback, makes sense. I’m on macOS, so I didn’t hit that. Is this MSVC C4715? I’d like to reproduce locally / confirm via CI |
|
@khaledalam Windows already runs in CI. I'm guessing Dmitry is referring to older versions of MSVC. IMO this change should be ok for master. If somebody complains it can always be reverted. |
I see |
|
Thanks @khaledalam! |
|
You are welcome 🙏 @iluuu1994 |
Description
zend_error_noreturn() never returns (marked with ZEND_NORETURN), so any code following it is dead code that can never be executed.