C++ 20: Preprocessor definitions (#12324)

* C++ 20: Preprocessor definitions

This sets a couple new preprocessor conditions:
1. `FOLLY_CFG_NO_COROUTINES` to prevent types like `folly::optional` from bringing in Folly's coroutine stack when Folly detects C++ 20 coroutines as available.
2. `_SILENCE_CXX20_U8PATH_DEPRECATION_WARNING`: Because the deprecation came before a suitable replacement API. This is more scoped than the `_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS` used by `React.Cpp.props`.

* Change files
This commit is contained in:
Nick Gerleman 2023-11-01 13:27:41 -07:00 коммит произвёл GitHub
Родитель eafc9be3e8
Коммит 1c34a86dd0
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
13 изменённых файлов: 36 добавлений и 18 удалений

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

@ -0,0 +1,7 @@
{
"type": "prerelease",
"comment": "C++ 20: Preprocessor definitions",
"packageName": "react-native-windows",
"email": "ngerlem@fb.com",
"dependentChangeType": "patch"
}

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

@ -71,6 +71,7 @@
WIN32;
_WINDOWS;
_USRDLL;
FOLLY_CFG_NO_COROUTINES;
FOLLY_NO_CONFIG;
NOMINMAX;
_HAS_AUTO_PTR_ETC;

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

@ -59,6 +59,7 @@
_WIN32_WINNT=$(WinVer);
WIN32;
_WINDOWS;
FOLLY_CFG_NO_COROUTINES;
FOLLY_NO_CONFIG;
NOMINMAX;
_HAS_AUTO_PTR_ETC;
@ -158,4 +159,4 @@
</CppWinRTDynamicProjectWinMDReferences>
</ItemGroup>
</Target>
</Project>
</Project>

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

@ -58,6 +58,7 @@
_WINDOWS;
WIN32;
BOOST_ASIO_HAS_IOCP;
FOLLY_CFG_NO_COROUTINES;
FOLLY_NO_CONFIG;
NOMINMAX;
RN_EXPORT=;
@ -127,4 +128,4 @@
<Target Name="Test">
<Exec Command="$(OutDir)$(TargetFileName)" IgnoreStandardErrorWarningFormat="true" />
</Target>
</Project>
</Project>

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

@ -96,12 +96,15 @@
WIN32;
CORE_ABI;
_WINDOWS;
FOLLY_CFG_NO_COROUTINES;
FOLLY_NO_CONFIG;
NOMINMAX;
_HAS_AUTO_PTR_ETC;
RN_PLATFORM=win32;
RN_EXPORT=;
JSI_EXPORT=;
<!-- See https://cplusplus.github.io/LWG/issue3840 -->
_SILENCE_CXX20_U8PATH_DEPRECATION_WARNING;
%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<AdditionalIncludeDirectories>
@ -296,4 +299,4 @@
<_CppWinRTOriginalRootNamespace />
</PropertyGroup>
</Target>
</Project>
</Project>

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

@ -254,7 +254,7 @@
<CompileAsWinRT>false</CompileAsWinRT>
<SDLCheck>true</SDLCheck>
<AdditionalIncludeDirectories>$(ReactNativeWindowsDir)stubs;$(FollyDir);$(FmtDir)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>FOLLY_NO_CONFIG;NOMINMAX;_CRT_SECURE_NO_WARNINGS;WINAPI_PARTITION_APP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>FOLLY_CFG_NO_COROUTINES;FOLLY_NO_CONFIG;NOMINMAX;_CRT_SECURE_NO_WARNINGS;WINAPI_PARTITION_APP;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ForcedUsingFiles />
<DisableSpecificWarnings>4251;4293;4305;4800;4804;4310;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
@ -328,4 +328,4 @@
<ItemGroup>
<ProjectReference Include="..\Fmt\Fmt.vcxproj" Project="{14b93DC8-FD93-4A6D-81CB-8BC96644501C}" />
</ItemGroup>
</Project>
</Project>

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

@ -62,6 +62,7 @@
</PrecompiledHeader>
<PreprocessorDefinitions>
_HAS_AUTO_PTR_ETC=1;
FOLLY_CFG_NO_COROUTINES;
FOLLY_NO_CONFIG;
NOMINMAX;
WIN32;
@ -78,4 +79,4 @@
<ItemGroup>
<ProjectReference Include="..\Folly\Folly.vcxproj" Project="{A990658C-CE31-4BCC-976F-0FC6B1AF693D}" />
</ItemGroup>
</Project>
</Project>

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

@ -54,7 +54,7 @@
<ClCompile>
<AdditionalOptions>/Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>FOLLY_NO_CONFIG;RN_EXPORT=;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>FOLLY_CFG_NO_COROUTINES;FOLLY_NO_CONFIG;RN_EXPORT=;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
@ -95,4 +95,4 @@
<Target Name="Test">
<Exec Command="$(OutDir)$(TargetFileName)" IgnoreStandardErrorWarningFormat="true" />
</Target>
</Project>
</Project>

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

@ -68,6 +68,7 @@
_WIN32_WINNT=$(WinVer);
WIN32;
_WINDOWS;
FOLLY_CFG_NO_COROUTINES;
FOLLY_NO_CONFIG;
NOMINMAX;
_HAS_AUTO_PTR_ETC;
@ -78,7 +79,7 @@
%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalOptions>/bigobj /await %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
<AdditionalIncludeDirectories>
$(FmtDir)include;
$(ProjectDir)pch;
@ -231,4 +232,4 @@
<PackageReference Include="boost" Version="1.76.0.0" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
</Project>
</Project>

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

@ -61,7 +61,7 @@
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
<ForcedIncludeFiles>pch.h</ForcedIncludeFiles>
<PreprocessorDefinitions>_CONSOLE;MSO_MOTIFCPP;FOLLY_NO_CONFIG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_CONSOLE;MSO_MOTIFCPP;FOLLY_CFG_NO_COROUTINES;FOLLY_NO_CONFIG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<WarningLevel>Level4</WarningLevel>
<AdditionalIncludeDirectories>$(MSBuildThisFileDirectory);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalOptions>/await %(AdditionalOptions) /bigobj</AdditionalOptions>
@ -169,4 +169,4 @@
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<Import Project="TestBundle.targets" />
</Project>
</Project>

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

@ -117,7 +117,7 @@
$(GeneratedFilesDir);
%(AdditionalIncludeDirectories)
</AdditionalIncludeDirectories>
<PreprocessorDefinitions>DISABLE_XAML_GENERATED_MAIN;FOLLY_NO_CONFIG;NOMINMAX;_HAS_AUTO_PTR_ETC;_USE_MATH_DEFINES;RN_EXPORT=;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>DISABLE_XAML_GENERATED_MAIN;FOLLY_CFG_NO_COROUTINES;FOLLY_NO_CONFIG;NOMINMAX;_HAS_AUTO_PTR_ETC;_USE_MATH_DEFINES;RN_EXPORT=;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<!--
REACTWINDOWS_BUILD - building with REACTWINDOWS_API as dll exports
OLD_CPPWINRT is a workaround to make target version to 19H1
@ -126,12 +126,15 @@
REACTWINDOWS_BUILD;
RN_PLATFORM=windows;
NOMINMAX;
FOLLY_CFG_NO_COROUTINES;
FOLLY_NO_CONFIG;
RN_EXPORT=;
JSI_EXPORT=;
WIN32=0;
WINRT=1;
_HAS_AUTO_PTR_ETC;
<!-- See https://cplusplus.github.io/LWG/issue3840 -->
_SILENCE_CXX20_U8PATH_DEPRECATION_WARNING;
%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<AdditionalUsingDirectories>$(WindowsSDK_WindowsMetadata);$(AdditionalUsingDirectories)</AdditionalUsingDirectories>
@ -674,4 +677,4 @@
</ClCompile>
</ItemGroup>
</Target>
</Project>
</Project>

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

@ -12,8 +12,8 @@
<ClCompile>
<PreprocessorDefinitions>FOLLY_MOBILE=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ReactNativeWindowsDir)Common;$(ReactNativeWindowsDir)stubs;$(ReactNativeWindowsDir)include;$(ReactNativeWindowsDir)Shared;$(ReactNativeWindowsDir)include\Shared;$(YogaDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>FOLLY_NO_CONFIG;NOMINMAX;_HAS_AUTO_PTR_ETC;RN_EXPORT=;__unused=[[maybe_unused]];%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>FOLLY_CFG_NO_COROUTINES;FOLLY_NO_CONFIG;NOMINMAX;_HAS_AUTO_PTR_ETC;RN_EXPORT=;__unused=[[maybe_unused]];%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
</Project>
</Project>

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

@ -67,7 +67,7 @@
$(ReactNativeWindowsDir)\Shared\tracing;
%(AdditionalIncludeDirectories);
</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_WIN32;_CRT_SECURE_NO_WARNINGS;FOLLY_NO_CONFIG;NOMINMAX;RN_EXPORT=;JSI_EXPORT=;WIN32;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_WIN32;_CRT_SECURE_NO_WARNINGS;FOLLY_CFG_NO_COROUTINES;FOLLY_NO_CONFIG;NOMINMAX;RN_EXPORT=;JSI_EXPORT=;WIN32;_WINDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ForcedUsingFiles />
<DisableSpecificWarnings>4715;4251;4800;4804;4305;4722;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<PreprocessToFile>false</PreprocessToFile>
@ -246,4 +246,4 @@
<Copy DestinationFiles="@(NodeApiJsiFiles->'$(ReactNativeDir)\ReactCommon\jsi\%(RecursiveDir)%(Filename)%(Extension)')" SourceFiles="@(NodeApiJsiFiles)" />
<Copy DestinationFiles="@(TemporaryReactCommonPatchFiles->'$(ReactNativeDir)\ReactCommon\%(RecursiveDir)%(Filename)%(Extension)')" SourceFiles="@(TemporaryReactCommonPatchFiles)" />
</Target>
</Project>
</Project>