I'm trying to enable some warnings that detail potential security problems through a pragma. The warnings are those listed by Jon Sturgeon in “Off By Default” Compiler Warnings in Visual C++:
# pragma warning (enable: 4191 4242 4263 4264 4265 4266 4302 4826 4905 4906 4928)
I'm getting a warning under Visual Studio (2010 to be exact) for the above pragma:
ClCompile:
pch.cpp
... config.h(238): warning C4615: #pragma warning : unknown user warning type
It appears there is no enable
or on
for pragma warning
. There is a once
, but I want to see all instances of the potential problems, and not just one.
Microsoft's documentation on warning does not appear to discuss the topic of enabling warnings.
I can't really use # pragma warning (default: ...)
because they are off by default. I don't want to modify each of the solution's configurations because the solution has 4 projects, 6 configurations and 4 platforms. So I have 80+ of them to change (the cross product of the selections).
How do I enable select warnings through the pragma?
pragma warning (default: ...)
. I specifically want to avoid it in the configuration because the solution has 4 projects, 6 configurations and 4 platforms. That means I have to potentially touch it in 80 places.error
notenable
asin #pragma warning (error: 4191 4242 4263 4264 4265 4266 4302 4826 4905 4906 4928)
error
stop the compile? I want the compile to complete. My requirement (for release engineering) is a clean compile. I don't care what happens up until that point. The developers would tar and feather me if I stopped their compilation process for no reason.#pragma warning(X: a b c d)
, where X is 1,2,3,4 and 'a b c d' are your warnings, it saysThis also turns on a specified warning that is off by default.
.. so would# pragma warning (1: 4191 4242 4263 4264 4265 4266 4302 4826 4905 4906 4928)
and enable a warning level of 1 not suffice? Then do a# pragma warning (default: 4191 4242 4263 4264 4265 4266 4302 4826 4905 4906 4928)
which would put them back in the default level/state .. I could be reading that wrong as I don't usually mess with the MS specificpragmas
..?