http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61106
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2014-05-08 CC| |manu at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- I think this is a bug and, I'm sorry to say, very likely introduced by my patches encoding options relationships in the *.opt files. For -Wunused-parameter, we generate this code: if (!opts_set->x_warn_unused_parameter && (opts->x_warn_unused && opts->x_extra_warnings)) handle_generated_option (opts, opts_set, OPT_Wunused_parameter, NULL, value, lang_mask, kind, loc, handlers, dc); which enables it only if it wasn't set already and if both -Wunused && -Wextra are given. This is what happens after handling "-Wall -Wextra", so -Wunused-parameter is in effect. However, when handling a subsequent -Wno-unused, then opts->x_warn_unused becomes false before reaching here, so the -Wno-unused-parameter is never generated. I think this patch should do the trick: Index: optc-gen.awk =================================================================== --- optc-gen.awk (revision 209347) +++ optc-gen.awk (working copy) @@ -404,15 +404,17 @@ for (i = 0; i < n_enabledby; i++) { for (j = 1; j < n_enables; j++) { opt_var_name = var_name(flags[opt_numbers[thisenable[j]]]); if (opt_var_name != "") { condition = "!opts_set->x_" opt_var_name if (thisenableif[j] != "") { - condition = condition " && (" thisenableif[j] ")" + value = "value" + } else { + value = "(" thisenableif[j] ")" } 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" } } but I haven't tested it. On the other hand, a behavior that may have changed is that: "-Wall -Wextra -Wno-unused -Wall" should not generate the warning. I'm not sure this was the case before GCC 4.8, but this is the desired behavior (options can only affect other options when the latter are not set explicitly, that is, -Wno-unused -Wall does not re-enable -Wunused. We should write these in the manual.)