From dcee3ce899e75e54ff3605e0f81530f874bcf699 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 4 Jan 2019 23:36:44 +0100 Subject: [PATCH] Suppress some harmless clang warnings in the test suite Use wxCLANG_WARNING_SUPPRESS() to avoid multiple warnings in CATCH headers as well as in some of our own tests. --- tests/arrays/arrays.cpp | 6 ++++++ tests/strings/vararg.cpp | 2 ++ tests/test.cpp | 2 ++ tests/uris/url.cpp | 2 ++ tests/weakref/weakref.cpp | 2 ++ 5 files changed, 14 insertions(+) diff --git a/tests/arrays/arrays.cpp b/tests/arrays/arrays.cpp index 24c887da8e..89f307cf43 100644 --- a/tests/arrays/arrays.cpp +++ b/tests/arrays/arrays.cpp @@ -364,12 +364,18 @@ void ArraysTestCase::wxStringArrayTest() a6.Add("Foo"); a6.Insert(a6[0], 1, 100); + // The whole point of this code is to test self-assignment, so suppress + // clang warning about it. + wxCLANG_WARNING_SUPPRESS(self-assign-overloaded) + wxArrayString a7; a7 = a7; CPPUNIT_ASSERT_EQUAL( 0, a7.size() ); a7.Add("Bar"); a7 = a7; CPPUNIT_ASSERT_EQUAL( 1, a7.size() ); + + wxCLANG_WARNING_RESTORE(self-assign-overloaded) } void ArraysTestCase::SortedArray() diff --git a/tests/strings/vararg.cpp b/tests/strings/vararg.cpp index b84b01ba3e..14eaa88333 100644 --- a/tests/strings/vararg.cpp +++ b/tests/strings/vararg.cpp @@ -135,7 +135,9 @@ void VarArgTestCase::CharPrintf() #ifdef _MSC_VER #pragma warning(disable:4309) // truncation of constant value #endif + wxCLANG_WARNING_SUPPRESS(constant-conversion) c = 240; + wxCLANG_WARNING_RESTORE(constant-conversion) #ifdef _MSC_VER #pragma warning(default:4309) #endif diff --git a/tests/test.cpp b/tests/test.cpp index fdb0ebf6e4..c291c878e8 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -21,6 +21,7 @@ // Suppress some warnings in catch_impl.hpp. wxCLANG_WARNING_SUPPRESS(missing-braces) wxCLANG_WARNING_SUPPRESS(logical-op-parentheses) +wxCLANG_WARNING_SUPPRESS(inconsistent-missing-override) // This file needs to get the CATCH definitions in addition to the usual // assertion macros declarations from catch.hpp included by testprec.h. @@ -30,6 +31,7 @@ wxCLANG_WARNING_SUPPRESS(logical-op-parentheses) wxCLANG_WARNING_RESTORE(missing-braces) wxCLANG_WARNING_RESTORE(logical-op-parentheses) +wxCLANG_WARNING_RESTORE(inconsistent-missing-override) // This probably could be done by predefining CLARA_CONFIG_MAIN, but at the // point where we are, just define this global variable manually. diff --git a/tests/uris/url.cpp b/tests/uris/url.cpp index dec56558bb..8fbb208927 100644 --- a/tests/uris/url.cpp +++ b/tests/uris/url.cpp @@ -123,7 +123,9 @@ void URLTestCase::CopyAndAssignment() CPPUNIT_ASSERT(url1 == url2); // assignment to self + wxCLANG_WARNING_SUPPRESS(self-assign-overloaded) url2 = url2; + wxCLANG_WARNING_RESTORE(self-assign-overloaded) // check for destructor (with base pointer!) puri = new wxURL(); diff --git a/tests/weakref/weakref.cpp b/tests/weakref/weakref.cpp index ce3f9de72d..5681a27163 100644 --- a/tests/weakref/weakref.cpp +++ b/tests/weakref/weakref.cpp @@ -133,7 +133,9 @@ void WeakRefTestCase::DeclareTest() wxWeakRef p; // Copying should be also OK + wxCLANG_WARNING_SUPPRESS(self-assign-overloaded) p = p; + wxCLANG_WARNING_RESTORE(self-assign-overloaded) // Assigning a raw pointer should cause compile error #ifdef TEST_INVALID_INCOMPLETE_WEAKREF