https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89524

            Bug ID: 89524
           Summary: -Wno-error doesn't work with warnings from newer
                    versions of GCC
           Product: gcc
           Version: 4.8.5
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alexhenrie24 at gmail dot com
  Target Milestone: ---

I am working on a Qt4 program that we need to compile with both GCC 4.8.5 and
GCC 8.2.0. The build process sets the -Werror option, but the Qt4 header files
trigger the new class-memaccess warning. I'd like to use
-Wno-error=class-memaccess to permit compilation and still see where we've made
this mistake in our own code, but on GCC 4.8.5 that option causes the following
error:

cc1plus: error: -Werror=class-memaccess: no option -Wclass-memaccess

So I am forced to disable the new warning altogether with -Wno-class-memaccess,
which both GCC 4.8.5 and GCC 8.2.0 accept.

You can reproduce the error on GCC 8.2.0 with any arbitrary C file, for
example:

$ gcc -Werror -Wno-error=foobar test.c
cc1: error: -Werror=foobar: no option -Wfoobar

Can we please avoid this problem in the future by ignoring
-Wno-error=<unknown-warning>?

Reply via email to