From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id 107D4385801B; Tue, 26 Apr 2022 09:42:44 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 107D4385801B Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Martin Liska To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/marxin/heads/PR105355-joined-separate-opts)] opts: do not allow Separate+Joined ending with = X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/users/marxin/heads/PR105355-joined-separate-opts X-Git-Oldrev: 7d31c678d68d7b6820a958584619ca763b0eb9c5 X-Git-Newrev: 07729157ee62a5ac7b415e01250a21e3ed990198 Message-Id: <20220426094244.107D4385801B@sourceware.org> Date: Tue, 26 Apr 2022 09:42:44 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Apr 2022 09:42:44 -0000 https://gcc.gnu.org/g:07729157ee62a5ac7b415e01250a21e3ed990198 commit 07729157ee62a5ac7b415e01250a21e3ed990198 Author: Martin Liska 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 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