Enable standard-confirming new behaviour in MSVS 201x projects

Use /Zc:throwingNew option for the compilers supporting it instead of
defaulting to compatible behaviour, which assumes that operator new can
return NULL on allocation failure, that we don't need, at least in the
release builds.

This is also slightly more efficient as it allows the compiler to avoid
generating null checks after calling new.

Closes #19069.
This commit is contained in:
PKEuS
2021-01-31 23:16:46 +01:00
committed by Vadim Zeitlin
parent e7cd875ab0
commit 98d3a4ccdc

View File

@@ -75,6 +75,7 @@
<ItemDefinitionGroup>
<ClCompile>
<AdditionalOptions Condition="'$(PlatformToolset)' == 'v140_xp'">/Zc:threadSafeInit- %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions Condition="('$(Configuration)'=='Release' or '$(Configuration)'=='DLL Release') and '$(VisualStudioVersion)' >= '14.0'">/Zc:throwingNew %(AdditionalOptions)</AdditionalOptions>
</ClCompile>
<Link>
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;comdlg32.lib;winspool.lib;shell32.lib;shlwapi.lib;ole32.lib;oleaut32.lib;uuid.lib;advapi32.lib;version.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;wininet.lib;winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>