diff options
author | Benoit Foucher <benoit@zeroc.com> | 2018-04-24 09:53:58 +0200 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2018-04-24 09:53:58 +0200 |
commit | bffe8dad96937c1c45c80eaf288fbb0cb5a8de33 (patch) | |
tree | 2f7738b1c850ac328f5119e605a67f3620d7134d /php/src/php5 | |
parent | Added diagnostic information in case the JS controller can't connect to the p... (diff) | |
download | ice-bffe8dad96937c1c45c80eaf288fbb0cb5a8de33.tar.bz2 ice-bffe8dad96937c1c45c80eaf288fbb0cb5a8de33.tar.xz ice-bffe8dad96937c1c45c80eaf288fbb0cb5a8de33.zip |
Enable asserts for the extension when built with debug (ICE-8703)
Diffstat (limited to 'php/src/php5')
-rw-r--r-- | php/src/php5/Config.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/php/src/php5/Config.h b/php/src/php5/Config.h index ebc27f30289..62a1e144a6e 100644 --- a/php/src/php5/Config.h +++ b/php/src/php5/Config.h @@ -50,6 +50,18 @@ extern "C" # pragma GCC diagnostic warning "-Wnarrowing" #endif +// +// The php.h header defines/undefines NDEBUG based on how the PHP binary was built. +// As a result, asserts are always disabled unless building against a php binary +// built with --enable-debug. We want to enable asserts for the PHP Ice extension +// when it's built without OPTIMIZE=yes. We save NDEBUG in a tmp macro here and +// explicitly re-include the assert.h header with the saved NDEBUG macro after +// including php.h +// +#ifndef NDEBUG +#define TMPDEBUG +#endif + #include "php.h" #ifdef _WIN32 @@ -65,6 +77,16 @@ extern "C" } #endif +// +// Enable asserts if the extension is built with debug. It's fine to include several times +// assert.h with a different NDEBUG setting. +// +#ifdef TMPDEBUG +#undef TMPDEBUG +#undef NDEBUG +#include <assert.h> +#endif + extern zend_module_entry ice_module_entry; #define phpext_ice_ptr &ice_module_entry |