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.
This commit is contained in:
@@ -228,10 +228,16 @@ private:
|
|||||||
// wxNUM_VAL_ZERO_AS_BLANK flag.
|
// wxNUM_VAL_ZERO_AS_BLANK flag.
|
||||||
wxString NormalizeValue(LongestValueType value) const
|
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;
|
wxString s;
|
||||||
if ( value != 0 || !BaseValidator::HasFlag(wxNUM_VAL_ZERO_AS_BLANK) )
|
if ( value != 0 || !BaseValidator::HasFlag(wxNUM_VAL_ZERO_AS_BLANK) )
|
||||||
s = this->ToString(value);
|
s = this->ToString(value);
|
||||||
|
|
||||||
|
wxGCC_WARNING_RESTORE(float-equal)
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user