From 52212c2d7600c816ec9b0438d3fbd2a95c190c2f Mon Sep 17 00:00:00 2001 From: Edward Chen <18449977+edgchen1@users.noreply.github.com> Date: Mon, 11 Sep 2023 10:52:30 -0700 Subject: [PATCH] Update Clang GSL_SUPPRESS to stringize parameter instead of using fixed string literal. (#1133) Fix #1130. --- include/gsl/assert | 2 +- include/gsl/byte | 14 -------------- tests/byte_tests.cpp | 3 --- 3 files changed, 1 insertion(+), 18 deletions(-) diff --git a/include/gsl/assert b/include/gsl/assert index 458ad7d..d3e6ccd 100644 --- a/include/gsl/assert +++ b/include/gsl/assert @@ -46,7 +46,7 @@ // Hopefully temporary until suppression standardization occurs // #if defined(__clang__) -#define GSL_SUPPRESS(x) [[gsl::suppress("x")]] +#define GSL_SUPPRESS(x) [[gsl::suppress(#x)]] #else #if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__NVCC__) #define GSL_SUPPRESS(x) [[gsl::suppress(x)]] diff --git a/include/gsl/byte b/include/gsl/byte index a721dc6..dc4b742 100644 --- a/include/gsl/byte +++ b/include/gsl/byte @@ -17,20 +17,6 @@ #ifndef GSL_BYTE_H #define GSL_BYTE_H -// -// make suppress attributes work for some compilers -// Hopefully temporary until suppression standardization occurs -// -#if defined(__clang__) -#define GSL_SUPPRESS(x) [[gsl::suppress("x")]] -#else -#if defined(_MSC_VER) && !defined(__INTEL_COMPILER) && !defined(__NVCC__) -#define GSL_SUPPRESS(x) [[gsl::suppress(x)]] -#else -#define GSL_SUPPRESS(x) -#endif // _MSC_VER -#endif // __clang__ - #include // VS2017 15.8 added support for the __cpp_lib_byte definition diff --git a/tests/byte_tests.cpp b/tests/byte_tests.cpp index fbef36f..634dcc9 100644 --- a/tests/byte_tests.cpp +++ b/tests/byte_tests.cpp @@ -37,9 +37,6 @@ TEST(byte_tests, construction) EXPECT_TRUE(static_cast(b) == 4); } - // clang-format off - GSL_SUPPRESS(es.49) - // clang-format on { const byte b = byte(12); EXPECT_TRUE(static_cast(b) == 12);