Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Zend/zend_portability.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
#include "../TSRM/TSRM.h"

#include <stdio.h>
#if ZEND_DEBUG && defined(NDEBUG)
# error "NDEBUG must not be defined when ZEND_DEBUG is enabled"
#endif
#include <assert.h>
#include <math.h>

Expand Down
6 changes: 6 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,8 @@ PHP_ARG_ENABLE([debug],
AS_VAR_IF([PHP_DEBUG], [yes], [
PHP_DEBUG=1
ZEND_DEBUG=yes
CFLAGS="$CFLAGS -U NDEBUG"
CXXFLAGS="$CFLAGS -U NDEBUG"
PHP_REMOVE_OPTIMIZATION_FLAGS
dnl Add -O0 only if GCC or ICC is used.
if test "$GCC" = "yes" || test "$ICC" = "yes"; then
Expand All @@ -817,6 +819,8 @@ AS_VAR_IF([PHP_DEBUG], [yes], [
], [
PHP_DEBUG=0
ZEND_DEBUG=no
CFLAGS="$CFLAGS -D NDEBUG"
CXXFLAGS="$CFLAGS -D NDEBUG"
])

PHP_ARG_ENABLE([debug-assertions],
Expand All @@ -829,6 +833,8 @@ PHP_ARG_ENABLE([debug-assertions],
AS_VAR_IF([PHP_DEBUG_ASSERTIONS], [yes], [
PHP_DEBUG=1
ZEND_DEBUG=yes
CFLAGS="$CFLAGS -U NDEBUG"
CXXFLAGS="$CFLAGS -U NDEBUG"
])

AC_ARG_ENABLE([zts],
Expand Down
6 changes: 0 additions & 6 deletions ext/zend_test/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,6 @@
#include "zend_exceptions.h"
#include "zend_mm_custom_handlers.h"

// `php.h` sets `NDEBUG` when not `PHP_DEBUG` which will make `assert()` from
// assert.h a no-op. In order to have `assert()` working on NDEBUG builds, we
// undefine `NDEBUG` and re-include assert.h
#undef NDEBUG
#include "assert.h"

#if defined(HAVE_LIBXML) && !defined(PHP_WIN32)
# include <libxml/globals.h>
# include <libxml/parser.h>
Expand Down
7 changes: 0 additions & 7 deletions main/php.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,6 @@ typedef int pid_t;
# endif
#endif

#if PHP_DEBUG
#undef NDEBUG
#else
#ifndef NDEBUG
#define NDEBUG
#endif
#endif
#include <assert.h>

#ifdef HAVE_UNIX_H
Expand Down
2 changes: 1 addition & 1 deletion win32/build/confutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3429,7 +3429,7 @@ function toolset_setup_common_libs()
function toolset_setup_build_mode()
{
if (PHP_DEBUG == "yes") {
ADD_FLAG("CFLAGS", "/LDd /MDd /Od /D ZEND_DEBUG=1 " +
ADD_FLAG("CFLAGS", "/LDd /MDd /Od /U NDebug /U NDEBUG /D ZEND_DEBUG=1 " +
(TARGET_ARCH == 'x86'?"/ZI":"/Zi"));
ADD_FLAG("LDFLAGS", "/debug");
// Avoid problems when linking to release libraries that use the release
Expand Down
Loading