public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Aldy Hernandez <aldyh@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-214] Remove default constructor to nan_state. Date: Tue, 25 Apr 2023 10:09:01 +0000 (GMT) [thread overview] Message-ID: <20230425100901.782703858C27@sourceware.org> (raw) https://gcc.gnu.org/g:a024ac7bca9b9de1d2e0c19d4bb11df293e27a7d commit r14-214-ga024ac7bca9b9de1d2e0c19d4bb11df293e27a7d Author: Aldy Hernandez <aldyh@redhat.com> Date: Tue Apr 25 10:10:39 2023 +0200 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: --- gcc/value-range.cc | 3 +-- gcc/value-range.h | 13 +++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/gcc/value-range.cc b/gcc/value-range.cc index 97162413727..26acba7b04b 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 33ef3b5b8d8..d2a275958c8 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
reply other threads:[~2023-04-25 10:09 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230425100901.782703858C27@sourceware.org \ --to=aldyh@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).