Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

yvals.h C4514 warning on Windows SDK 7.1 compiler

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?

like image 330
Matt Clarkson Avatar asked May 07 '12 05:05

Matt Clarkson


1 Answers

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.

like image 190
Jesse Good Avatar answered Oct 12 '22 07:10

Jesse Good