aboutsummaryrefslogtreecommitdiff
path: root/gcc/doc/invoke.texi
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2019-11-08 01:21:40 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2019-11-08 01:21:40 +0000
commit017c6491077bee998eed9ed6520026285c906d37 (patch)
tree17e627d2d781e8f6c48233b95f8bec50f1734fe2 /gcc/doc/invoke.texi
parent3d6e7aa95cf3b354dded4cb1a8c546cbe217beb9 (diff)
downloadgcc-017c6491077bee998eed9ed6520026285c906d37.zip
gcc-017c6491077bee998eed9ed6520026285c906d37.tar.gz
gcc-017c6491077bee998eed9ed6520026285c906d37.tar.bz2
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
Diffstat (limited to 'gcc/doc/invoke.texi')
-rw-r--r--gcc/doc/invoke.texi5
1 files changed, 4 insertions, 1 deletions
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
index 15fe228..00eb7e7 100644
--- a/gcc/doc/invoke.texi
+++ b/gcc/doc/invoke.texi
@@ -7334,7 +7334,10 @@ is also enabled by @option{-Wextra}.
@opindex Wold-style-definition
@opindex Wno-old-style-definition
Warn if an old-style function definition is used. A warning is given
-even if there is a previous prototype.
+even if there is a previous prototype. A definition using @samp{()}
+is not considered an old-style definition in C2X mode, because it is
+equivalent to @samp{(void)} in that case, but is considered an
+old-style definition for older standards.
@item -Wmissing-parameter-type @r{(C and Objective-C only)}
@opindex Wmissing-parameter-type