R – n gcc/Xcode pragma to suppress warnings

gccgcc-warningpragmaxcode

Is there a #pragma to have gcc/Xcode suppress specific warnings, similar to Java's @SuppressWarning annotation?

I compile with -Wall as a rule, but there are some situations where I'd like to just ignore a specific warning (e.g. while writing some quick/dirty code just to help debug something).

I'm not looking for "fix the code" answers.

Best Answer

Here's a viable solution. Use #pragma GCC system_header to let GCC handle your code in a very special way, thus suppressing any non fatal #warning.

Remeber you're just fooling your preprocessor, not the real compiler. Suppressing warnings could be harmful most of times.