I have 2 variadic macros, one of them compiles fine and the other one doesn't:
#define ASSERT(x, ...) assert_log(x, __FILE__, __LINE__, __VA_ARGS__)
#define TRACE (x, ...) trace(x, __FILE__, __LINE__, __VA_ARGS__)
...
libs/defs.h:16:71: error: __VA_ARGS__ can only appear in the expansion of a C99 variadic macro [-Werror]
16 | #define TRACE (x, ...) trace(x, __FILE__, __LINE__, __VA_ARGS__)
| ^
Their declared signatures:
void assert_log(int, const char*, int, const char* , ...);
void trace(int, const char*, int, const char* , ...);
Compilation flags:
CFLAGS= \
-Wextra \
-Werror \
-Wall \
-Wfloat-equal \
-Wundef \
-Wshadow \
-Wcast-align \
-Wstrict-prototypes \
-Wswitch-enum \
-Wformat=2 \
-Werror=pointer-arith \
-Wuninitialized \
-pedantic \
-std=c17 \
-DDEBUG=1 \
-g \
-Og
Given the fact that their signature is the same, I don't understand why is GCC complaning?