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:
Vadim Zeitlin
2021-04-25 18:16:29 +02:00
parent ccbf0b2f9a
commit 95c98a0b5f
5 changed files with 44 additions and 5 deletions

View File

@@ -140,7 +140,7 @@ WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name);
#define wxDECLARE_ABSTRACT_CLASS(name) \
public: \
wxWARNING_SUPPRESS_MISSING_OVERRIDE() \
virtual wxClassInfo *GetClassInfo() const; \
virtual wxClassInfo *GetClassInfo() const wxDUMMY_OVERRIDE; \
wxWARNING_RESTORE_MISSING_OVERRIDE() \
static wxClassInfo ms_classInfo