diff --git a/include/wx/hashset.h b/include/wx/hashset.h index 38a65ab5f4..82e0d252f5 100644 --- a/include/wx/hashset.h +++ b/include/wx/hashset.h @@ -75,13 +75,13 @@ public: \ // the names of the hasher and comparator classes are interpreted as naming // the base class which is inaccessible. // The workaround is to prefix the class names with 'struct'; however, don't -// do this on MSVC because it causes a warning there if the class was -// declared as a 'class' rather than a 'struct' (and MSVC's std::unordered_set -// implementation does not suffer from the access problem). -#ifdef _MSC_VER -#define WX_MAYBE_PREFIX_WITH_STRUCT(STRUCTNAME) STRUCTNAME -#else +// do this unconditionally, as with other compilers (both MSVC and clang) +// doing it causes a warning if the class was declared as a 'class' rather than +// a 'struct'. +#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 7) #define WX_MAYBE_PREFIX_WITH_STRUCT(STRUCTNAME) struct STRUCTNAME +#else +#define WX_MAYBE_PREFIX_WITH_STRUCT(STRUCTNAME) STRUCTNAME #endif #define _WX_DECLARE_HASH_SET( KEY_T, HASH_T, KEY_EQ_T, PTROP, CLASSNAME, CLASSEXP ) \ 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