OSDN Git Service

2008-08-08 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
authormanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 8 Aug 2008 23:15:31 +0000 (23:15 +0000)
committermanu <manu@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 8 Aug 2008 23:15:31 +0000 (23:15 +0000)
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

13 files changed:
gcc/ChangeLog
gcc/c-opts.c
gcc/common.opt
gcc/flags.h
gcc/fortran/ChangeLog
gcc/fortran/options.c
gcc/java/ChangeLog
gcc/java/lang.c
gcc/opts.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/unused-6-WallWextra.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/unused-6-no.c [new file with mode: 0644]
gcc/toplev.c

index ed2707a..569efd1 100644 (file)
@@ -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
index 8b31b88..83e2ed1 100644 (file)
@@ -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;
index 02bdef2..9b1972b 100644 (file)
@@ -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
index e797d95..ceff962 100644 (file)
@@ -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.  
index 9b51d99..6e37b80 100644 (file)
@@ -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
index 7b7916d..4ecb8f9 100644 (file)
@@ -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;
 
index b2321e3..ba39be4 100644 (file)
@@ -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
index 2738376..d049aeb 100644 (file)
@@ -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_:
index 5451251..8dd8b82 100644 (file)
@@ -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).
index 22bd5e5..db2088f 100644 (file)
@@ -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 (file)
index 0000000..d2d80be
--- /dev/null
@@ -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 (file)
index 0000000..0923cfb
--- /dev/null
@@ -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);
+}
index d717eba..bb49a97 100644 (file)
@@ -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)