]> git.ipfire.org Git - thirdparty/gcc.git/commit
c: C2x removal of unprototyped functions
authorJoseph Myers <joseph@codesourcery.com>
Thu, 1 Sep 2022 19:10:59 +0000 (19:10 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Thu, 1 Sep 2022 19:10:59 +0000 (19:10 +0000)
commit0a4b219d39c74aec7ebf87ac3be38d8f93efd634
tree1d373c6356bce1bebd7d528f04dd1e1dfb9db9e4
parentd2694766dcfff0278fa93d581340a10b150c0f44
c: C2x removal of unprototyped functions

C2x has completely removed unprototyped functions, so that () now
means the same as (void) in both function declarations and
definitions, where previously that change had been made for
definitions only.  Implement this accordingly.

This is a change where GNU/Linux distribution builders might wish to
try builds with a -std=gnu2x default to start early on getting old
code fixed that still has () declarations for functions taking
arguments, in advance of GCC moving to -std=gnu2x as default maybe in
GCC 14 or 15; I don't know how much such code is likely to be in
current use.

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

gcc/c/
* c-decl.cc (grokparms): Handle () in a function declaration the
same as (void) for C2X.

gcc/testsuite/
* gcc.dg/c11-unproto-3.c, gcc.dg/c2x-unproto-3.c,
gcc.dg/c2x-unproto-4.c: New tests.
* gcc.dg/c2x-old-style-definition-6.c, gcc.dg/c2x-unproto-1.c,
gcc.dg/c2x-unproto-2.c: Update for removal of unprototyped
functions.
gcc/c/c-decl.cc
gcc/testsuite/gcc.dg/c11-unproto-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2x-old-style-definition-6.c
gcc/testsuite/gcc.dg/c2x-unproto-1.c
gcc/testsuite/gcc.dg/c2x-unproto-2.c
gcc/testsuite/gcc.dg/c2x-unproto-3.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/c2x-unproto-4.c [new file with mode: 0644]