ASSERT should evaluate to an expression not a statement.
authorBen Pfaff <blp@cs.stanford.edu>
Mon, 18 Oct 2004 17:42:40 +0000 (17:42 +0000)
committerBen Pfaff <blp@cs.stanford.edu>
Mon, 18 Oct 2004 17:42:40 +0000 (17:42 +0000)
src/lib/debug.h

index 947dff204f17fab746107a8def7b097d23a3db52..76c3f77b732f8aa807847fb9be13a7af91c2bb8d 100644 (file)
@@ -37,10 +37,8 @@ void debug_backtrace (void);
 #undef NOT_REACHED
 
 #ifndef NDEBUG
-#define ASSERT(CONDITION)                                       \
-        if (CONDITION) { } else {                               \
-                PANIC ("assertion `%s' failed.", #CONDITION);   \
-        }
+#define ASSERT(CONDITION)                                                    \
+        ((void) ((CONDITION) || PANIC ("assertion `%s' failed.", #CONDITION)))
 #define NOT_REACHED() PANIC ("executed an unreachable statement");
 #else
 #define ASSERT(CONDITION) ((void) 0)