diff options
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 |