From 0cced058d8f23d5db707cd0f16684fb5ec1d05db Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sat, 12 Oct 2019 09:18:19 -0700 Subject: [PATCH] Fix linking when wxUSE_VALIDATORS==0 The changes from 25e9be6873 don't work, at least with GCC 9, as the compiler seems to be removing the definition of the wxDefaultValidator variable. --- include/wx/validate.h | 8 ++++---- src/common/validate.cpp | 7 ++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/include/wx/validate.h b/include/wx/validate.h index 4e6874e5ca..28fd6ea070 100644 --- a/include/wx/validate.h +++ b/include/wx/validate.h @@ -99,19 +99,19 @@ private: #define wxVALIDATOR_PARAM(val) val +extern WXDLLIMPEXP_DATA_CORE(const wxValidator) wxDefaultValidator; + #else // !wxUSE_VALIDATORS // wxWidgets is compiled without support for wxValidator, but we still // want to be able to pass wxDefaultValidator to the functions which take // a wxValidator parameter to avoid using "#if wxUSE_VALIDATORS" // everywhere - class WXDLLIMPEXP_FWD_CORE wxValidator; + class wxValidator { }; + #define wxDefaultValidator wxValidator() // this macro allows to avoid warnings about unused parameters when // wxUSE_VALIDATORS == 0 #define wxVALIDATOR_PARAM(val) #endif // wxUSE_VALIDATORS/!wxUSE_VALIDATORS -extern WXDLLIMPEXP_DATA_CORE(const wxValidator) wxDefaultValidator; - #endif // _WX_VALIDATE_H_ - diff --git a/src/common/validate.cpp b/src/common/validate.cpp index 4383a0dc67..de9ac9fabb 100644 --- a/src/common/validate.cpp +++ b/src/common/validate.cpp @@ -25,6 +25,8 @@ wxIMPLEMENT_DYNAMIC_CLASS(wxValidator, wxEvtHandler); +const wxValidator wxDefaultValidator; + // VZ: personally, I think true would be more appropriate - these bells are // _annoying_ bool wxValidator::ms_isSilent = false; @@ -37,10 +39,5 @@ wxValidator::wxValidator() wxValidator::~wxValidator() { } -#else - -class WXDLLIMPEXP_CORE wxValidator { }; #endif // wxUSE_VALIDATORS - -const wxValidator wxDefaultValidator;