[PPL-devel] [GIT] ppl/ppl(master): Improved the NDEBUG machinery.

Roberto Bagnara bagnara at cs.unipr.it
Mon Feb 15 16:08:05 CET 2010


Module: ppl/ppl
Branch: master
Commit: 6d5b20eeba492c227efeaa43d804a8500ea87a13
URL:    http://www.cs.unipr.it/git/gitweb.cgi?p=ppl/ppl.git;a=commit;h=6d5b20eeba492c227efeaa43d804a8500ea87a13

Author: Roberto Bagnara <bagnara at cs.unipr.it>
Date:   Mon Feb 15 16:07:42 2010 +0100

Improved the NDEBUG machinery.

---

 Watchdog/configure.ac      |    4 ++--
 Watchdog/src/pwl_header.hh |    6 ++++--
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/Watchdog/configure.ac b/Watchdog/configure.ac
index 4e7b1a8..b0d2f4b 100644
--- a/Watchdog/configure.ac
+++ b/Watchdog/configure.ac
@@ -49,7 +49,7 @@ ISODATE=`date +%Y-%m-%d`
 AC_SUBST(ISODATE)
 
 AH_BOTTOM([
-#ifdef PWL_NDEBUG
+#if defined(PWL_NDEBUG) && !defined(NDEBUG)
 # define NDEBUG PWL_NDEBUG
 #endif
 ])
@@ -196,7 +196,7 @@ yes)
   ;;
 no)
   AC_MSG_RESULT(no)
-  AC_DEFINE(NDEBUG, 1, [Assertions are disabled when this is defined])
+  AC_DEFINE(PWL_NDEBUG, 1, [Assertions are disabled when this is defined])
   debug_flag="-DNDEBUG=1"
   ;;
 *)
diff --git a/Watchdog/src/pwl_header.hh b/Watchdog/src/pwl_header.hh
index 3af7a56..4ac7d7e 100644
--- a/Watchdog/src/pwl_header.hh
+++ b/Watchdog/src/pwl_header.hh
@@ -24,7 +24,7 @@ site: http://www.cs.unipr.it/ppl/ . */
 #define PWL_pwl_hh 1
 
 #ifdef NDEBUG
-# define PWL_SAVE_NDEBUG 1
+# define PWL_SAVE_NDEBUG NDEBUG
 # undef NDEBUG
 #endif
 
@@ -33,7 +33,7 @@ site: http://www.cs.unipr.it/ppl/ . */
 
 #ifdef PWL_SAVE_NDEBUG
 # ifndef NDEBUG
-#  define NDEBUG 1
+#  define NDEBUG PWL_SAVE_NDEBUG
 # endif
 # undef PWL_SAVE_NDEBUG
 #else
@@ -41,6 +41,8 @@ site: http://www.cs.unipr.it/ppl/ . */
 #  undef NDEBUG
 # endif
 #endif
+// Must include <cassert> again in order to make the latest changes to
+// NDEBUG effective.
 #include <cassert>
 
 #endif




More information about the PPL-devel mailing list