diff --git a/include/wx/defs.h b/include/wx/defs.h index e25b1e8a52..804e828b74 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -708,6 +708,28 @@ typedef short int WXTYPE; # define wxCLANG_WARNING_RESTORE(x) #endif +/* + Specific macro for disabling warnings related to not using override: this + has to be done differently for gcc and clang and is only supported since + gcc 5.1. + */ +#if defined(__clang__) +# define wxWARNING_SUPPRESS_MISSING_OVERRIDE() \ + wxCLANG_WARNING_SUPPRESS(suggest-override) \ + wxCLANG_WARNING_SUPPRESS(inconsistent-missing-override) +# define wxWARNING_RESTORE_MISSING_OVERRIDE() \ + wxCLANG_WARNING_RESTORE(inconsistent-missing-override) \ + wxCLANG_WARNING_RESTORE(suggest-override) +#elif wxCHECK_GCC_VERSION(5, 1) +# define wxWARNING_SUPPRESS_MISSING_OVERRIDE() \ + wxGCC_WARNING_SUPPRESS(suggest-override) +# define wxWARNING_RESTORE_MISSING_OVERRIDE() \ + wxGCC_WARNING_RESTORE(suggest-override) +#else +# define wxWARNING_SUPPRESS_MISSING_OVERRIDE() +# define wxWARNING_RESTORE_MISSING_OVERRIDE() +#endif + /* Combination of the two variants above: should be used for deprecated functions which are defined inline and are used by wxWidgets itself. diff --git a/include/wx/event.h b/include/wx/event.h index 403fa26cf9..f4477868b1 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -4273,10 +4273,10 @@ typedef void (wxEvtHandler::*wxPressAndTapEventFunction)(wxPressAndTapEvent&); private: \ static const wxEventTableEntry sm_eventTableEntries[]; \ protected: \ - wxCLANG_WARNING_SUPPRESS(inconsistent-missing-override) \ + wxWARNING_SUPPRESS_MISSING_OVERRIDE() \ const wxEventTable* GetEventTable() const; \ wxEventHashTable& GetEventHashTable() const; \ - wxCLANG_WARNING_RESTORE(inconsistent-missing-override) \ + wxWARNING_RESTORE_MISSING_OVERRIDE() \ static const wxEventTable sm_eventTable; \ static wxEventHashTable sm_eventHashTable diff --git a/include/wx/richtext/richtextuicustomization.h b/include/wx/richtext/richtextuicustomization.h index 4d405bf6ff..381bb0a2a0 100644 --- a/include/wx/richtext/richtextuicustomization.h +++ b/include/wx/richtext/richtextuicustomization.h @@ -103,13 +103,13 @@ protected: /// of the formatting dialog. #define DECLARE_HELP_PROVISION() \ - wxCLANG_WARNING_SUPPRESS(inconsistent-missing-override) \ + wxWARNING_SUPPRESS_MISSING_OVERRIDE() \ virtual long GetHelpId() const { return sm_helpInfo.GetHelpId(); } \ virtual void SetHelpId(long id) { sm_helpInfo.SetHelpId(id); } \ virtual wxRichTextUICustomization* GetUICustomization() const { return sm_helpInfo.GetUICustomization(); } \ virtual void SetUICustomization(wxRichTextUICustomization* customization) { sm_helpInfo.SetUICustomization(customization); } \ virtual bool ShowHelp(wxWindow* win) { return sm_helpInfo.ShowHelp(win); } \ - wxCLANG_WARNING_RESTORE(inconsistent-missing-override) \ + wxWARNING_RESTORE_MISSING_OVERRIDE() \ public: \ static wxRichTextHelpInfo& GetHelpInfo() { return sm_helpInfo; }\ protected: \ diff --git a/include/wx/rtti.h b/include/wx/rtti.h index 55deaf301a..15e270d539 100644 --- a/include/wx/rtti.h +++ b/include/wx/rtti.h @@ -140,9 +140,9 @@ WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name); #define wxDECLARE_ABSTRACT_CLASS(name) \ public: \ static wxClassInfo ms_classInfo; \ - wxCLANG_WARNING_SUPPRESS(inconsistent-missing-override) \ - virtual wxClassInfo *GetClassInfo() const \ - wxCLANG_WARNING_RESTORE(inconsistent-missing-override) + wxWARNING_SUPPRESS_MISSING_OVERRIDE() \ + virtual wxClassInfo *GetClassInfo() const; \ + wxWARNING_RESTORE_MISSING_OVERRIDE() #define wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \ wxDECLARE_NO_ASSIGN_CLASS(name); \