[PHP next] Support --enable-debug-assertions configure option on Windows #15544
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.
This has been introduced for non Windows system years ago[1] mainly to
improve fuzzer SAPI. While this is still not available on Windows, the
option can still make sense, particularly for CI runs or other
environments where full debugging support would be useless, but where
enabled assertions would be helpful.
[1] c4e2ca6
Thanks to @arnaud-lb for telling me about this configuration option!
Note that a couple of ext/ffi test are failing if this is enabled, due to
php-src/ext/ffi/tests/utils.inc
Lines 12 to 19 in c79e723
One may argue that the userland
PHP_DEBUG
shouldn't be set to true for--enable-debug-assertions
, but since it is on non Windows systems, it's probably okay.(The issue with the other failing test has been resolved in this PR.)
Still unresolved:
Oh, and while I was working on this, I've noticed that setting or not setting the
NDEBUG
macro shouldn't be necessary, due tophp-src/main/php.h
Lines 112 to 118 in c79e723
However, that doesn't affect Zend/, most notably zend_vm_execute.h will not grab that, so maybe this should be revised.
And I'm not sure about
php-src/ext/zend_test/test.c
Lines 41 to 45 in c79e723
While that worked for me, can we be sure that the inclusion of assert.h isn't guarded, so that this will not necessarily work? It might make more sense to run (some) CI jobs with
--enable-debug-assertions
instead. /cc @realFlowControlAnd I'm not sure what to do with the
NDebug
and_DEBUG
symbols; the latter is supposed to be automatically set by the compiler, so there is likely no need to set it manually. And regarding the former (which is apparently there since the beginning of the new Windows build infrastructure, 05b9b20), I have no idea what it's supposed to do (maybe support for some ancient compiler?)