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'.
This commit is contained in:
Thomas Schwinge 2021-08-03 14:59:56 +02:00
parent 06870af3e4
commit c523051930

View File

@ -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 == "")
continue;
init = opt_args("Init", flags[i])
if (name == "") {
if (init != "")
print "#error " opts[i] " must specify Var to use Init"
continue;
}
if (init != "") {
if (name in var_init && var_init[name] != init)
print "#error multiple initializers for " name