summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2012-09-15 22:55:21 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-09-15 23:20:48 +0200
commit659c6a363bf84bd2520042ba80bc507763b57b78 (patch)
tree41079d20ca1d37959ee062eaabcf8cbc1bc3257d
parent7a042c8204628c573fc52d5fb4e4a5ba650b1604 (diff)
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
-rw-r--r--sal/inc/sal/macros.h17
-rw-r--r--solenv/gbuild/gbuild.mk11
-rw-r--r--solenv/inc/settings.mk7
3 files changed, 10 insertions, 25 deletions
diff --git a/sal/inc/sal/macros.h b/sal/inc/sal/macros.h
index bb0e46e9876e..ee44aa3f4bbb 100644
--- a/sal/inc/sal/macros.h
+++ b/sal/inc/sal/macros.h
@@ -31,23 +31,6 @@
#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
# if defined(__cplusplus) && ( defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L )
/*
diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk
index a073e3961bd4..20ac7a0a0d9f 100644
--- a/solenv/gbuild/gbuild.mk
+++ b/solenv/gbuild/gbuild.mk
@@ -214,8 +214,13 @@ endif
ifeq ($(gb_DEBUGLEVEL),0)
gb_GLOBALDEFS += \
-DOPTIMIZE \
+
+ifeq ($(strip $(ASSERT_ALWAYS_ABORT)),FALSE)
+gb_GLOBALDEFS += \
-DNDEBUG \
+endif
+
else
gb_GLOBALDEFS += \
-DSAL_LOG_INFO \
@@ -228,12 +233,6 @@ gb_GLOBALDEFS += \
endif
endif
-ifeq ($(strip $(ASSERT_ALWAYS_ABORT)),TRUE)
-gb_GLOBALDEFS += \
- -DASSERT_ALWAYS_ABORT \
-
-endif
-
ifneq ($(strip $(ENABLE_GTK)),)
gb_GLOBALDEFS += -DENABLE_GTK
endif
diff --git a/solenv/inc/settings.mk b/solenv/inc/settings.mk
index e24c0e6cd1d3..15bd3f0c7eb0 100644
--- a/solenv/inc/settings.mk
+++ b/solenv/inc/settings.mk
@@ -1074,10 +1074,13 @@ RSCDEFS+=-DDBG_UTIL
.ENDIF
.IF "$(product)"!=""
-CDEFS+= -DPRODUCT -DNDEBUG
-RSCDEFS+= -DPRODUCT
+CDEFS+= -DPRODUCT
+RSCDEFS+= -DPRODUCT
+.IF "$(ASSERT_ALWAYS_ABORT)"=="FALSE"
+CDEFS+=-DNDEBUG
RSCDEFS+= -DNDEBUG
.ENDIF
+.ENDIF
.IF "$(DBG_LEVEL)"!=""
CDEFS+=-DOSL_DEBUG_LEVEL=$(DBG_LEVEL)