Fix clang warnings about inconsistent missing "override" keyword
Add wxCLANG_WARNING_SUPPRESS() and wxCLANG_WARNING_RESTORE() and use them to suppress -Winconsistent-missing-override warnings. Closes https://github.com/wxWidgets/wxWidgets/pull/99
This commit is contained in:
commit
79f62505bb
@ -695,6 +695,29 @@ typedef short int WXTYPE;
|
||||
# define wxGCC_WARNING_RESTORE(x)
|
||||
#endif
|
||||
|
||||
/*
|
||||
Macros to suppress and restore clang warning only when it is valid.
|
||||
|
||||
Example:
|
||||
wxCLANG_WARNING_SUPPRESS(inconsistent-missing-override)
|
||||
virtual wxClassInfo *GetClassInfo() const
|
||||
wxCLANG_WARNING_RESTORE(inconsistent-missing-override)
|
||||
*/
|
||||
#if defined(__has_warning)
|
||||
# define wxCLANG_HAS_WARNING(x) __has_warning(x) /* allow macro expansion for the warning name */
|
||||
# define wxCLANG_IF_VALID_WARNING(x,y) \
|
||||
wxCONCAT(wxCLANG_IF_VALID_WARNING_,wxCLANG_HAS_WARNING(wxSTRINGIZE(wxCONCAT(-W,x))))(y)
|
||||
# define wxCLANG_IF_VALID_WARNING_0(x)
|
||||
# define wxCLANG_IF_VALID_WARNING_1(x) x
|
||||
# define wxCLANG_WARNING_SUPPRESS(x) \
|
||||
wxCLANG_IF_VALID_WARNING(x,wxGCC_WARNING_SUPPRESS(x))
|
||||
# define wxCLANG_WARNING_RESTORE(x) \
|
||||
wxCLANG_IF_VALID_WARNING(x,wxGCC_WARNING_RESTORE(x))
|
||||
#else
|
||||
# define wxCLANG_WARNING_SUPPRESS(x)
|
||||
# define wxCLANG_WARNING_RESTORE(x)
|
||||
#endif
|
||||
|
||||
/*
|
||||
Combination of the two variants above: should be used for deprecated
|
||||
functions which are defined inline and are used by wxWidgets itself.
|
||||
|
@ -103,11 +103,13 @@ protected:
|
||||
/// of the formatting dialog.
|
||||
|
||||
#define DECLARE_HELP_PROVISION() \
|
||||
wxCLANG_WARNING_SUPPRESS(inconsistent-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) \
|
||||
public: \
|
||||
static wxRichTextHelpInfo& GetHelpInfo() { return sm_helpInfo; }\
|
||||
protected: \
|
||||
|
@ -128,7 +128,9 @@ WXDLLIMPEXP_BASE wxObject *wxCreateDynamicObject(const wxString& name);
|
||||
#define wxDECLARE_ABSTRACT_CLASS(name) \
|
||||
public: \
|
||||
static wxClassInfo ms_classInfo; \
|
||||
virtual wxClassInfo *GetClassInfo() const
|
||||
wxCLANG_WARNING_SUPPRESS(inconsistent-missing-override) \
|
||||
virtual wxClassInfo *GetClassInfo() const \
|
||||
wxCLANG_WARNING_RESTORE(inconsistent-missing-override)
|
||||
|
||||
#define wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN(name) \
|
||||
wxDECLARE_NO_ASSIGN_CLASS(name); \
|
||||
|
Loading…
Reference in New Issue
Block a user