arocc
arocc copied to clipboard
Preprocessor: comma deletion by token-pasting operator
If ## appears between a comma and __VA_ARGS__ in a function-like macro, and the variable argument is omitted, the comma will be deleted in the expansion:
#define eprintf(format, ...) fprintf (stderr, format, ##__VA_ARGS__)
eprintf("test");
eprintf("test", 2);
expands to:
fprintf (stderr, "test");
fprintf (stderr, "test", 2);
GCC does not issue any warnings; clang issues a pedantic warning warning: token pasting of ',' and __VA_ARGS__ is a GNU extension [-Wgnu-zero-variadic-macro-arguments]