public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Martin Liska <marxin@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc(refs/users/marxin/heads/PR103438-fix--help-Q-output)] Fix --help -Q output
Date: Mon, 29 Nov 2021 13:47:53 +0000 (GMT)	[thread overview]
Message-ID: <20211129134753.2A7C43857C6F@sourceware.org> (raw)

https://gcc.gnu.org/g:ef0060013b0cc142672b033f0e3808efdac565a1

commit ef0060013b0cc142672b033f0e3808efdac565a1
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Nov 29 14:46:47 2021 +0100

    Fix --help -Q output
    
            PR middle-end/103438
    
    gcc/ChangeLog:
    
            * opts-common.c (option_enabled): Return flag_var for BOOLEAN
            types (the can contain an unknown value -1).

Diff:
---
 gcc/opts-common.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/gcc/opts-common.c b/gcc/opts-common.c
index 9d1914ff2ff..c4a19b9a0b6 100644
--- a/gcc/opts-common.c
+++ b/gcc/opts-common.c
@@ -1586,7 +1586,8 @@ option_flag_var (int opt_index, struct gcc_options *opts)
 }
 
 /* Return 1 if option OPT_IDX is enabled in OPTS, 0 if it is disabled,
-   or -1 if it isn't a simple on-off switch.  */
+   or -1 if it isn't a simple on-off switch (or if the value is unknown,
+   typically set later in target).  */
 
 int
 option_enabled (int opt_idx, unsigned lang_mask, void *opts)
@@ -1608,9 +1609,9 @@ option_enabled (int opt_idx, unsigned lang_mask, void *opts)
       {
       case CLVC_BOOLEAN:
 	if (option->cl_host_wide_int)
-	  return *(HOST_WIDE_INT *) flag_var != 0;
+	  return *(HOST_WIDE_INT *) flag_var;
 	else
-	  return *(int *) flag_var != 0;
+	  return *(int *) flag_var;
 
       case CLVC_EQUAL:
 	if (option->cl_host_wide_int)


             reply	other threads:[~2021-11-29 13:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-29 13:47 Martin Liska [this message]
2021-12-02 14:10 Martin Liska
2021-12-02 14:27 Martin Liska

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=20211129134753.2A7C43857C6F@sourceware.org \
    --to=marxin@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: link
Be 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).