public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r12-2814] Sanity check that 'Init' doesn't appear without 'Var' in '*.opt' files
Date: Mon,  9 Aug 2021 11:38:30 +0000 (GMT)	[thread overview]
Message-ID: <20210809113830.9A602389440A@sourceware.org> (raw)

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

commit r12-2814-gc5230519305946338ddc7107ce45c740812142b4
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Tue Aug 3 14:59:56 2021 +0200

    Sanity check that 'Init' doesn't appear without 'Var' in '*.opt' files
    
    ... as that doesn't make sense.
    
        @item Init(@var{value})
        The variable specified by the @code{Var} property should be statically
        initialized to @var{value}.  [...]
    
            gcc/
            * optc-gen.awk: Sanity check that 'Init' doesn't appear without
            'Var'.

Diff:
---
 gcc/optc-gen.awk | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
index 880ac776d8a..77e598efd60 100644
--- a/gcc/optc-gen.awk
+++ b/gcc/optc-gen.awk
@@ -195,10 +195,14 @@ for (i = 0; i < n_extra_vars; i++) {
 }
 for (i = 0; i < n_opts; i++) {
 	name = var_name(flags[i]);
-	if (name == "")
+	init = opt_args("Init", flags[i])
+
+	if (name == "") {
+		if (init != "")
+		    print "#error " opts[i] " must specify Var to use Init"
 		continue;
+	}
 
-	init = opt_args("Init", flags[i])
 	if (init != "") {
 		if (name in var_init && var_init[name] != init)
 			print "#error multiple initializers for " name


                 reply	other threads:[~2021-08-09 11:38 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=20210809113830.9A602389440A@sourceware.org \
    --to=tschwinge@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).