On 11/14/2017 01:30 AM, Jakub Jelinek wrote:
> Hi!
>
> On Sun, Nov 12, 2017 at 12:33:03AM -0700, Tom Tromey wrote:
>> if (argc < macro->paramc)
>> {
>> - /* As an extension, variadic arguments are allowed to not appear in
>> + /* In C++2a (here the va_opt flag is used), and also as a GNU
>> + extension, variadic arguments are allowed to not appear in
>> the invocation at all.
>> e.g. #define debug(format, args...) something
>> debug("string");
>> @@ -778,7 +928,8 @@ _cpp_arguments_ok (cpp_reader *pfile, cpp_macro *macro,
>> const cpp_hashnode *node
>>
>> if (argc + 1 == macro->paramc && macro->variadic)
>> {
>> - if (CPP_PEDANTIC (pfile) && ! macro->syshdr)
>> + if (CPP_PEDANTIC (pfile) && ! macro->syshdr
>> + && ! CPP_OPTION (pfile, va_opt))
>> {
>> if (CPP_OPTION (pfile, cplusplus))
>> cpp_error (pfile, CPP_DL_PEDWARN,
>
> This change broke the macsyntx.c and sysmac1.c tests, which were expecting
> the "requires at least one" pedwarn, but were using -std=gnu99 which now
> enables the __VA_OPT__ support and thus allows as many arguments in the
> invocation as there are parameters in the macro definition (excluding the
> ...).
>
> The following patch turns those into dg-bogus and adds copies of the test
> that use -std=c99 that doesn't include __VA_OPT__ support and check for the
> pedwarns there.
>
> Tested on x86_64-linux, ok for trunk?
>
> 2017-11-14 Jakub Jelinek <ja...@redhat.com>
>
> * gcc.dg/cpp/macsyntx.c (var1, rest): Don't expect
> "requires at least one" warning.
> * gcc.dg/cpp/sysmac1.c (foo): Likewise.
> * gcc.dg/cpp/macsyntx2.c: New test.
> * gcc.dg/cpp/sysmac3.c: New test.
> * gcc.dg/cpp/sysmac3.h: New file.
OK.
jeff