Enable -Wunused-local-typedefs when -Wall or -Wunused is on
authorDodji Seketeli <dodji@redhat.com>
Fri, 4 May 2012 16:38:27 +0000 (16:38 +0000)
committerDodji Seketeli <dodji@gcc.gnu.org>
Fri, 4 May 2012 16:38:27 +0000 (18:38 +0200)
Now that the libstdc++ testsuite is run with -ftrack-macro-location by
default, this patch triggers the -Wunused-local-typedefs warning when
-Wunused (and -Wall) is turned on.

The patch has been reviewed and accepted[1] a while ago, but was waiting
for the -ftrack-macro-expansion work to go in first.

Bootstrapped and tested again on x86_64-unknown-linux-gnu against
trunk.

Applied to the mainline.

[1]: http://gcc.gnu.org/ml/gcc-patches/2011-09/msg00605.html

gcc/

* opts.c (finish_options): Activate -Wunused-local-typedefs if
-Wunused is activated.
* doc/invoke.texi: Update blurb of -Wunused-local-typedefs.

From-SVN: r187167

gcc/ChangeLog
gcc/doc/invoke.texi
gcc/opts.c

index 2e3fa0c05f512e91c6e6d698a7b9c005cf39c03b..d372a4f13898bb5954ddf2bd040c5359559e2b97 100644 (file)
@@ -1,3 +1,10 @@
+2012-05-04  Dodji Seketeli  <dodji@redhat.com>
+
+       Enable -Wunused-local-typedefs when -Wall or -Wunused is on
+       * opts.c (finish_options): Activate -Wunused-local-typedefs if
+       -Wunused is activated.
+       * doc/invoke.texi: Update blurb of -Wunused-local-typedefs.
+
 2012-05-04  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
 
        * config/s390/s390.md (*movmem_short, *clrmem_short)
index 5550c71fd21410579e6c75ff9f4feccd7d15854c..86698fcaf9982000482e5b567071c027b49e5c49 100644 (file)
@@ -3622,6 +3622,7 @@ To suppress this warning use the @samp{unused} attribute
 @item -Wunused-local-typedefs @r{(C, Objective-C, C++ and Objective-C++ only)}
 @opindex Wunused-local-typedefs
 Warn when a typedef locally defined in a function is not used.
+This warning is enabled by @option{-Wall}.
 
 @item -Wunused-parameter
 @opindex Wunused-parameter
index 22c7590f1bdddfdb5a3dfa2e021800ddfe27a77e..b6c786f950e28c0922d828cdb5b2ae8bafe7e390 100644 (file)
@@ -835,6 +835,10 @@ finish_options (struct gcc_options *opts, struct gcc_options *opts_set,
   if (opts->x_warn_unused_value == -1)
     opts->x_warn_unused_value = opts->x_warn_unused;
 
+  /* Wunused-local-typedefs is enabled by -Wunused or -Wall.  */
+  if (opts->x_warn_unused_local_typedefs == -1)
+    opts->x_warn_unused_local_typedefs = opts->x_warn_unused;
+
   /* This replaces set_Wextra.  */
   if (opts->x_warn_uninitialized == -1)
     opts->x_warn_uninitialized = opts->x_extra_warnings;