diff options
author | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-08 23:15:31 +0000 |
---|---|---|
committer | manu <manu@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-08-08 23:15:31 +0000 |
commit | 278e3a1f0b535449bd0f3081e8c8e072b2b4b242 (patch) | |
tree | 78d365c089bbd5db307fb058a73ce73b455dad1f | |
parent | 4d41da0b1e44e341b3ffae7f3e995d4940a3f86b (diff) | |
download | gcc-278e3a1f0b535449bd0f3081e8c8e072b2b4b242.tar.gz |
2008-08-08 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR 28875
* flags.h (set_Wunused): Delete
* toplev.c (process_options): Handle Wunused flags here.
* opts.c (maybe_warn_unused_parameter): Delete.
(common_handle_option): Replace set_Wunused by warn_unused.
(set_Wextra): Do not handle Wunused-parameter here.
(set_Wunused): Delete.
* c-opts.c (c_common_handle_option): Replace set_Wunused by
warn_unused.
* common.opt (Wunused): Add Var and Init.
(Wunused-function): Likewise.
(Wunused-label): Likewise.
(Wunused-parameter): Likewise.
(Wunused-value): Likewise.
(Wunused-variable): Likewise.
fortran/
* options.c (set_Wall): Replace set_Wunused by warn_unused.
java/
* lang.c (java_handle_option): Replace set_Wunused with
warn_unused.
testsuite/
* gcc.dg/unused-6-no.c: New.
* gcc.dg/unused-6-WallWextra.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@138890 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 42 | ||||
-rw-r--r-- | gcc/c-opts.c | 2 | ||||
-rw-r--r-- | gcc/common.opt | 12 | ||||
-rw-r--r-- | gcc/flags.h | 6 | ||||
-rw-r--r-- | gcc/fortran/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/fortran/options.c | 2 | ||||
-rw-r--r-- | gcc/java/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/java/lang.c | 2 | ||||
-rw-r--r-- | gcc/opts.c | 23 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/unused-6-WallWextra.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/unused-6-no.c | 11 | ||||
-rw-r--r-- | gcc/toplev.c | 13 |
13 files changed, 92 insertions, 49 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ed2707a7923..569efd1f5b3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,17 +1,35 @@ +2008-08-08 Manuel Lopez-Ibanez <manu@gcc.gnu.org> + + PR 28875 + * flags.h (set_Wunused): Delete + * toplev.c (process_options): Handle Wunused flags here. + * opts.c (maybe_warn_unused_parameter): Delete. + (common_handle_option): Replace set_Wunused by warn_unused. + (set_Wextra): Do not handle Wunused-parameter here. + (set_Wunused): Delete. + * c-opts.c (c_common_handle_option): Replace set_Wunused by + warn_unused. + * common.opt (Wunused): Add Var and Init. + (Wunused-function): Likewise. + (Wunused-label): Likewise. + (Wunused-parameter): Likewise. + (Wunused-value): Likewise. + (Wunused-variable): Likewise. + 2008-08-08 Peter Bergner <bergner@vnet.ibm.com> - * doc/invoke.texi: Add cpu_type power7. - * config.in (HAVE_AS_VSX): New. - * config.gcc: Add cpu_type power7. - * configure.ac (HAVE_AS_VSX): Check for assembler support of the - VSX instructions. - * configure: Regenerate. - * config/rs6000/rs6000.c (rs6000_override_options): Alias power7 to - power5. - * config/rs6000/rs6000.h (ASM_CPU_POWER7_SPEC): Define. - (ASM_CPU_SPEC): Pass %(asm_cpu_power7) for -mcpu=power7. - (EXTRA_SPECS): Add asm_cpu_power7 spec string. - + * doc/invoke.texi: Add cpu_type power7. + * config.in (HAVE_AS_VSX): New. + * config.gcc: Add cpu_type power7. + * configure.ac (HAVE_AS_VSX): Check for assembler support of the + VSX instructions. + * configure: Regenerate. + * config/rs6000/rs6000.c (rs6000_override_options): Alias power7 to + power5. + * config/rs6000/rs6000.h (ASM_CPU_POWER7_SPEC): Define. + (ASM_CPU_SPEC): Pass %(asm_cpu_power7) for -mcpu=power7. + (EXTRA_SPECS): Add asm_cpu_power7 spec string. + 2008-08-08 Dorit Nuzman <dorit@il.ibm.com> * tree-vect-transform.c (vectorizable_conversion): Pass the integral diff --git a/gcc/c-opts.c b/gcc/c-opts.c index 8b31b8879e7..83e2ed14c4e 100644 --- a/gcc/c-opts.c +++ b/gcc/c-opts.c @@ -376,7 +376,7 @@ c_common_handle_option (size_t scode, const char *arg, int value) break; case OPT_Wall: - set_Wunused (value); + warn_unused = value; set_Wformat (value); set_Wimplicit (value); warn_char_subscripts = value; diff --git a/gcc/common.opt b/gcc/common.opt index 02bdef25588..9b1972b8c4a 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -210,27 +210,27 @@ Common Var(warn_notreached) Warning Warn about code that will never be executed Wunused -Common Warning +Common Var(warn_unused) Init(0) Warning Enable all -Wunused- warnings Wunused-function -Common Var(warn_unused_function) Warning +Common Var(warn_unused_function) Init(-1) Warning Warn when a function is unused Wunused-label -Common Var(warn_unused_label) Warning +Common Var(warn_unused_label) Init(-1) Warning Warn when a label is unused Wunused-parameter -Common Var(warn_unused_parameter) Warning +Common Var(warn_unused_parameter) Init(-1) Warning Warn when a function parameter is unused Wunused-value -Common Var(warn_unused_value) Warning +Common Var(warn_unused_value) Init(-1) Warning Warn when an expression value is unused Wunused-variable -Common Var(warn_unused_variable) Warning +Common Var(warn_unused_variable) Init(-1) Warning Warn when a variable is unused Wcoverage-mismatch diff --git a/gcc/flags.h b/gcc/flags.h index e797d95c885..ceff962d98a 100644 --- a/gcc/flags.h +++ b/gcc/flags.h @@ -115,12 +115,6 @@ extern int optimize_size; extern bool extra_warnings; -/* Nonzero to warn about unused variables, functions et.al. Use - set_Wunused() to update the -Wunused-* flags that correspond to the - -Wunused option. */ - -extern void set_Wunused (int setting); - /* Used to set the level of -Wstrict-aliasing, when no level is specified. The external way to set the default level is to use -Wstrict-aliasing=level. diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 9b51d994826..6e37b804d8e 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2008-08-08 Manuel Lopez-Ibanez <manu@gcc.gnu.org> + + PR 28875 + * options.c (set_Wall): Replace set_Wunused by warn_unused. + 2008-08-08 Daniel Kraft <d@domob.eu> * gfortran.h (gfc_finalizer): Replaced member `procedure' by two diff --git a/gcc/fortran/options.c b/gcc/fortran/options.c index 7b7916d4603..4ecb8f998e3 100644 --- a/gcc/fortran/options.c +++ b/gcc/fortran/options.c @@ -376,7 +376,7 @@ set_Wall (int setting) gfc_option.warn_intrinsics_std = setting; gfc_option.warn_character_truncation = setting; - set_Wunused (setting); + warn_unused = setting; warn_return_type = setting; warn_switch = setting; diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index b2321e374f8..ba39be42971 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,9 @@ +2008-08-08 Manuel Lopez-Ibanez <manu@gcc.gnu.org> + + PR 28875 + * lang.c (java_handle_option): Replace set_Wunused with + warn_unused. + 2008-07-30 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> * gcj.texi: Update copyright years. Do not list GPL as diff --git a/gcc/java/lang.c b/gcc/java/lang.c index 27383762add..d049aeb2bc1 100644 --- a/gcc/java/lang.c +++ b/gcc/java/lang.c @@ -221,7 +221,7 @@ java_handle_option (size_t scode, const char *arg, int value) flag_wall = value; /* When -Wall given, enable -Wunused. We do this because the C compiler does it, and people expect it. */ - set_Wunused (value); + warn_unused = value; break; case OPT_fenable_assertions_: diff --git a/gcc/opts.c b/gcc/opts.c index 54512513f42..8dd8b8265fd 100644 --- a/gcc/opts.c +++ b/gcc/opts.c @@ -63,9 +63,6 @@ HOST_WIDE_INT larger_than_size; bool warn_frame_larger_than; HOST_WIDE_INT frame_larger_than_size; -/* Hack for cooperation between set_Wunused and set_Wextra. */ -static bool maybe_warn_unused_parameter; - /* Type(s) of debugging information we are producing (if any). See flags.h for the definitions of the different possible types of debugging information. */ @@ -1667,7 +1664,7 @@ common_handle_option (size_t scode, const char *arg, int value, break; case OPT_Wunused: - set_Wunused (value); + warn_unused = value; break; case OPT_aux_info: @@ -2037,7 +2034,6 @@ static void set_Wextra (int setting) { extra_warnings = setting; - warn_unused_parameter = (setting && maybe_warn_unused_parameter); /* We save the value of warn_uninitialized, since if they put -Wuninitialized on the command line, we need to generate a @@ -2048,23 +2044,6 @@ set_Wextra (int setting) warn_uninitialized = 2; } -/* Initialize unused warning flags. */ -void -set_Wunused (int setting) -{ - warn_unused_function = setting; - warn_unused_label = setting; - /* Unused function parameter warnings are reported when either - ``-Wextra -Wunused'' or ``-Wunused-parameter'' is specified. - Thus, if -Wextra has already been seen, set warn_unused_parameter; - otherwise set maybe_warn_extra_parameter, which will be picked up - by set_Wextra. */ - maybe_warn_unused_parameter = setting; - warn_unused_parameter = (setting && extra_warnings); - warn_unused_variable = setting; - warn_unused_value = setting; -} - /* Used to set the level of strict aliasing warnings, when no level is specified (i.e., when -Wstrict-aliasing, and not -Wstrict-aliasing=level was given). diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 22bd5e5e4d4..db2088fac1a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2008-08-08 Manuel Lopez-Ibanez <manu@gcc.gnu.org> + + PR 28875 + * gcc.dg/unused-6-no.c: New. + * gcc.dg/unused-6-WallWextra.c: New. + 2008-08-08 Volker Reichelt <v.reichelt@netcologne.de> PR c++/35985 diff --git a/gcc/testsuite/gcc.dg/unused-6-WallWextra.c b/gcc/testsuite/gcc.dg/unused-6-WallWextra.c new file mode 100644 index 00000000000..d2d80be062a --- /dev/null +++ b/gcc/testsuite/gcc.dg/unused-6-WallWextra.c @@ -0,0 +1,11 @@ +/* PR 28875 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -Wextra -Wall" } */ +static int t(int i) /* { dg-warning "unused parameter" "unused parameter warning" } */ +{ + return 0; +} +int tt() +{ + return t(0); +} diff --git a/gcc/testsuite/gcc.dg/unused-6-no.c b/gcc/testsuite/gcc.dg/unused-6-no.c new file mode 100644 index 00000000000..0923cfb8132 --- /dev/null +++ b/gcc/testsuite/gcc.dg/unused-6-no.c @@ -0,0 +1,11 @@ +/* PR 28875 */ +/* { dg-do compile } */ +/* { dg-options "-O3 -Wextra -Wno-unused-parameter -Wall" } */ +static int t(int i) /* { dg-bogus "unused parameter" "unused parameter warning" } */ +{ + return 0; +} +int tt() +{ + return t(0); +} diff --git a/gcc/toplev.c b/gcc/toplev.c index d717ebace2a..bb49a970b49 100644 --- a/gcc/toplev.c +++ b/gcc/toplev.c @@ -1644,6 +1644,19 @@ process_options (void) This can happen with incorrect pre-processed input. */ debug_hooks = &do_nothing_debug_hooks; + /* This replaces set_Wunused. */ + if (warn_unused_function == -1) + warn_unused_function = warn_unused; + if (warn_unused_label == -1) + warn_unused_label = warn_unused; + /* Wunused-parameter is enabled if both -Wunused -Wextra are enabled. */ + if (warn_unused_parameter == -1) + warn_unused_parameter = (warn_unused && extra_warnings); + if (warn_unused_variable == -1) + warn_unused_variable = warn_unused; + if (warn_unused_value == -1) + warn_unused_value = warn_unused; + /* Allow the front end to perform consistency checks and do further initialization based on the command line options. This hook also sets the original filename if appropriate (e.g. foo.i -> foo.c) |