From d20be2aaf8adb95dc59798d20f18e649082b1300 Mon Sep 17 00:00:00 2001 From: Christian Mazakas Date: Fri, 11 Feb 2022 10:19:33 -0800 Subject: [PATCH] Refactor tests to disable `-Wself-assign-overloaded` themselves instead of in the Jamfile as not all clang versions support the warning --- test/Jamfile.v2 | 6 +++--- test/exception/assign_exception_tests.cpp | 6 ++++++ test/unordered/assign_tests.cpp | 6 ++++++ 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index f55d93e3..3afe22cf 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -47,7 +47,7 @@ test-suite unordered [ run unordered/constructor_tests.cpp ] [ run unordered/copy_tests.cpp ] [ run unordered/move_tests.cpp ] - [ run unordered/assign_tests.cpp : : : clang:"-Wno-self-assign-overloaded" ] + [ run unordered/assign_tests.cpp ] [ run unordered/insert_tests.cpp ] [ run unordered/insert_stable_tests.cpp ] [ run unordered/insert_hint_tests.cpp ] @@ -90,7 +90,7 @@ test-suite unordered : BOOST_UNORDERED_USE_MOVE : bmove_move ] [ run unordered/assign_tests.cpp : : - : BOOST_UNORDERED_USE_MOVE clang:"-Wno-self-assign-overloaded" + : BOOST_UNORDERED_USE_MOVE : bmove_assign ] ; @@ -98,7 +98,7 @@ test-suite unordered-exception : [ run exception/constructor_exception_tests.cpp framework ] [ run exception/copy_exception_tests.cpp framework ] - [ run exception/assign_exception_tests.cpp framework : : : clang:"-Wno-self-assign-overloaded" ] + [ run exception/assign_exception_tests.cpp framework ] [ run exception/move_assign_exception_tests.cpp framework ] [ run exception/insert_exception_tests.cpp framework ] [ run exception/erase_exception_tests.cpp framework ] diff --git a/test/exception/assign_exception_tests.cpp b/test/exception/assign_exception_tests.cpp index c62bf8ab..c036da52 100644 --- a/test/exception/assign_exception_tests.cpp +++ b/test/exception/assign_exception_tests.cpp @@ -13,6 +13,12 @@ #pragma warning(disable : 4512) // assignment operator could not be generated #endif +#if defined(__clang__) && defined(__has_warning) +#if __has_warning("-Wself-assign-overloaded") +#pragma clang diagnostic ignored "-Wself-assign-overloaded" +#endif +#endif + test::seed_t initialize_seed(12847); template struct self_assign_base : public test::exception_base diff --git a/test/unordered/assign_tests.cpp b/test/unordered/assign_tests.cpp index f3d633b0..23042b55 100644 --- a/test/unordered/assign_tests.cpp +++ b/test/unordered/assign_tests.cpp @@ -21,6 +21,12 @@ #pragma warning(disable : 4127) // conditional expression is constant #endif +#if defined(__clang__) && defined(__has_warning) +#if __has_warning("-Wself-assign-overloaded") +#pragma clang diagnostic ignored "-Wself-assign-overloaded" +#endif +#endif + namespace assign_tests { test::seed_t initialize_seed(96785);