From 4c52bcd870c78fde7d1778a4f232819df7975451 Mon Sep 17 00:00:00 2001 From: Alex Young Date: Mon, 11 Jun 2012 15:26:42 +0100 Subject: [PATCH] Make the error and fatal functions swallow semicolons properly --- src/util.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/util.h b/src/util.h index 078f706..b775581 100644 --- a/src/util.h +++ b/src/util.h @@ -83,16 +83,16 @@ void mylog(int line_level, const char* format, ...); #define warn(msg, ...) mylog(2, "%s:%d: " msg, __FILE__, __LINE__, ##__VA_ARGS__) /* mylog a message and invoke the error handler to recover */ -#define error(msg, ...) { \ +#define error(msg, ...) do { \ mylog(3, "*** %s:%d: " msg, __FILE__, __LINE__, ##__VA_ARGS__); \ error_handler(0); \ -} +} while(0) /* mylog a message and invoke the error handler to kill the current thread */ -#define fatal(msg, ...) { \ +#define fatal(msg, ...) do { \ mylog(4, "*** %s:%d: " msg, __FILE__, __LINE__, ##__VA_ARGS__); \ error_handler(1); \ -} +} while(0) #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)