From d3c394c78ceb6babdb3caeb83cbea0206d4a8939 Mon Sep 17 00:00:00 2001 From: David Phillips Date: Mon, 4 Jan 2021 14:26:45 +1300 Subject: Prefer ,##__VA_ARGS over __VA_OPT__(.) __VA_OPT__ is not well supported by compilers other than gcc (see clang), most likely as it is not yet standardised, and appears much newer than ,##. Even though ,## is not standardised either, it is more likely to be supported by a given compiler. --- common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/common.h b/common.h index 6b2e92d..aa99e32 100644 --- a/common.h +++ b/common.h @@ -12,10 +12,10 @@ int get_int(const char* string); #define STR_LINE STRING(__LINE__) /* */ -#define info(format, ...) printf("INFO : "__FILE__"@%s():"STR_LINE": "format, __func__ __VA_OPT__(,) __VA_ARGS__) +#define info(format, ...) printf("INFO : "__FILE__"@%s:"STR_LINE": "format, __func__, ##__VA_ARGS__) #ifdef DEBUG -#define debug(format, ...) fprintf(stderr, "DEBUG: "__FILE__"@%s():"STR_LINE": "format, __func__ __VA_OPT__(,) __VA_ARGS__) +#define debug(format, ...) fprintf(stderr, "DEBUG: "__FILE__"@%s:"STR_LINE": "format, __func__, ##__VA_ARGS__) #else #define debug(...) #endif -- cgit v1.1