Make the error and fatal macros swallow semicolons properly

This commit is contained in:
Alex Young
2012-06-11 15:23:06 +01:00
parent 83b8b9eaac
commit 13a6a403a4

View File

@@ -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__ )