I'm using MSVC with a CMaked project. As a result, I've enabled many of the flags on MSVC which were enabled for gcc and clang. However, the /Wall warning level is giving me some pain; it warns me about all kinds of things in included headers, like stdio.h and boost headers. Is there a way to stop MSVC from warning me about things in headers? I like my warning levels, but I only want them enabled for me.
Description. We currently have only two ways to disable compiler warnings-as-errors: either make none of them errors using --disable-warnings-as-errors or disable all errors with a compiler flag. There is no way to disable specific warnings-as-errors from the SCons command line due to the order of the compiler flags.
Choose Build, and go to the Errors and warnings subsection. In the Suppress warnings or Suppress specific warnings box, specify the error codes of the warnings that you want to suppress, separated by semicolons.
If the value of y is always 1, 2 or 3, then x is always initialized, but GCC doesn't know this. To suppress the warning, you need to provide a default case with assert(0) or similar code. This option also warns when a non-volatile automatic variable might be changed by a call to longjmp.
/Wall
is very pedantic. /W4
is probably all you really need. To answer your question, you can disable specific warnings around your headers with:
#pragma warning(disable:xxxx)
#include <yourheader.h>
#pragma warning(default:xxxx)
Or change the warning level with:
#pragma warning(push,3)
#include <yourheader.h>
#pragma warning(pop)
See the MSDN documentation: http://msdn.microsoft.com/en-us/library/2c8f766e.aspx
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