[cfe-commits] [PATCH] Suppress elided variadic macro argument diagnostic with comma pasting extension

Eli Friedman eli.friedman at gmail.com
Mon Nov 12 16:38:23 PST 2012


On Mon, Nov 12, 2012 at 3:49 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> On Mon, Nov 12, 2012 at 2:48 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
>> Is anyone planning to look at this patch?
>
> Patch looks fine, but the approach makes me very slightly nervous (if
> the two warnings ever get put into different warning groups, and only
> the empty-vararg-list warning is enabled, we'll incorrectly suppress
> it).

If someone suppresses the comma-pasting diagnostic, I would assume
they don't care about the empty-vararg-list diagnostic anyway because
the use of comma-pasting in the definition implies that you expect the
user of the macro to use the empty-vararg-list extension.

> As an alternative, could we disable the comma-pasting diagnostic for a
> macro with any parameters?

If I'm following what you're asking correctly, the standard requires
us to diagnose the following:

#define A(a, ...) f(a, ## __VA_ARGS__)
void f(int,int,int);
void g() {
  A(1,2,3);
}

because without the comma pasting extension, we would try to form a token ",2".

-Eli



More information about the cfe-commits mailing list