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.
This commit is contained in:
Vadim Zeitlin 2019-01-04 23:36:44 +01:00
parent 659ab78c6d
commit dcee3ce899
5 changed files with 14 additions and 0 deletions

View File

@ -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()

View File

@ -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

View File

@ -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.

View File

@ -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();

View File

@ -133,7 +133,9 @@ void WeakRefTestCase::DeclareTest()
wxWeakRef<IncompleteClass> 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