[php-src] PR #15544: Support --enable-debug-assertions configure option on Windows
| From: | cmb69 | Date: | Thu, 22 Aug 2024 16:31:44 +0000 |
| Subject: | [php-src] PR #15544: Support --enable-debug-assertions configure option on Windows | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-28129@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/15544
Author: cmb69
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] <https://github.com/php/php-src/commit/c4e2ca607f49d37564aaf34f5a48c5e59aca12a6>
---
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](https://github.com/php/php-src/actions/runs/10498650502/job/29083989504?pr=15361#step:6:412),
due to
https://github.com/php/php-src/blob/c79e723725083b53002e06c44c7f9b271146385e/ext/ffi/tests/utils.inc#L12-L19
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:
* [ ] fix the failing FFI tests
* [ ] check whether everything works as intended for phpize builds
* [ ] check clang on Windows
Oh, and while I was working on this, I've noticed that setting or not setting the
NDEBUG macro shouldn't be necessary, due to
https://github.com/php/php-src/blob/c79e723725083b53002e06c44c7f9b271146385e/main/php.h#L112-L118
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
https://github.com/php/php-src/blob/c79e723725083b53002e06c44c7f9b271146385e/ext/zend_test/test.c#L41-L45
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 @realFlowControl
And 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, 05b9b20ed8e2f98b3fb71a227e49e11bdf7b9c6b), I have no idea what it's
supposed to do (maybe support for some ancient compiler?)