Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enabling further C++ strict conformance (/permissive-) #2429

Merged
merged 8 commits into from
May 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion vnext/Desktop.IntegrationTests/RNTesterIntegrationTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ namespace Microsoft {
namespace VisualStudio {
namespace CppUnitTestFramework {

static std::wstring ToString(const facebook::react::test::TestStatus& status)
template <>
std::wstring ToString<facebook::react::test::TestStatus>(const facebook::react::test::TestStatus& status)
{
return ToString(static_cast<unsigned int>(status));
}
Expand Down
2 changes: 1 addition & 1 deletion vnext/Desktop.UnitTests/WebSocketModuleTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ TEST_CLASS(WebSocketModuleTest)
SIZE = 5
};

char* MethodName[static_cast<size_t>(MethodId::SIZE)]
const char* MethodName[static_cast<size_t>(MethodId::SIZE)]
{
"connect",
"close",
Expand Down
4 changes: 2 additions & 2 deletions vnext/Desktop/LegacyWebSocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,9 +428,9 @@ void LegacySecureWebSocket<Protocol, Socket, Resolver>::Handshake(const IWebSock
{
this->m_stream->next_layer().async_handshake(ssl::stream_base::client, [this, options = std::move(options)](boostecr ec)
{
if (ec && m_errorHandler)
if (ec && this->m_errorHandler)
{
m_errorHandler({ ec.message(), IWebSocket::ErrorType::Connection });
this->m_errorHandler({ ec.message(), IWebSocket::ErrorType::Connection });
}
else
{
Expand Down
3 changes: 3 additions & 0 deletions vnext/Desktop/React.Windows.Desktop.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
<PropertyGroup Label="NOJSC">
<NOJSC>true</NOJSC>
</PropertyGroup>
<PropertyGroup Label="Permissive">
<ENABLEPermissive>true</ENABLEPermissive>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<Import Project="$(ReactNativeWindowsDir)PropertySheets\React.Cpp.props" />
<PropertyGroup Label="Configuration">
Expand Down
1 change: 1 addition & 0 deletions vnext/Desktop/msoFolly.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#pragma warning( disable : 4146 )
#pragma warning( disable : 4100 )
#pragma warning( disable : 4324 ) // structure was padded due to alignment specifier
#pragma warning( disable : 4643 ) // Forward declaring 'T' in namespace std is not permitted by the C++ Standard.
#pragma push_macro("CHECK")
#pragma push_macro("Check")
#pragma push_macro("max")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalOptions>/Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PreprocessorDefinitions>FOLLY_NO_CONFIG;RN_EXPORT=;NOJSC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
Expand Down
2 changes: 2 additions & 0 deletions vnext/PropertySheets/Warnings.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

<ItemDefinitionGroup>
<ClCompile>
<!-- /permissive- by default to enforce standards conformance, unless ENABLEPermissive has been set -->
<AdditionalOptions Condition="'$(ENABLEPermissive)' == ''">/permissive- %(AdditionalOptions)</AdditionalOptions>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this in Warnings.props?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

enabling strict C++ warnings seemed like it should go with warnings?

<DisableSpecificWarnings>$(OfficePreDisabledWarnings);$(ExtraWarningsToDisable);$(DisableSpecificWarnings)</DisableSpecificWarnings>
<TreatWarningAsError>true</TreatWarningAsError>
<WarningLevel>Level4</WarningLevel>
Expand Down
2 changes: 1 addition & 1 deletion vnext/ReactUWP/ReactUWP.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
<PreprocessorDefinitions>REACTWINDOWS_BUILD;RN_PLATFORM=uwp;USE_EDGEMODE_JSRT;NOMINMAX;FOLLY_NO_CONFIG;RN_EXPORT=;JSI_EXPORT=;WIN32=0;WINRT=1;NOJSC;_HAS_AUTO_PTR_ETC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ReactNativeWindowsDir);$(ReactNativeWindowsDir)Pch;$(ReactNativeWindowsDir)ReactUWP\GeneratedWinmdHeader;$(ReactNativeWindowsDir)ReactWindowsCore;$(ReactNativeWindowsDir)include\ReactWindowsCore;$(ReactNativeWindowsDir)include\ReactUWP;$(YogaDir);$(ReactNativeDir)\ReactCommon;$(ReactNativeWindowsDir)include;$(ReactNativeWindowsDir)stubs;$(ReactNativeWindowsDir)Shared;$(FollyDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<LanguageStandard>stdcpp17</LanguageStandard>
<AdditionalOptions>/await /permissive- %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/await %(AdditionalOptions)</AdditionalOptions>
<ShowIncludes>false</ShowIncludes>
</ClCompile>
<Link>
Expand Down
1 change: 1 addition & 0 deletions vnext/ReactWindowsCore/UnicodeConversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

#include <string>
#include <exception>
#include <stdexcept>

namespace facebook {
namespace react {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ namespace Microsoft {
namespace VisualStudio {
namespace CppUnitTestFramework {

static std::wstring ToString(const facebook::react::test::TestStatus& status)
template <>
std::wstring ToString<facebook::react::test::TestStatus>(const facebook::react::test::TestStatus& status)
{
return ToString(static_cast<unsigned int>(status));
}
Expand Down
8 changes: 4 additions & 4 deletions vnext/Universal.SampleApp/MainPage.xaml.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
//
// MainPage.xaml.cpp
Expand Down Expand Up @@ -60,9 +60,9 @@ void WindowsSampleApp::MainPage::RemovePane(HostingPane^ pane)
unsigned int countColumns = x_PaneContainer->ColumnDefinitions->Size;
for (;index < countColumns; ++index)
{
auto pane = dynamic_cast<HostingPane^>(x_PaneContainer->Children->GetAt(index));
if (pane != nullptr)
pane->SetValue(Grid::ColumnProperty, index);
auto hostingPane = dynamic_cast<HostingPane^>(x_PaneContainer->Children->GetAt(index));
if (hostingPane != nullptr)
hostingPane->SetValue(Grid::ColumnProperty, index);
else
assert(false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@
<UseDotNetNativeToolchain>true</UseDotNetNativeToolchain>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<!-- Include Warnings.props after Microsoft.Cpp.props to change default WarningLevel -->
<Import Project="$(ReactNativeWindowsDir)PropertySheets\Warnings.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets">
Expand All @@ -62,7 +64,7 @@
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<AdditionalOptions>/await /bigobj %(AdditionalOptions)</AdditionalOptions>
<AdditionalOptions>/await /bigobj /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
<DisableSpecificWarnings>4453;4800;28204;4146;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(FollyDir);$(ReactNativeDir)\ReactCommon;$(ReactNativeWindowsDir)stubs;$(ReactNativeWindowsDir)include;$(ReactNativeWindowsDir)ReactWindowsCore;$(ReactNativeWindowsDir)include\ReactWindowsCore;$(ReactNativeWindowsDir)include\ReactUWP;$(YogaDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS;FOLLY_NO_CONFIG;NOMINMAX;NOJSC;_HAS_AUTO_PTR_ETC;RN_EXPORT=;%(PreprocessorDefinitions)</PreprocessorDefinitions>
Expand Down