From 07de7337eb997ac6bc0560e1aed2f43b985c615e Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Fri, 13 Jan 2023 01:26:23 -0800 Subject: [PATCH 1/4] msvc: dont explicitly set /Zc:lambda it's implied by /std --- Source/VSProps/Base.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/VSProps/Base.props b/Source/VSProps/Base.props index 29f3d6ffbf..7e25c06a34 100644 --- a/Source/VSProps/Base.props +++ b/Source/VSProps/Base.props @@ -33,7 +33,7 @@ true - /Zc:__cplusplus,externConstexpr,lambda,preprocessor,throwingNew /volatile:iso %(AdditionalOptions) + /Zc:__cplusplus,externConstexpr,preprocessor,throwingNew /volatile:iso %(AdditionalOptions) /Zo %(AdditionalOptions) From 9723dba780f66b8b6ddef5def22ebd0c12c25079 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Fri, 13 Jan 2023 01:35:17 -0800 Subject: [PATCH 2/4] msvc: set /Zc:enumTypes --- Source/VSProps/Base.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/VSProps/Base.props b/Source/VSProps/Base.props index 7e25c06a34..d2b1ef9c6e 100644 --- a/Source/VSProps/Base.props +++ b/Source/VSProps/Base.props @@ -33,7 +33,7 @@ true - /Zc:__cplusplus,externConstexpr,preprocessor,throwingNew /volatile:iso %(AdditionalOptions) + /Zc:__cplusplus,enumTypes,externConstexpr,preprocessor,throwingNew /volatile:iso %(AdditionalOptions) /Zo %(AdditionalOptions) From 2a5c699489edaf55f3b54318cfaf3c69fbb2e622 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Fri, 13 Jan 2023 01:36:03 -0800 Subject: [PATCH 3/4] msvc: note some things to enable in vs 17.5 --- Source/VSProps/Base.props | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Source/VSProps/Base.props b/Source/VSProps/Base.props index d2b1ef9c6e..92808650d1 100644 --- a/Source/VSProps/Base.props +++ b/Source/VSProps/Base.props @@ -33,6 +33,7 @@ true + /Zc:__cplusplus,enumTypes,externConstexpr,preprocessor,throwingNew /volatile:iso %(AdditionalOptions) /Zo %(AdditionalOptions) @@ -73,6 +74,7 @@ true MultiThreadedDLL false + /Gw %(AdditionalOptions) true From f2aed92fd1fb975ea4ac0011684c24f8b326be64 Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Fri, 13 Jan 2023 01:55:42 -0800 Subject: [PATCH 4/4] cmake: update msvc conformance flags --- CMakeLists.txt | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0686de846b..388fb13a6e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -318,23 +318,13 @@ if(MSVC) add_compile_options(/Oi) # Enable buffer security check on Debug, disable otherwise add_compile_options($,/GS,/GS->) - # Enforce C++ standard conforming conversion rules to catch possible bugs - add_compile_options(/permissive-) # Remove unreferenced inline functions/data to reduce link time and catch bugs + # Note: In msbuild build, this gets set by msbuild by default add_compile_options(/Zc:inline) - # Assume `new` (w/o std::nothrow) throws to reduce binary size - add_compile_options(/Zc:throwingNew) + # Fix various other non-conformant behaviors + add_compile_options(/Zc:__cplusplus,enumTypes,externConstexpr,preprocessor,throwingNew) # Enforce strict volatile semantics as per ISO C++ add_compile_options(/volatile:iso) - # Fix non-conformant lambda behavior (constexpr variables shouldn't need capturing) - add_compile_options(/experimental:newLambdaProcessor) - # Fix various other non-conformant behaviors - add_compile_options(/Zc:__cplusplus,externConstexpr,lambda,preprocessor) - - # Temporarily disable warnings to enable /Zc:preprocessor compatibility with WinSDK headers. - add_compile_options( - /wd5105 # macro expansion producing 'defined' has undefined behavior - ) # Use 'precise' floating point model add_compile_options(/fp:precise)