In gcc4.6 and later you can use pragma's to suppress specific warnings and do that suppression only to a specific block of code, i.e. :
#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" // Code that causes warning goes here #pragma GCC diagnostic pop
The push/pop are used to preserve the diagnostic options that were in place before your code was processed.
This would be a much better approach than using "#pragma GCC system_header" to suppress all warnings. (Of course, in older gcc you may be "stuck" with the #pragma GCC system_header approach!)
Here's a nice reference on suppressing gcc warnings: http://www.dbp-consulting.com/tutorials/SuppressingGCCWarnings.html
This page also describes how to use -fdiagnostics-show-option to find out what option controls a particular warning.
Of course, as others mention, it's generally far preferable to fix the root cause of all warnings than to suppress them! However, sometimes that is not possible.