From: Aldy Hernandez Date: Tue, 25 Apr 2023 08:10:39 +0000 (+0200) Subject: Remove default constructor to nan_state. X-Git-Tag: basepoints/gcc-15~9925 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a024ac7bca9b9de1d2e0c19d4bb11df293e27a7d;p=thirdparty%2Fgcc.git Remove default constructor to nan_state. I think it's best to specify the default behavior of nan_state, since it's not obvious that nan_state() defaults to TRUE. Also, this avoids the ugly nan_state(false, false) idiom. gcc/ChangeLog: * value-range.cc (frange::set): Adjust constructor. * value-range.h (nan_state::nan_state): Replace default constructor with one taking an argument. --- diff --git a/gcc/value-range.cc b/gcc/value-range.cc index 971624137275..26acba7b04bc 100644 --- a/gcc/value-range.cc +++ b/gcc/value-range.cc @@ -426,8 +426,7 @@ frange::set (tree type, const REAL_VALUE_TYPE &min, const REAL_VALUE_TYPE &max, value_range_kind kind) { - nan_state nan; - set (type, min, max, nan, kind); + set (type, min, max, nan_state (true), kind); } void diff --git a/gcc/value-range.h b/gcc/value-range.h index 33ef3b5b8d87..d2a275958c85 100644 --- a/gcc/value-range.h +++ b/gcc/value-range.h @@ -274,12 +274,12 @@ public: virtual void accept (const vrange_visitor &v) const override; }; -// The NAN state as an opaque object. The default constructor is +-NAN. +// The NAN state as an opaque object. class nan_state { public: - nan_state (); + nan_state (bool); nan_state (bool pos_nan, bool neg_nan); bool neg_p () const; bool pos_p () const; @@ -288,13 +288,14 @@ private: bool m_neg_nan; }; -// Default constructor initializing the object to +-NAN. +// Set NAN state to +-NAN if NAN_P is true. Otherwise set NAN state +// to false. inline -nan_state::nan_state () +nan_state::nan_state (bool nan_p) { - m_pos_nan = true; - m_neg_nan = true; + m_pos_nan = nan_p; + m_neg_nan = nan_p; } // Constructor initializing the object to +NAN if POS_NAN is set, -NAN