Bug 32368

Summary: warnings from system headers not suppressed.
Product: gcc Reporter: Pawel Sikora <pawel_sikora>
Component: c++Assignee: Tom Tromey <tromey>
Status: RESOLVED FIXED    
Severity: normal CC: bluedzins, fang, gcc-bugs
Priority: P3 Keywords: diagnostic
Version: 4.1.3   
Target Milestone: 4.3.0   
Host: Target:
Build: Known to work: 4.3.0
Known to fail: Last reconfirmed: 2007-11-02 21:02:56
Attachments: testcase

Description Pawel Sikora 2007-06-16 17:20:35 UTC
$ g++ -isystem sys x.cpp -c -Wall -O
sys/x.hpp: In function 'int main()':
sys/x.hpp:7: warning: 'i' is used uninitialized in this function
sys/x.hpp:6: note: 'i' was declared here

i ran into this during playing with new boost libraries.
Comment 1 Pawel Sikora 2007-06-16 17:20:56 UTC
Created attachment 13714 [details]
testcase
Comment 2 Paolo Carlini 2007-06-16 19:19:41 UTC
At variance with c++/32256, this one apparently happens as "C" code too... Probably should be not categorized as C++-only...
Comment 3 Pawel Sikora 2007-06-19 06:44:17 UTC
(In reply to comment #2)
> At variance with c++/32256, this one apparently happens as "C" code too...
> Probably should be not categorized as C++-only...

these little bugs (PR32368, PR32256) are treated as blockers
by people having `-Wall -Werror` in theirs projects.
could we fix this issue easily and quickly in 4.x?
Comment 4 Tom Tromey 2007-11-02 21:02:44 UTC
Testing a patch.

Comment 5 Tom Tromey 2007-11-06 15:57:18 UTC
Subject: Bug 32368

Author: tromey
Date: Tue Nov  6 15:57:02 2007
New Revision: 129936

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=129936
Log:
gcc
	PR c++/32256, PR c++/32368:
	* function.c (saved_in_system_header): New global.
	(push_cfun): Save in_system_header.
	(pop_cfun): Restore in_system_header.
	(push_struct_function): Save in_system_header.
gcc/testsuite
	PR c++/32368:
	* g++.dg/warn/pragma-system_header3.h: New.
	* g++.dg/warn/pragma-system_header3.C: New.

	PR c++/32256:
	* g++.dg/warn/pragma-system_header4.C: New.
	* g++.dg/warn/pragma-system_header4.h: New.

Added:
    trunk/gcc/testsuite/g++.dg/warn/pragma-system_header3.C
    trunk/gcc/testsuite/g++.dg/warn/pragma-system_header3.h
    trunk/gcc/testsuite/g++.dg/warn/pragma-system_header4.C
    trunk/gcc/testsuite/g++.dg/warn/pragma-system_header4.h
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/function.c
    trunk/gcc/testsuite/ChangeLog

Comment 6 Tom Tromey 2007-11-06 16:01:55 UTC
Fixed on trunk.
Comment 7 Richard Biener 2008-03-14 16:51:47 UTC
We have one regression open for this.  Let's close this as fixed.