From 6e949961efede83e430761ae214f500eb8ee3f6f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 19 Mar 2019 02:10:53 +0100 Subject: [PATCH 1/3] Detect wxNO_RTTI automatically for clang too This has been already done for gcc and MSVC, add clang-specific check as well. --- include/wx/platform.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/wx/platform.h b/include/wx/platform.h index 45bb9cc3aa..47c1c4778c 100644 --- a/include/wx/platform.h +++ b/include/wx/platform.h @@ -611,7 +611,11 @@ Only 4.3 defines __GXX_RTTI by default so its absence is not an indication of disabled RTTI with the previous versions. */ -# if wxCHECK_GCC_VERSION(4, 3) +# if defined(__clang__) +# if !__has_feature(cxx_rtti) +# define wxNO_RTTI +# endif +# elif wxCHECK_GCC_VERSION(4, 3) # ifndef __GXX_RTTI # define wxNO_RTTI # endif From 626a96058f9d4474d18336a449d2aac2fffe3088 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 19 Mar 2019 02:12:01 +0100 Subject: [PATCH 2/3] Fix clang -Winconsistent-missing-override when not using RTTI In this case wx-specific RTTI is used and GetWxTypeId() method was overridden without using wxOVERRIDE, which resulted in dozens of warnings for each translation unit. --- include/wx/typeinfo.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/wx/typeinfo.h b/include/wx/typeinfo.h index 14fb057fc9..c20106df30 100644 --- a/include/wx/typeinfo.h +++ b/include/wx/typeinfo.h @@ -106,7 +106,7 @@ typedef void (*wxTypeIdentifier)(); // WX_DECLARE_TYPEINFO() or WX_DECLARE_TYPEINFO_INLINE() however. #define _WX_DECLARE_TYPEINFO_CUSTOM(CLS, IDENTFUNC) \ public: \ - virtual wxTypeIdentifier GetWxTypeId() const \ + virtual wxTypeIdentifier GetWxTypeId() const wxOVERRIDE \ { \ return reinterpret_cast \ (&IDENTFUNC); \ From fc4242a906301ddbf0560454809672948a1a9836 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 19 Mar 2019 02:20:23 +0100 Subject: [PATCH 3/3] Add a hack to allow building wxGTK without RTTI Add a not really used, but required default ctor to fix compilation without RTTI. Closes #18364. --- src/generic/grideditors.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/generic/grideditors.cpp b/src/generic/grideditors.cpp index f8a3eb7871..8b1226a879 100644 --- a/src/generic/grideditors.cpp +++ b/src/generic/grideditors.cpp @@ -1750,6 +1750,15 @@ struct wxGridCellDateEditorKeyHandler } wxGridCellEditorEvtHandler* m_handler; + +#ifdef wxNO_RTTI + // wxEventFunctorFunction used when an object of this class is passed to + // Bind() must have a default ctor when using wx RTTI implementation (see + // see the comment before WX_DECLARE_TYPEINFO_INLINE() in wx/typeinfo.h) + // and this, in turn, requires a default ctor of this class -- which will + // never be actually used, but must nevertheless exist. + wxGridCellDateEditorKeyHandler() : m_handler(NULL) { } +#endif // wxNO_RTTI }; #endif // __WXGTK__