This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/57622] New: -W -Wall -Werror -Wno-unused gives Wunused-parameter warning


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57622

            Bug ID: 57622
           Summary: -W -Wall -Werror -Wno-unused gives Wunused-parameter
                    warning
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: manu at gcc dot gnu.org
                CC: burnus at gcc dot gnu.org, manu at gcc dot gnu.org,
                    Simon.Richter at hogyros dot de
        Depends on: 52347

+++ This bug was initially created as a clone of Bug #52347 +++

Testcase is simple:

$ cat tt.cpp

void bar(int baz) { }

$ g++-4.7 -c -W -Wall -Werror -Wno-unused tt.cpp 

$ g++-4.8 -c -W -Wall -Werror -Wno-unused tt.cpp 
tt.cpp:1:6: error: unused parameter âbazâ [-Werror=unused-parameter]
 void bar(int baz) { }
      ^
cc1plus: all warnings being treated as errors

There is a bug in the logic of the autogenerated 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);

When processing -Wno-unused, opts->x_warn_unused is false, so we don't turn off
OPT_Wunused_parameter. I think the generated code should be:


      if (!opts_set->x_warn_unused_parameter && opts->x_extra_warnings)

for case OPT_Wunused and


      if (!opts_set->x_warn_unused_parameter && opts->x_warn_unused)

for the case OPT_Wextra. So optc-gen.awk needs adjusting. Let me see if I can
find time to do this in the coming weeks/months, but if anyone wants to
investigate how to fix it, please go ahead.

I think this is a different bug than the -Wno-tabs, since that is not handled
by the autogenerated code.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]