Suppressing particular warnings for particular lines of code

John (Eljay) Love-Jensen eljay@adobe.com
Thu Dec 4 12:15:00 GMT 2008


Hi Yang,

>> In Java, you can insert @SuppressWarnings(...) annotations before a line
>> to tell javac to suppress certain warnings for that line.  Is there
>> anything similar for gcc?

> Anyone?

For gcc, there are the compile line switches, such as -Wall, -Wextra, and
other -Wsomething which enable (or using -Wno-something, disable) the
warning.

There are no #pragma directives to disable warnings in-line with the code.

HTH,
--Eljay



More information about the Gcc-help mailing list