diff mbox

fix impliedness of -Wunused-parameter depending on -Wexta option ordering

Message ID 536BF4F1.8020402@ubuntu.com
State New
Headers show

Commit Message

Matthias Klose May 8, 2014, 9:19 p.m. UTC
This fixes a regression introduced with 4.8, where the option ordering of
-Wextra and -Wunused-parameter emits a warning, which is not emitted with 4.7.
No regressions with the trunk, the 4.9 and 4.8 branches. Ok to check in for these?

  Matthias

2014-05-08  Manuel L<C3><B3>pez-Ib<C3><A1><C3><B1>ez  <manu@gcc.gnu.org>
            Matthias Klose  <doko@ubuntu.com>

        PR driver/61106
        * optc-gen.awk: Fix option handling for -Wunused-parameter.

gcc/testsuite/

2014-05-08  Matthias Klose  <doko@ubuntu.com>

        PR driver/61106
        * gcc-dg/unused-8a.c: New.
        * gcc-dg/unused-8b.c: Likewise.
gcc/

2014-05-08  Manuel López-Ibáñez  <manu@gcc.gnu.org>
	    Matthias Klose  <doko@ubuntu.com>

	PR driver/61106
	* optc-gen.awk: Fix option handling for -Wunused-parameter.

gcc/testsuite/

2014-05-08  Matthias Klose  <doko@ubuntu.com>

	PR driver/61106
	* gcc-dg/unused-8a.c: New.
	* gcc-dg/unused-8b.c: Likewise.

Comments

Joseph Myers May 8, 2014, 9:36 p.m. UTC | #1
On Thu, 8 May 2014, Matthias Klose wrote:

> This fixes a regression introduced with 4.8, where the option ordering 
> of -Wextra and -Wunused-parameter emits a warning, which is not emitted 
> with 4.7. No regressions with the trunk, the 4.9 and 4.8 branches. Ok to 
> check in for these?

OK.
diff mbox

Patch

Index: gcc/optc-gen.awk
===================================================================
--- gcc/optc-gen.awk	(revision 210245)
+++ gcc/optc-gen.awk	(working copy)
@@ -406,11 +406,13 @@ 
         if (opt_var_name != "") {
             condition = "!opts_set->x_" opt_var_name
             if (thisenableif[j] != "") {
-                condition = condition " && (" thisenableif[j] ")"
+                value = "(" thisenableif[j] ")"
+            } else {
+                value = "value"
             }
             print "      if (" condition ")"
             print "        handle_generated_option (opts, opts_set,"
-            print "                                 " opt_enum(thisenable[j]) ", NULL, value,"
+            print "                                 " opt_enum(thisenable[j]) ", NULL, " value ","
             print "                                 lang_mask, kind, loc, handlers, dc);"
         } else {
             print "#error " thisenable[j] " does not have a Var() flag"
Index: gcc/testsuite/gcc.dg/unused-8a.c
===================================================================
--- gcc/testsuite/gcc.dg/unused-8a.c	(revision 0)
+++ gcc/testsuite/gcc.dg/unused-8a.c	(working copy)
@@ -0,0 +1,4 @@ 
+/* { dg-do compile } */
+/* { dg-options "-Wall -Wextra -Wno-unused" } */
+
+void foo(int x) { }
Index: gcc/testsuite/gcc.dg/unused-8b.c
===================================================================
--- gcc/testsuite/gcc.dg/unused-8b.c	(revision 0)
+++ gcc/testsuite/gcc.dg/unused-8b.c	(working copy)
@@ -0,0 +1,4 @@ 
+/* { dg-do compile } */
+/* { dg-options "-Wall -Wno-unused -Wextra" } */
+
+void foo(int x) { }