I am compiling with cl.exe
version _MSC_FULL_VER == 160030319
with warning level at 4. I get this warning:
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\yvals.h(773) : warning C4514: 'std::_Mutex::_Mutex' : unreferenced inline function has been removed
Which is this bit of source code:
__thiscall _Mutex(_Uninitialized)
{ // do nothing
}
yvals.h
is included in stdint.h
which I am including like so:
#pragma warning(disable:4514)
#include <stdint.h>
#pragma warning(default:4514)
But it still does not get rid of the warning. Am I doing something wrong here?
I found the answer here. Someone reported it as a bug, but it was closed as by design. The answer is that the warning doesn't kick in until the end of the translation unit. Quote:
Thanks for reporting this issue. I've resolved it as By Design because the 4514 and 4710 warnings are emitted at the end of the translation unit (a translation unit is a source file and all of its included headers). That's why disabling them for part of the translation unit has no effect. Although the line numbers might make it appear as if the compiler is emitting these warnings in the middle of the translation unit as it's compiling the code, that's not the case.
Warning 4514 "unreferenced inline function has been removed" is emitted at the end of the translation unit by the compiler front-end (responsible for parsing C++) because only then can it determine that nothing in the translation unit references that inline function. It looks up the function's line number, but whether the warning is emitted or not depends on whether it is enabled at the end of the translation unit, not whether it was enabled while compiling that function.
So you either need to keep it always disabled or not worry about it.
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