Emulator Issues #12170
closedDolphin build failed on MSVC under /Zc:preprocessor
0%
Description
Hi All,
The MSVC team uses Dolphin as a part of testing to detect compiler regression, recently we build Dolphin under /Zc:preprocessor and got the below error. We provides a workaround, can you help look? There maybe more files need to be modified.
The issue is that the old preprocessor is very aggressive at removing commas before a VA_ARGS, but the new one only removes them when they are prefixed by ## (same as GCC and Clang). The fix is to branch to the other implementation of the macros when _MSVC_TRADITIONAL is defined and equal to 0. So for example in https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/Common/MsgHandler.h#L35 instead of
#ifdef _WIN32
It should be
#if defined(_WIN32) && (!defined(_MSVC_TRADITIONAL) || _MSVC_TRADITIONAL == 1)
Attach the build log for detail.
errors:
F:\gitP\dolphin-emu\dolphin\Source\Core\Common\MemoryUtil.cpp(66,5): error C2059: syntax error: ')' [F:\gitP\dolphin-emu\dolphin\Source\Core\Common\Common.vcxproj]
F:\gitP\dolphin-emu\dolphin\Source\Core\Common\MemoryUtil.cpp(66,5): error C2059: PanicAlert("Failed to allocate raw memory"); [F:\gitP\dolphin-emu\dolphin\Source\Core\Common\Common.vcxproj]
F:\gitP\dolphin-emu\dolphin\Source\Core\Common\MemoryUtil.cpp(66,5): error C2059: ^ [F:\gitP\dolphin-emu\dolphin\Source\Core\Common\Common.vcxproj]
F:\gitP\dolphin-emu\dolphin\Source\Core\Common\MemoryUtil.cpp(82,5): error C2059: syntax error: ')' [F:\gitP\dolphin-emu\dolphin\Source\Core\Common\Common.vcxproj]
F:\gitP\dolphin-emu\dolphin\Source\Core\Common\MemoryUtil.cpp(82,5): error C2059: PanicAlert("Failed to allocate aligned memory"); [F:\gitP\dolphin-emu\dolphin\Source\Core\Common\Common.vcxproj]
F:\gitP\dolphin-emu\dolphin\Source\Core\Common\MemoryUtil.cpp(82,5): error C2059: ^ [F:\gitP\dolphin-emu\dolphin\Source\Core\Common\Common.vcxproj]
Files