From 9840c667da1a51259aa5efbcd81e8614120d642f Mon Sep 17 00:00:00 2001 From: Ben Craig Date: Thu, 16 Jan 2025 09:51:59 -0500 Subject: [PATCH] Add version checks to -Wself-move suppressions --- radiant/TotallyRad.h | 4 ++-- test/test_List.cpp | 4 ++-- test/test_Vector.cpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/radiant/TotallyRad.h b/radiant/TotallyRad.h index 18bff7f..ab3c1c5 100644 --- a/radiant/TotallyRad.h +++ b/radiant/TotallyRad.h @@ -72,12 +72,12 @@ #if defined(__clang__) && __clang__ #define RAD_CLANG_VERSION \ - (__clang_major__ * 10000 + __clang_minor__ + 100 + __clang_patchlevel__) + (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) #endif #if !defined(__clang__) && defined(__GNUC__) && __GNUC__ #define RAD_GCC_VERSION \ - (__GNUC__ * 10000 + __GNUC__MINOR__ + 100 + __GNUC_PATCHLEVEL__) + (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) #endif #if defined(_MSC_VER) && _MSC_VER diff --git a/test/test_List.cpp b/test/test_List.cpp index 6820f81..bed38bf 100644 --- a/test/test_List.cpp +++ b/test/test_List.cpp @@ -449,7 +449,7 @@ TEST(ListTest, MoveAssign) ListEqual(one, { 101 }); ListEqual(move_from_one, { 1, 201 }); } -#ifdef RAD_GCC_VERSION +#if defined(RAD_GCC_VERSION) && RAD_GCC_VERSION >= 130000 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wself-move" #endif @@ -472,7 +472,7 @@ TEST(ListTest, MoveAssign) #ifdef RAD_CLANG_VERSION #pragma clang diagnostic pop #endif -#ifdef RAD_GCC_VERSION +#if defined(RAD_GCC_VERSION) && RAD_GCC_VERSION >= 130000 #pragma GCC diagnostic pop #endif } diff --git a/test/test_Vector.cpp b/test/test_Vector.cpp index ec9b2da..8154684 100644 --- a/test/test_Vector.cpp +++ b/test/test_Vector.cpp @@ -1001,7 +1001,7 @@ TEST_F(TestVectorIntegral, Move) EXPECT_EQ(other.Front(), 1); EXPECT_EQ(other.Back(), 3); -#ifdef RAD_GCC_VERSION +#if defined(RAD_GCC_VERSION) && RAD_GCC_VERSION >= 130000 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wself-move" #endif @@ -1022,7 +1022,7 @@ TEST_F(TestVectorIntegral, Move) #ifdef RAD_CLANG_VERSION #pragma clang diagnostic pop #endif -#ifdef RAD_GCC_VERSION +#if defined(RAD_GCC_VERSION) && RAD_GCC_VERSION >= 130000 #pragma GCC diagnostic pop #endif }