Suppressing specific compiler warnings
Geert Bosch
bosch@gnat.com
Wed May 26 19:35:00 GMT 2004
On May 26, 2004, at 04:18, Banibrata Dutta wrote:
I've wondered for a long time as to why the ability to suppress
specific
compiler warnings is missing in GCC.
Has this ever been discussed ? Having this would be very useful in
cases
where we treat warnings and errors and cause build to break. At times
there
are warnings which we decide to live with, because they reflect a
deliberate
decision.
Maintaining options for every warning is a huge maintenance burden
(as is numbered warnings), and still causes problems when we change
warnings.
For GNAT, we found suppression warnings for a specific section of
code, or for an entity (variable/type/function etc) works very well.
Naturally, every use of the pragma to switch off warnings should have
a comment indicating why the suspect code is in fact OK.
This scheme is easy to maintain and should work for C/C++ as well.
-Geert
More information about the Gcc
mailing list