Prevent optimizing away key parts of std::string structure used in tests.

This commit is contained in:
Dan Thompson (SBS) 2019-12-27 17:32:52 -08:00 коммит произвёл Dan Thompson
Родитель e8129c57a7
Коммит 19576eda44
1 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -970,6 +970,9 @@ string g_strings[] = {
};
// Just need something
string g_oneString = "hello there";
// A variable with a name that looks like a number.
__declspec( dllexport ) // prevents it from being optimized away on FRE builds
LONG abcd = 0xabcd;
@ -1001,6 +1004,11 @@ DWORD GetSystemPageSize()
{
GetSystemInfo( &g_SysInfo );
printf( "page size: %#x\n", g_SysInfo.dwPageSize );
// Just need to do "something" with an STL string object, to prevent
// the compiler/linker from optimizing too much of the structure away,
// so that the test that verifies we can convert STL strings will work.
g_oneString += " okay, now there is more stuff here";
}
return g_SysInfo.dwPageSize;