This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/80472] New: cannot use push/pop with #pragma GCC diagnostic warning "-Wsystem-headers"
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 20 Apr 2017 12:15:56 +0000
- Subject: [Bug c++/80472] New: cannot use push/pop with #pragma GCC diagnostic warning "-Wsystem-headers"
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80472
Bug ID: 80472
Summary: cannot use push/pop with #pragma GCC diagnostic
warning "-Wsystem-headers"
Product: gcc
Version: 6.3.1
Status: UNCONFIRMED
Keywords: diagnostic
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: redi at gcc dot gnu.org
Blocks: 58876, 69769, 70692
Target Milestone: ---
Given the following header:
#pragma GCC system_header
#pragma GCC diagnostic push
#pragma GCC diagnostic warning "-Wsystem-headers"
// want warnings here despite being in a system header
#pragma GCC diagnostic pop
// But don't want warnings here
int missing_return() { }
A file including it will warn with -Wreturn-type (or -Wall):
In file included from dep.cc:1:0:
dep.h: In function ‘int missing_return()’:
dep.h:8:24: warning: no return statement in function returning non-void
[-Wreturn-type]
int missing_return() { }
^
The warning should be disabled again by the "pop", but -Wsystem-headers stays
active once enabled.
This makes it very difficult for libstdc++ to selectively enable important
warnings, e.g. Bug 58876
Referenced Bugs:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58876
[Bug 58876] No non-virtual-dtor warning in std::unique_ptr
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69769
[Bug 69769] arithmetic operation on pointer to a function
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70692
[Bug 70692] No warning when std::function<const int&(...)> binds a reference to
a temporary