[cfe-commits] [PATCH] Suppress elided variadic macro argument diagnostic with comma pasting extension
Eli Friedman
eli.friedman at gmail.com
Mon Nov 12 17:44:55 PST 2012
On Mon, Nov 12, 2012 at 5:34 PM, Richard Smith <richard at metafoo.co.uk> wrote:
> On Mon, Nov 12, 2012 at 4:38 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
>> On Mon, Nov 12, 2012 at 3:49 PM, Richard Smith <richard at metafoo.co.uk> wrote:
>>> 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".
>
> Sorry, I meant to say, disable the comma-pasting diagnostic for a
> macro with any parameters, where no arguments have been provided for
> the ellipsis (that is, in exactly those cases where we will have
> already produced the 'no arguments provided for ellipsis' diagnostic).
Hmm... that would eliminate the duplicate diagnostic, but the
diagnostic we would get would point at the use instead of the
definition. (Having the diagnostic point at the definition is useful
so it can be suppressed at the definition.)
-Eli
More information about the cfe-commits
mailing list