From 6e2398b5249893fb845fb57b06e729bb7a1b70ad Mon Sep 17 00:00:00 2001 From: Farwaykorse Date: Thu, 9 Apr 2020 03:15:57 +0200 Subject: [PATCH 1/2] Solve MSVC warning C4668: __GNUC__ & __clang__ not defined as a preprocessor macro MSVC compiler warning C4668: ` '__clang__' is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'` --- include/gsl/multi_span | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/gsl/multi_span b/include/gsl/multi_span index 3a2d982..779f6e9 100644 --- a/include/gsl/multi_span +++ b/include/gsl/multi_span @@ -57,7 +57,7 @@ #endif // _MSC_VER < 1910 #endif // _MSC_VER -#if __clang__ || __GNUC__ +#if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #endif @@ -2266,7 +2266,7 @@ general_span_iterator operator+(typename general_span_iterator::diff #pragma GCC diagnostic pop #endif // __GNUC__ > 6 -#if __clang__ || __GNUC__ +#if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic pop #endif From 611674d60b6e1d785382e55ff0d73ebd7efeb98e Mon Sep 17 00:00:00 2001 From: Farwaykorse Date: Thu, 9 Apr 2020 03:50:17 +0200 Subject: [PATCH 2/2] GCC "-Warray-bounds" warning persists with release 8.4 modification of commit 5e21831494ea1a140bee47d0a95fc7b0af6c0c3c --- tests/multi_span_tests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/multi_span_tests.cpp b/tests/multi_span_tests.cpp index d9a0e20..32dbf94 100644 --- a/tests/multi_span_tests.cpp +++ b/tests/multi_span_tests.cpp @@ -1043,7 +1043,7 @@ TEST(multi_span_test, subspan) EXPECT_TRUE(av.subspan(4).length() == 1); EXPECT_TRUE(av.subspan(5).length() == 0); // Disabled test instead of fixing since multi_span is deprecated. (PR#835) -#if !(defined(__GNUC__) && __GNUC__ == 8 && __GNUC_MINOR__ == 3) +#if !(defined(__GNUC__) && __GNUC__ == 8) EXPECT_DEATH(av.subspan(6).length(), deathstring); #endif auto av2 = av.subspan(1);