aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Schwinge <thomas@codesourcery.com>2021-08-03 14:59:56 +0200
committerThomas Schwinge <thomas@codesourcery.com>2021-08-09 13:38:14 +0200
commitc5230519305946338ddc7107ce45c740812142b4 (patch)
tree5af9afbfb8c76d4c3492bbb12bd74be6898923f3
parent06870af3e48daf523a973981f053ee5c6f44c871 (diff)
downloadgcc-c5230519305946338ddc7107ce45c740812142b4.zip
gcc-c5230519305946338ddc7107ce45c740812142b4.tar.gz
gcc-c5230519305946338ddc7107ce45c740812142b4.tar.bz2
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'.
-rw-r--r--gcc/optc-gen.awk8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk
index 880ac77..77e598e 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