Skip to content

Commit

Permalink
Update Clang GSL_SUPPRESS to stringize parameter instead of using fix…
Browse files Browse the repository at this point in the history
…ed string literal. (#1133)

Fix #1130.
  • Loading branch information
edgchen1 committed Sep 11, 2023
1 parent 2940006 commit 52212c2
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 18 deletions.
2 changes: 1 addition & 1 deletion include/gsl/assert
Original file line number Diff line number Diff line change
Expand Up @@ -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)]]
Expand Down
14 changes: 0 additions & 14 deletions include/gsl/byte
Original file line number Diff line number Diff line change
Expand Up @@ -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 <type_traits>

// VS2017 15.8 added support for the __cpp_lib_byte definition
Expand Down
3 changes: 0 additions & 3 deletions tests/byte_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ TEST(byte_tests, construction)
EXPECT_TRUE(static_cast<unsigned char>(b) == 4);
}

// clang-format off
GSL_SUPPRESS(es.49)
// clang-format on
{
const byte b = byte(12);
EXPECT_TRUE(static_cast<unsigned char>(b) == 12);
Expand Down

0 comments on commit 52212c2

Please sign in to comment.