After discovering that in system header files (and only there) some warnings 
such as a macro redefinition do not show up, I found the following deep in the 
GCC documentation at gcc.gnu.org:

>>>>>>>>>>>
The header files declaring interfaces to the operating system and runtime 
libraries often cannot be written in strictly conforming C. Therefore, GCC 
gives code found in system headers special treatment. All warnings, 
other than those generated by `#warning' (see Diagnostics), are suppressed 
while GCC is processing a system header. Macros defined in a system header are 
immune to a few warnings wherever they are expanded. 
This immunity is granted on an ad-hoc basis, when we find that a warning 
generates lots of false positives because of code in macros defined in system 
headers. 
<<<<<<<<<<<

So it is intentional that all warnings are suppressed in a system header file, 
however severe the consequences might be.

While this is not a problem for a plain compiler user (who has to trust the 
creators of the system header files), it could cause havoc on a living and 
evolving development like the MSPGCC itself.

GCC does not have any way to disable this (while you can force it by using the 
system_header pragma).

So if you are working on the system header files, you should add the system 
include directory as a normal directory using the -I option in the makefile. 
This way, the system header files are searched there as normal 
files and the warning suppression does not apply (unless the system_header 
pragma is used in the files).

JMGross


----- Ursprüngliche Nachricht -----
Von: JMGross
An: MSPGCC mailing list,
Gesendet am: 25 Jan 2010 13:27:22
Betreff: Re: [Mspgcc-users] Possible preprocessor bug


Reply via email to