mirror of
https://github.com/microsoft/GSL.git
synced 2024-11-03 17:56:43 -05:00
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
This commit is contained in:
parent
4377f6e603
commit
f22f524aa2
@ -62,6 +62,7 @@ if (MSVC AND (GSL_CXX_STANDARD GREATER_EQUAL 17))
|
|||||||
set(GSL_CPLUSPLUS_OPT -Zc:__cplusplus -permissive-)
|
set(GSL_CPLUSPLUS_OPT -Zc:__cplusplus -permissive-)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
include(CheckCXXCompilerFlag)
|
||||||
# this interface adds compile options to how the tests are run
|
# this interface adds compile options to how the tests are run
|
||||||
# please try to keep entries ordered =)
|
# please try to keep entries ordered =)
|
||||||
add_library(gsl_tests_config INTERFACE)
|
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()
|
else()
|
||||||
target_compile_options(gsl_tests_config INTERFACE
|
target_compile_options(gsl_tests_config INTERFACE
|
||||||
-fno-strict-aliasing
|
-fno-strict-aliasing
|
||||||
@ -228,6 +233,10 @@ if(MSVC) # MSVC or simulating MSVC
|
|||||||
-Wno-unknown-attributes
|
-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()
|
else()
|
||||||
target_compile_options(gsl_tests_config_noexcept INTERFACE
|
target_compile_options(gsl_tests_config_noexcept INTERFACE
|
||||||
-fno-exceptions
|
-fno-exceptions
|
||||||
|
Loading…
Reference in New Issue
Block a user