How to disable all warnings on a few lines of code. Specific warnings can be disabled using GCC diagnostic feature, but is there a flag for all warnings. I tried this way but it doesn't work
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-wall"
// some code
#pragma GCC diagnostic pop
From here: http://dbp-consulting.com/tutorials/SuppressingGCCWarnings.html
For version 4.6 or later, you can save the state of the user's diagnostic flags. You can insert this around the line that causes the spurious warning:
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
// Code that causes warning goes here
#pragma GCC diagnostic pop
In order to achieve the desired behavior, you should use "-Wall" instead of "-Wdeprecated-declarations" (and not "-wall" -- note the upcase "W").
I think gcc -w filename.c does so
-w flag is to ignore warnings
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With