Kaydet (Commit) 659c6a36 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

Let --enable-assert-always-abort affect setting NDEBUG directly

For one, assert.h is designed to be includeable multiple times with changing
NDEBUG settings, so it is not robust to include it early in sal/macros.h with
"correct" NDEBUG settings and potentially include it again later.  For another,
there is #ifndef NDEBUG code providing functionality used exclusively within
assert calls, which must be compiled with the same NDEBUG-setting as the
relevant #include <assert.h>.

Change-Id: I7b2f9c85f8e2155051274757c64162ed5a5e9d1b
üst 7a042c82
...@@ -31,23 +31,6 @@ ...@@ -31,23 +31,6 @@
#include <stddef.h> #include <stddef.h>
/* we want to be able to compile release code while retaining the abort capabilities of assert().
* This presume that this include is called early... i.e before anyone else included assert.h
* which should more often than not be the case since macros.h is included by sal/types.h
* which is included at the top of most source (or should be)
*/
#ifdef ASSERT_ALWAYS_ABORT
# ifdef NDEBUG
# undef NDEBUG
# include <assert.h>
# define NDEBUG
# else /* Ndef NDEBUG */
# include <assert.h>
# endif /* Ndef NDEBUG */
#else /* NDef ASSERT_ALWAYS_ABORT */
# include <assert.h>
#endif /* NDef ASSERT_ALWAYS_ABORT */
#ifndef SAL_N_ELEMENTS #ifndef SAL_N_ELEMENTS
# if defined(__cplusplus) && ( defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L ) # if defined(__cplusplus) && ( defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L )
/* /*
......
...@@ -214,8 +214,13 @@ endif ...@@ -214,8 +214,13 @@ endif
ifeq ($(gb_DEBUGLEVEL),0) ifeq ($(gb_DEBUGLEVEL),0)
gb_GLOBALDEFS += \ gb_GLOBALDEFS += \
-DOPTIMIZE \ -DOPTIMIZE \
ifeq ($(strip $(ASSERT_ALWAYS_ABORT)),FALSE)
gb_GLOBALDEFS += \
-DNDEBUG \ -DNDEBUG \
endif
else else
gb_GLOBALDEFS += \ gb_GLOBALDEFS += \
-DSAL_LOG_INFO \ -DSAL_LOG_INFO \
...@@ -228,12 +233,6 @@ gb_GLOBALDEFS += \ ...@@ -228,12 +233,6 @@ gb_GLOBALDEFS += \
endif endif
endif endif
ifeq ($(strip $(ASSERT_ALWAYS_ABORT)),TRUE)
gb_GLOBALDEFS += \
-DASSERT_ALWAYS_ABORT \
endif
ifneq ($(strip $(ENABLE_GTK)),) ifneq ($(strip $(ENABLE_GTK)),)
gb_GLOBALDEFS += -DENABLE_GTK gb_GLOBALDEFS += -DENABLE_GTK
endif endif
......
...@@ -1074,10 +1074,13 @@ RSCDEFS+=-DDBG_UTIL ...@@ -1074,10 +1074,13 @@ RSCDEFS+=-DDBG_UTIL
.ENDIF .ENDIF
.IF "$(product)"!="" .IF "$(product)"!=""
CDEFS+= -DPRODUCT -DNDEBUG CDEFS+= -DPRODUCT
RSCDEFS+= -DPRODUCT RSCDEFS+= -DPRODUCT
.IF "$(ASSERT_ALWAYS_ABORT)"=="FALSE"
CDEFS+=-DNDEBUG
RSCDEFS+= -DNDEBUG RSCDEFS+= -DNDEBUG
.ENDIF .ENDIF
.ENDIF
.IF "$(DBG_LEVEL)"!="" .IF "$(DBG_LEVEL)"!=""
CDEFS+=-DOSL_DEBUG_LEVEL=$(DBG_LEVEL) CDEFS+=-DOSL_DEBUG_LEVEL=$(DBG_LEVEL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment