This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/61600] New: #pragma GCC diagnostic pop leaves warnings enabled
- 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: Tue, 24 Jun 2014 18:43:31 +0000
- Subject: [Bug c++/61600] New: #pragma GCC diagnostic pop leaves warnings enabled
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61600
Bug ID: 61600
Summary: #pragma GCC diagnostic pop leaves warnings enabled
Product: gcc
Version: 4.8.2
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
#pragma GCC diagnostic push
#pragma GCC diagnostic warning "-Wunused-parameter"
void foo(int i) { }
#pragma GCC diagnostic pop
void bar(int i) { }
int main()
{
bar(1);
}
I expect a warning for foo() but not bar(), however compiling with no options I
get:
sys.cc:3:6: warning: unused parameter âiâ [-Wunused-parameter]
void foo(int i) { }
^
sys.cc:7:6: warning: unused parameter âiâ [-Wunused-parameter]
void bar(int i) { }
^
It appears that once I turn a warning on I can't disable it.
Have I misunderstood the feature?