re PR middle-end/7651 (Define -Wextra strictly in terms of other warning flags)
2006-12-23 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR middle-end/7651 * c.opt (Wmissing-parameter-type): New. * doc/invoke.texi (Wmissing-parameter-type): Document it. (Wextra): Enabled by -Wextra. * c-opts.c (c_common_post_options): Enabled by -Wextra. * c-decl.c (store_parm_decls_oldstyle): Replace Wextra with Wmissing-parameter-type. testsuite/ * gcc.dg/Wmissing-parameter-type.c: New. * gcc.dg/Wmissing-parameter-type-Wextra.c: New. * gcc.dg/Wmissing-parameter-type-no.c: New. From-SVN: r120173
This commit is contained in:
parent
ea049a4199
commit
cb4af25a80
9 changed files with 62 additions and 10 deletions
|
@ -1,3 +1,13 @@
|
|||
2006-12-23 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
|
||||
|
||||
PR middle-end/7651
|
||||
* c.opt (Wmissing-parameter-type): New.
|
||||
* doc/invoke.texi (Wmissing-parameter-type): Document it.
|
||||
(Wextra): Enabled by -Wextra.
|
||||
* c-opts.c (c_common_post_options): Enabled by -Wextra.
|
||||
* c-decl.c (store_parm_decls_oldstyle): Replace Wextra with
|
||||
Wmissing-parameter-type.
|
||||
|
||||
2006-12-23 Eric Botcazou <ebotcazou@adacore.com>
|
||||
|
||||
* dwarf2out.c (dbx_reg_number): Do leaf register remapping
|
||||
|
|
|
@ -6414,8 +6414,8 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info)
|
|||
|
||||
if (flag_isoc99)
|
||||
pedwarn ("type of %q+D defaults to %<int%>", decl);
|
||||
else if (extra_warnings)
|
||||
warning (OPT_Wextra, "type of %q+D defaults to %<int%>", decl);
|
||||
else
|
||||
warning (OPT_Wmissing_parameter_type, "type of %q+D defaults to %<int%>", decl);
|
||||
}
|
||||
|
||||
TREE_PURPOSE (parm) = decl;
|
||||
|
|
|
@ -1026,7 +1026,7 @@ c_common_post_options (const char **pfilename)
|
|||
flag_exceptions = 1;
|
||||
|
||||
/* -Wextra implies -Wclobbered, -Wempty-body, -Wsign-compare,
|
||||
-Wmissing-field-initializers and -Woverride-init,
|
||||
-Wmissing-field-initializers, -Wmissing-parameter-type and -Woverride-init,
|
||||
but not if explicitly overridden. */
|
||||
if (warn_clobbered == -1)
|
||||
warn_clobbered = extra_warnings;
|
||||
|
@ -1036,6 +1036,8 @@ c_common_post_options (const char **pfilename)
|
|||
warn_sign_compare = extra_warnings;
|
||||
if (warn_missing_field_initializers == -1)
|
||||
warn_missing_field_initializers = extra_warnings;
|
||||
if (warn_missing_parameter_type == -1)
|
||||
warn_missing_parameter_type = extra_warnings;
|
||||
if (warn_override_init == -1)
|
||||
warn_override_init = extra_warnings;
|
||||
|
||||
|
|
|
@ -283,6 +283,10 @@ Wmissing-include-dirs
|
|||
C ObjC C++ ObjC++
|
||||
Warn about user-specified include directories that do not exist
|
||||
|
||||
Wmissing-parameter-type
|
||||
C ObjC Var(warn_missing_parameter_type) Init(-1)
|
||||
Warn about function parameters declared without a type specifier in K&R-style functions
|
||||
|
||||
Wmissing-prototypes
|
||||
C ObjC Var(warn_missing_prototypes)
|
||||
Warn about global functions without prototypes
|
||||
|
|
|
@ -256,7 +256,8 @@ Objective-C and Objective-C++ Dialects}.
|
|||
|
||||
@item C-only Warning Options
|
||||
@gccoptlist{-Wbad-function-cast -Wmissing-declarations @gol
|
||||
-Wmissing-prototypes -Wnested-externs -Wold-style-definition @gol
|
||||
-Wmissing-parameter-type -Wmissing-prototypes @gol
|
||||
-Wnested-externs -Wold-style-definition @gol
|
||||
-Wstrict-prototypes -Wtraditional -Wtraditional-conversion @gol
|
||||
-Wdeclaration-after-statement -Wpointer-sign}
|
||||
|
||||
|
@ -2908,13 +2909,10 @@ designated initializers (@pxref{Designated Inits, , Designated
|
|||
Initializers}). This warning can be independently controlled by
|
||||
@option{-Woverride-init}.
|
||||
|
||||
@item
|
||||
@item @r{(C only)}
|
||||
A function parameter is declared without a type specifier in K&R-style
|
||||
functions:
|
||||
|
||||
@smallexample
|
||||
void foo(bar) @{ @}
|
||||
@end smallexample
|
||||
functions. This warning can be independently controlled by
|
||||
@option{-Wmissing-parameter-type}.
|
||||
|
||||
@item
|
||||
An empty body occurs in an @samp{if} or @samp{else} statement. This
|
||||
|
@ -3221,6 +3219,17 @@ types.)
|
|||
Warn if an old-style function definition is used. A warning is given
|
||||
even if there is a previous prototype.
|
||||
|
||||
@item -Wmissing-parameter-type @r{(C only)}
|
||||
@opindex Wmissing-parameter-type
|
||||
A function parameter is declared without a type specifier in K&R-style
|
||||
functions:
|
||||
|
||||
@smallexample
|
||||
void foo(bar) @{ @}
|
||||
@end smallexample
|
||||
|
||||
This warning is also enabled by @option{-Wextra}.
|
||||
|
||||
@item -Wmissing-prototypes @r{(C only)}
|
||||
@opindex Wmissing-prototypes
|
||||
Warn if a global function is defined without a previous prototype
|
||||
|
|
|
@ -1,3 +1,10 @@
|
|||
2006-12-23 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
|
||||
|
||||
PR middle-end/7651
|
||||
* gcc.dg/Wmissing-parameter-type.c: New.
|
||||
* gcc.dg/Wmissing-parameter-type-Wextra.c: New.
|
||||
* gcc.dg/Wmissing-parameter-type-no.c: New.
|
||||
|
||||
2006-12-22 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
PR fortran/25818
|
||||
|
|
7
gcc/testsuite/gcc.dg/Wmissing-parameter-type-Wextra.c
Normal file
7
gcc/testsuite/gcc.dg/Wmissing-parameter-type-Wextra.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
/* Test -Wmissing-parameter-type is enabled by -Wextra */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-Wextra" } */
|
||||
|
||||
int foo(bar) { return bar;} /* { dg-warning "type of 'bar' defaults to 'int'" } */
|
||||
|
||||
|
7
gcc/testsuite/gcc.dg/Wmissing-parameter-type-no.c
Normal file
7
gcc/testsuite/gcc.dg/Wmissing-parameter-type-no.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
/* Test that we can disable -Wmissing-parameter-type */
|
||||
/* { dg-do compile } */
|
||||
/* { dg-options "-Wall -Wextra -Wno-missing-parameter-type" } */
|
||||
|
||||
int foo(bar) { return bar;} /* { dg-bogus "type of 'bar' defaults to 'int'" } */
|
||||
|
||||
|
6
gcc/testsuite/gcc.dg/Wmissing-parameter-type.c
Normal file
6
gcc/testsuite/gcc.dg/Wmissing-parameter-type.c
Normal file
|
@ -0,0 +1,6 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-Wmissing-parameter-type" } */
|
||||
|
||||
int foo(bar) { return bar; } /* { dg-warning "type of 'bar' defaults to 'int'" } */
|
||||
|
||||
|
Loading…
Add table
Reference in a new issue