Advertisement

disable warnings in gcc

Started by October 26, 2003 10:12 AM
3 comments, last by uNiQue0815 20 years, 10 months ago
does anyone know, how to disable warnings for only some lines of code ? something like MSVC''s "#pragma warning (disable: ...)" ?? i have one code-line with a warning, which is included in almost all other files of my project... so the compiler hurls out hundreds of warning messages at compilation... and that makes me a little bit angry :D i think, i''ve searched the whole www for this...
you can disable warnings by feeding gcc with the correct flags.
Advertisement
yes... i could.
the problem about this is, that i still want to have all other warnings displayed, so i can fix them if i think they should be fixed.

but if i think, that this one line of code is absolutely correct, and gcc still gives me a warning (and as i already said : hundreds & thousands of them, for only that one line of code), then i'd rather disable this warning (or all of them) for just this single line.

is there any way to achieve this ?

[edited by - uNiQue0815 on October 26, 2003 11:41:13 AM]
I wouldn''t be so sure that line IS correct, wanna show us the warning?
i second the idea of looking at the code, usually excessive use of parantheses and explicit type casts will get rid of warnings. however ignorant the compiler may be of the reason you wrote that code, the fact that it is complaining almost always means there is something fishy with it.

This topic is closed to new replies.

Advertisement