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/PR105355-joined-separate-opts)] opts: do not allow Separate+Joined ending with =
Date: Mon,  9 May 2022 08:54:19 +0000 (GMT)	[thread overview]
Message-ID: <20220509085419.99199385625F@sourceware.org> (raw)

https://gcc.gnu.org/g:895c28d593b3d67817932a8aae6c00bd3b2df17b

commit 895c28d593b3d67817932a8aae6c00bd3b2df17b
Author: Martin Liska <mliska@suse.cz>
Date:   Tue Apr 26 11:41:09 2022 +0200

    opts: do not allow Separate+Joined ending with =
    
    Do not allow strange option format:
    -msmall-data-limit= 11.
    
            PR target/105355
    
    gcc/c-family/ChangeLog:
    
            * c.opt: Remove Separate from -output-pch=.
    
    gcc/ChangeLog:
    
            * config/riscv/riscv.opt: Remove Separate from
            -msmall-data-limit=.
            * optc-gen.awk: Report error for the described situation.

Diff:
---
 gcc/c-family/c.opt         | 2 +-
 gcc/config/riscv/riscv.opt | 2 +-
 gcc/optc-gen.awk           | 7 +++++++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index 07da40ef43b..873461d1fee 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -136,7 +136,7 @@ C ObjC C++ ObjC++ Separate Alias(o)
 C ObjC C++ ObjC++ Joined Alias(o)
 
 -output-pch=
-C ObjC C++ ObjC++ Joined Separate
+C ObjC C++ ObjC++ Joined
 
 -pedantic
 C ObjC C++ ObjC++ Alias(pedantic)
diff --git a/gcc/config/riscv/riscv.opt b/gcc/config/riscv/riscv.opt
index 492aad12324..84c8cf5a2de 100644
--- a/gcc/config/riscv/riscv.opt
+++ b/gcc/config/riscv/riscv.opt
@@ -92,7 +92,7 @@ Target RejectNegative Joined Var(riscv_cpu_string)
 -mcpu=PROCESSOR	Use architecture of and optimize the output for PROCESSOR.
 
 msmall-data-limit=
-Target Joined Separate UInteger Var(g_switch_value) Init(8)
+Target Joined UInteger Var(g_switch_value) Init(8)
 -msmall-data-limit=N	Put global and static data smaller than <number> bytes into a special section (on some targets).
 
 msave-restore
diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
index b51688d284f..595d3cff677 100644
--- a/gcc/optc-gen.awk
+++ b/gcc/optc-gen.awk
@@ -342,6 +342,13 @@ for (i = 0; i < n_opts; i++) {
 	len = length (opts[i]);
 	enum = opt_enum(opts[i])
 
+	# Do not allow Joined and Separate properties if
+	# an options ends with '='.
+	if (flag_set_p("Joined", flags[i]) && flag_set_p("Separate", flags[i]) && opts[i] ~ "=$") {
+		print "#error Option '" opts[i] "' ending with '=' cannot have " \
+			"both Joined and Separate properties"
+	}
+
 	# If this switch takes joined arguments, back-chain all
 	# subsequent switches to it for which it is a prefix.  If
 	# a later switch S is a longer prefix of a switch T, T


             reply	other threads:[~2022-05-09  8:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-09  8:54 Martin Liska [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-05-09  8:57 Martin Liska
2022-05-09  8:56 Martin Liska
2022-04-26  9:42 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=20220509085419.99199385625F@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).