[Bug c++/61600] New: #pragma GCC diagnostic pop leaves warnings enabled
redi at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jun 24 18:43:00 GMT 2014
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?
More information about the Gcc-bugs
mailing list