diff options
author | Florian Weimer <fweimer@redhat.com> | 2023-12-01 08:10:13 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2023-12-01 08:10:13 +0100 |
commit | ff9efa3fc48baa1dee7ed376c25ecfcfbc28d35c (patch) | |
tree | 39fac4a15ab0e626be52cc2d95f1b2ee6a9c0dd2 /gcc/c/c-decl.cc | |
parent | 9715c545d33b3a32ddc1ae817ba9356ade1fb9df (diff) | |
download | gcc-ff9efa3fc48baa1dee7ed376c25ecfcfbc28d35c.zip gcc-ff9efa3fc48baa1dee7ed376c25ecfcfbc28d35c.tar.gz gcc-ff9efa3fc48baa1dee7ed376c25ecfcfbc28d35c.tar.bz2 |
c: Add new -Wdeclaration-missing-parameter-type permerror
This used to be a warning, enabled by default, without its own option.
A subsequent change could improve diagnostics and provide spelling
hints for declarations like “void function (int32t);”.
gcc/c-family/
* c.opt (Wdeclaration-missing-parameter-type): New.
gcc/c/ChangeLog:
PR other/44209
* c-decl.cc (grokparms): Issue permerror for
OPT_Wdeclaration_missing_parameter_type instead of a pedwarn.
gcc/ChangeLog:
* doc/invoke.texi (Warning Options): Document
-Wdeclaration-missing-parameter-type.
gcc/testsuite/ChangeLog:
* gcc.dg/permerror-default.c (missing_parameter_type):
Expect error.
* gcc.dg/permerror-fpermissive.c (missing_parameter_type):
Expect -Wdeclaration-missing-parameter-type warning.
* gcc.dg/permerror-gnu89-nopermissive.c (missing_parameter_type):
Expect -Wdeclaration-missing-parameter-type error.
* gcc.dg/permerror-gnu89-pedantic.c (missing_parameter_type):
Likewise.
* gcc.dg/permerror-gnu89.c (missing_parameter_type):
Expect -Wdeclaration-missing-parameter-type warning.
* gcc.dg/permerror-noerror.c: Add
-Wno-error=declaration-missing-parameter-type to build flags.
(missing_parameter_type): Expect
-Wdeclaration-missing-parameter-type warning.
* gcc.dg/permerror-nowarning.c: Build with
-Wno-declaration-missing-parameter-type. Remove previously
expected warning.
* gcc.dg/permerror-fpermissive-nowarning.c: Likewise.
* gcc.dg/permerror-pedantic.c (missing_parameter_type):
Expect -Wdeclaration-missing-parameter-type error.
* gcc.dg/permerror-system.c (missing_parameter_type):
Likewise.
Diffstat (limited to 'gcc/c/c-decl.cc')
-rw-r--r-- | gcc/c/c-decl.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/c/c-decl.cc b/gcc/c/c-decl.cc index 8123924..d388e12 100644 --- a/gcc/c/c-decl.cc +++ b/gcc/c/c-decl.cc @@ -8343,8 +8343,10 @@ grokparms (struct c_arg_info *arg_info, bool funcdef_flag) { if (!funcdef_flag) { - pedwarn (input_location, 0, "parameter names (without types) in " - "function declaration"); + permerror_opt (input_location, + OPT_Wdeclaration_missing_parameter_type, + "parameter names (without types) in " + "function declaration"); arg_info->parms = NULL_TREE; } else |