Selectiv on/off-turning of warnings

Enrico Scholz Enrico.Scholz@informatik.tu-chemnitz.de
Wed Mar 22 15:13:00 GMT 2000


Does there exists a possibility to turn off some warnings in certain
parts of the code?

E.g. stuff like "-Weffc++" can detect a lot of nasty errors but it takes
effect on the whole compilation unit---inclusive included system headers
violating style-guides because of performance-purposes. So I get a lot
of useless warnings in which the "real" ones (those _I_ am responsible
for) are hidden.

This happens not only with "-Weffc++", "-ansi -pedantic" produces
e.g.:
/usr/include/g++-3/std/straits.h:86: warning: ANSI C++ forbids variable-size array `a'


A reasonable solution could be something like:

-----
#pragma warnings push
#pragma warnings -effc++
#include <unistd.h>
#pragma warnings pop
-----


Or have I overseen another already existing possibility?





Enrico


More information about the Gcc mailing list