From e8899ce6c4b4fad8cc52cc1ffe02ca9e01a6b5ad Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 18 Oct 2004 17:42:40 +0000 Subject: [PATCH] ASSERT should evaluate to an expression not a statement. --- src/lib/debug.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/lib/debug.h b/src/lib/debug.h index 947dff2..76c3f77 100644 --- a/src/lib/debug.h +++ b/src/lib/debug.h @@ -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) -- 2.30.2