Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/GSL.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordmitrykobets-msft <89153909+dmitrykobets-msft@users.noreply.github.com>2022-03-22 22:24:23 +0300
committerGitHub <noreply@github.com>2022-03-22 22:24:23 +0300
commitf22f524aa2d5e5ad334bcf88c69ffdb5636deed9 (patch)
tree88978036e72657f25fafd7a25a262dfba6a316f7
parent4377f6e603c64a86c934f1546aa9db482f2e1a4e (diff)
Suppress reserved identifier warning (#1041)
The following reserved identifiers are being used specifically to target certain MSVC constructs, so suppress the warning in VS 2022 (LLVM) "... is reserved because it starts with '_' followed by a capital letter": - _Unchecked_type - _Verify_range - _Verify_offset - _Unwrapped - _Unwrap_when_unverified - _Seek_to - _Unchecked_begin - _Unchecked_end
-rw-r--r--tests/CMakeLists.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index cab4e56..891569b 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -62,6 +62,7 @@ if (MSVC AND (GSL_CXX_STANDARD GREATER_EQUAL 17))
set(GSL_CPLUSPLUS_OPT -Zc:__cplusplus -permissive-)
endif()
+include(CheckCXXCompilerFlag)
# this interface adds compile options to how the tests are run
# please try to keep entries ordered =)
add_library(gsl_tests_config INTERFACE)
@@ -105,6 +106,10 @@ if(MSVC) # MSVC or simulating MSVC
>
>
)
+ check_cxx_compiler_flag("-Wno-reserved-identifier" WARN_RESERVED_ID)
+ if (WARN_RESERVED_ID)
+ target_compile_options(gsl_tests_config INTERFACE "-Wno-reserved-identifier")
+ endif()
else()
target_compile_options(gsl_tests_config INTERFACE
-fno-strict-aliasing
@@ -228,6 +233,10 @@ if(MSVC) # MSVC or simulating MSVC
-Wno-unknown-attributes
>
)
+ check_cxx_compiler_flag("-Wno-reserved-identifier" WARN_RESERVED_ID)
+ if (WARN_RESERVED_ID)
+ target_compile_options(gsl_tests_config_noexcept INTERFACE "-Wno-reserved-identifier")
+ endif()
else()
target_compile_options(gsl_tests_config_noexcept INTERFACE
-fno-exceptions