From 13a6a403a4e541b65cf731e52d944590a0f9ddae Mon Sep 17 00:00:00 2001 From: Alex Young Date: Mon, 11 Jun 2012 15:23:06 +0100 Subject: [PATCH] Make the error and fatal macros swallow semicolons properly --- src/util.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/util.h b/src/util.h index d42fbf1..078f706 100644 --- a/src/util.h +++ b/src/util.h @@ -94,8 +94,8 @@ void mylog(int line_level, const char* format, ...); error_handler(1); \ } -#define ERROR_IF( test, msg, ... ) if ((test)) { error(msg, ##__VA_ARGS__); } -#define FATAL_IF( test, msg, ... ) if ((test)) { fatal(msg, ##__VA_ARGS__); } +#define ERROR_IF( test, msg, ... ) do { if ((test)) { error(msg, ##__VA_ARGS__); } } while(0) +#define FATAL_IF( test, msg, ... ) do { if ((test)) { fatal(msg, ##__VA_ARGS__); } } while(0) #define ERROR_UNLESS( test, msg, ... ) ERROR_IF( !(test), msg, ##__VA_ARGS__ ) #define FATAL_UNLESS( test, msg, ... ) FATAL_IF( !(test), msg, ##__VA_ARGS__ )