Work around -Wuggest-override for event table macros from gcc 11
Disabling -Wsuggest-override inside macros is broken in gcc, see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55578, and has started affecting wxWARNING_SUPPRESS_MISSING_OVERRIDE since gcc 11, i.e. this macro doesn't have any effect any more and the warning is still given. Avoid it by actually specifying "override" for gcc 11 (as doing it for all compilers would result in -Winconsistent-missing-override from clang) and check that we don't get this warning in the allheaders test. Also don't use wxDECLARE_ABSTRACT_CLASS() inside wxObject itself, now that it uses "override", which is not appropriate for the base class version. This is arguably more clear and should have been done like this since the beginning anyhow.
This commit is contained in:
@@ -387,6 +387,33 @@
|
||||
|
||||
#include "allheaders.h"
|
||||
|
||||
// Check that using wx macros doesn't result in -Wsuggest-override or
|
||||
// equivalent warnings in classes using and not using "override".
|
||||
struct Base : wxEvtHandler
|
||||
{
|
||||
virtual ~Base() { }
|
||||
|
||||
virtual void Foo() { }
|
||||
};
|
||||
|
||||
struct DerivedWithoutOverride : Base
|
||||
{
|
||||
void OnIdle(wxIdleEvent&) { }
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS_NO_COPY(DerivedWithoutOverride);
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
};
|
||||
|
||||
struct DerivedWithOverride : Base
|
||||
{
|
||||
virtual void Foo() wxOVERRIDE { }
|
||||
|
||||
void OnIdle(wxIdleEvent&) { }
|
||||
|
||||
wxDECLARE_DYNAMIC_CLASS_NO_COPY(DerivedWithOverride);
|
||||
wxDECLARE_EVENT_TABLE();
|
||||
};
|
||||
|
||||
#ifdef GCC_TURN_OFF
|
||||
// Just using REQUIRE() below triggers -Wparentheses, so avoid it.
|
||||
GCC_TURN_OFF(parentheses)
|
||||
|
Reference in New Issue
Block a user