c: Allow omitted parameter names for C2x
authorJoseph Myers <joseph@codesourcery.com>
Wed, 28 Oct 2020 18:57:02 +0000 (18:57 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 28 Oct 2020 18:58:43 +0000 (18:58 +0000)
commita4223abb3deb24e8104bbfec6f0f21579c1889e3
treea9faf863b7f5795bb9f45e505fe7eaa342d435ec
parenta0e4d7b44c544c84cffc7ff9c64b6f1af14fb08d
c: Allow omitted parameter names for C2x

C2x allows parameter names to be omitted in function definitions, as
in C++; add support for this feature.  As with other features that
only result in previously rejected code being accepted, this feature
is now accepted as an extension for previous standard versions, with a
pedwarn-if-pedantic that is disabled by -Wno-c11-c2x-compat.  The
logic for avoiding unused-parameter warnings for unnamed parameters is
in code shared between C and C++, so no changes are needed there.

Bootstrapped with no regressions for x86_64-pc-linux-gnu.

gcc/c/
2020-10-28  Joseph Myers  <joseph@codesourcery.com>

* c-decl.c (store_parm_decls_newstyle): Use pedwarn_c11 not
error_at for omitted parameter name.

gcc/testsuite/
2020-10-28  Joseph Myers  <joseph@codesourcery.com>

* gcc.dg/c11-parm-omit-1.c, gcc.dg/c11-parm-omit-2.c,
gcc.dg/c11-parm-omit-3.c, gcc.dg/c11-parm-omit-4.c,
gcc.dg/c2x-parm-omit-1.c, gcc.dg/c2x-parm-omit-2.c,
gcc.dg/c2x-parm-omit-3.c, gcc.dg/c2x-parm-omit-4.c: New tests.
* gcc.dg/noncompile/pr79758.c: Do not expect error for omitted
parameter name.
gcc/c/c-decl.c
gcc/testsuite/gcc.dg/c11-parm-omit-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c11-parm-omit-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c11-parm-omit-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c11-parm-omit-4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2x-parm-omit-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2x-parm-omit-2.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2x-parm-omit-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2x-parm-omit-4.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/noncompile/pr79758.c