Handle removal of old-style function definitions in C2x.
C2x removes support for old-style function definitions with identifier
lists, changing () in function definitions to be equivalent to (void)
(while () in declarations that are not definitions still gives an
unprototyped type).
This patch updates GCC accordingly. The new semantics for () are
implemented for C2x mode (meaning () in function definitions isn't
diagnosed by -Wold-style-definition in that mode).
-Wold-style-definition is enabled by default, and turned into a
pedwarn, for C2x.
Bootstrapped with no regressions on x86_64-pc-linux-gnu.
gcc:
* doc/invoke.texi (-Wold-style-definition): Document () not being
considered an old-style definition for C2x.
gcc/c:
* c-decl.c (grokparms): Convert () in a function definition to
(void) for C2x.
(store_parm_decls_oldstyle): Pedwarn for C2x.
(store_parm_decls): Update comment about () not generating a
prototype.
gcc/c-family:
* c.opt (Wold-style-definition): Initialize to -1.
* c-opts.c (c_common_post_options): Set warn_old_style_definition
to flag_isoc2x if not set explicitly.
gcc/testsuite:
* gcc.dg/c11-old-style-definition-1.c,
gcc.dg/c11-old-style-definition-2.c,
gcc.dg/c2x-old-style-definition-1.c,
gcc.dg/c2x-old-style-definition-2.c,
gcc.dg/c2x-old-style-definition-3.c,
gcc.dg/c2x-old-style-definition-4.c,
gcc.dg/c2x-old-style-definition-5.c,
gcc.dg/c2x-old-style-definition-6.c: New tests.
From-SVN: r277945
16 files changed: