How to disable all warnings in g ++ on multiple lines of code

How to disable all warnings on multiple lines of code. Specific warnings can be disabled using the GCC diagnostic function, but is there a flag for all warnings. I tried this method, but it does not work.

#pragma GCC diagnostic push #pragma GCC diagnostic ignored "-wall" // some code #pragma GCC diagnostic pop 
+4
source share
2 answers

From here: http://dbp-consulting.com/tutorials/SuppressingGCCWarnings.html

For version 4.6 or later, you can save the state of the user diagnostic flags. You can insert this around a line that triggers a false warning:

 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" // Code that causes warning goes here #pragma GCC diagnostic pop 

To achieve the desired behavior, you should use "-Wall" instead of "-Wdeprecated-declarations" (and not "-wall") - pay attention to "W").

+7
source

I think gcc -w filename.c does this
-w means ignore warnings

-1
source

All Articles