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

            Bug ID: 80650
           Summary: #pragma do not control -Wcpp
           Product: gcc
           Version: 7.0.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: akim.demaille at gmail dot com
  Target Milestone: ---

Hi!

When compiling C, -Wcpp can be controlled by the diagnostics pragmas, but not
in C++ mode.

$ cat bar.c
#pragma GCC diagnostic ignored "-Wcpp"
#warning Foo

int i;
$ gcc-mp-7 -c bar.c
$ cp bar.c bar.cc
$ g++-mp-7 -c bar.c
bar.c:2:2: warning: #warning Foo [-Wcpp]
 #warning Foo
  ^~~~~~~

$ g++-mp-7 --version
g++-mp-7 (MacPorts gcc7 7-20170420_0) 7.0.1 20170420 (prerelease)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

I have observed this with 4.9, 5.5, 6.2 and 7.0.

Cheers!

Reply via email to