Suppress a particular gcc compiler warning?
I know with gcc you can suppress certain types of warnings by using -Wno-error-errorType to suppress errors of type "errorType". But how do you suppress one specific warning. Is there a way to do this with gcc - I understand you can do it with Visual C++ by using pragma then the unique warning id number. But in gcc i don't see unique warning numbers??
Thanks in advance! |
I'm not really sure, but why would you need to suppress a warning? It's just a warning, not an error, and later on the bug that the warning is trying to warn you about may sneak into the code elsewhere. If you've blocked that warning, you won't know it until difficult to track logic errors appear.
|
I understand you're concern. The requirement is to have warning free nightly builds and the warning is coming from a 3rd party package so being able to suppress it is desireable. Can anyone give an example of how to use gcc pragmas?
Thanks! :) |
Googling around, it seems that gcc doesn't like the pragma. If there's a way to do this with a pragma, they aren't telling. :-) All the sources I can find say to do it with the -Wno-something flags on the compile command. What warning is being given? Can it be covered with a -Wno flag?
|
I agree it seems they had it long ago, then decided it was bad, and now are somewhat making it more available with gcc 3.4.0. No, the -Wno-error doesn't cover it because then it'll supress all warnings of that type not just the ones for that particular class (i think..).
|
Hrm, that may be the compromise you have to live with. Alternatively, you could just wrap gcc in a little awk script that just strips that warning out. After all, a warning is really nothing more than a line on the screen.
|
That is true, thanks Patrick
|
GCC DOES have pragmas for this, here's how they work.
I wrote this white paper originally as part of a boost wiki, http://dbp-consulting.com/tutorials/...CWarnings.html It explains everything there is to know about suppressing warnings with gcc.
|
All times are GMT -5. The time now is 02:24 PM. |