https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127491
Bug ID: 127491
Summary: Variadic macro documentation incorrectly says , ##
__VA_ARGS__ removes the comma for an empty argument
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
Assignee: unassigned at gcc dot gnu.org
Reporter: bic60176 at gmail dot com
Target Milestone: ---
#define A(t, ...) f(t, ## __VA_ARGS__, 99999)
void f(int, int);
int main(void)
{
A(1,);
}
gcc -std=gnu23 -E test.c
Actual: the comma is retained for an explicitly empty argument, producing the
equivalent of:
f(1, , 99999);
Expected documentation behavior: distinguish an omitted variadic argument from
an explicitly supplied but empty argument. Ask that the inconsistent GCC manual
sections be reconciled.