From f7514dc79d5ad2f3e2f4a89b6d834e14fddb4b8b Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 20 Nov 2018 14:11:53 +0100 Subject: [PATCH] Suppress harmless gcc -Wfloat-equal in wxNumValidator code Exact comparison with 0 here is fine, so just disable the warning for this code. Closes #18271. --- include/wx/valnum.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/wx/valnum.h b/include/wx/valnum.h index 3f9be1d99c..2e05bc6b15 100644 --- a/include/wx/valnum.h +++ b/include/wx/valnum.h @@ -228,10 +228,16 @@ private: // wxNUM_VAL_ZERO_AS_BLANK flag. wxString NormalizeValue(LongestValueType value) const { + // We really want to compare with the exact 0 here, so disable gcc + // warning about doing this. + wxGCC_WARNING_SUPPRESS(float-equal) + wxString s; if ( value != 0 || !BaseValidator::HasFlag(wxNUM_VAL_ZERO_AS_BLANK) ) s = this->ToString(value); + wxGCC_WARNING_RESTORE(float-equal) + return s; }