public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-2814] Sanity check that 'Init' doesn't appear without 'Var' in '*.opt' files
@ 2021-08-09 11:38 Thomas Schwinge
  0 siblings, 0 replies; only message in thread
From: Thomas Schwinge @ 2021-08-09 11:38 UTC (permalink / raw)
  To: gcc-cvs

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-08-09 11:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-09 11:38 [gcc r12-2814] Sanity check that 'Init' doesn't appear without 'Var' in '*.opt' files Thomas Schwinge

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).