From 5bebf7805afd3572ea136faa911bcb2cd5fd4bab Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Tue, 7 Feb 2023 14:47:37 +0300 Subject: [PATCH] Silenced clang warnings about self-assignment. --- test/path_test.cpp | 28 ++++++++++++++++++++++++++++ test/path_unit_test.cpp | 14 ++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/test/path_test.cpp b/test/path_test.cpp index 8067d60..cd35037 100644 --- a/test/path_test.cpp +++ b/test/path_test.cpp @@ -2420,6 +2420,14 @@ void concat_tests() // self_assign_append_concat_tests -------------------------------------------------// +#if defined(__clang__) && defined(__has_warning) +#if __has_warning("-Wself-assign-overloaded") +#pragma clang diagnostic push +// explicitly assigning value of variable of type 'boost::filesystem::path' to itself +#pragma clang diagnostic ignored "-Wself-assign-overloaded" +#endif +#endif + void self_assign_append_concat_tests() { std::cout << "self_assign_append_concat_tests..." << std::endl; @@ -2474,6 +2482,12 @@ void self_assign_append_concat_tests() PATH_TEST_EQ(p.concat(p.c_str() + 5, p.c_str() + 7), "snafubarba"); } +#if defined(__clang__) && defined(__has_warning) +#if __has_warning("-Wself-assign-overloaded") +#pragma clang diagnostic pop +#endif +#endif + // name_function_tests -------------------------------------------------------------// void name_function_tests() @@ -2812,6 +2826,14 @@ const boost::filesystem::path ticket_6690("test"); // #6690 another V++ st // // //--------------------------------------------------------------------------------------// +#if defined(__clang__) && defined(__has_warning) +#if __has_warning("-Wself-assign-overloaded") +#pragma clang diagnostic push +// explicitly assigning value of variable of type 'boost::filesystem::path' to itself +#pragma clang diagnostic ignored "-Wself-assign-overloaded" +#endif +#endif + int cpp_main(int, char*[]) { // The choice of platform is make at runtime rather than compile-time @@ -2903,3 +2925,9 @@ int cpp_main(int, char*[]) return ::boost::report_errors(); } + +#if defined(__clang__) && defined(__has_warning) +#if __has_warning("-Wself-assign-overloaded") +#pragma clang diagnostic pop +#endif +#endif diff --git a/test/path_unit_test.cpp b/test/path_unit_test.cpp index 56e332c..a6fc069 100644 --- a/test/path_unit_test.cpp +++ b/test/path_unit_test.cpp @@ -228,6 +228,14 @@ void test_constructors() path x; path y; +#if defined(__clang__) && defined(__has_warning) +#if __has_warning("-Wself-assign-overloaded") +#pragma clang diagnostic push +// explicitly assigning value of variable of type 'boost::filesystem::path' to itself +#pragma clang diagnostic ignored "-Wself-assign-overloaded" +#endif +#endif + // test_assignments ----------------------------------------------------------------// void test_assignments() @@ -439,6 +447,12 @@ void test_concats() PATH_IS(x, L"foo-x"); } +#if defined(__clang__) && defined(__has_warning) +#if __has_warning("-Wself-assign-overloaded") +#pragma clang diagnostic pop +#endif +#endif + // test_observers ------------------------------------------------------------------// void test_observers()