aboutsummaryrefslogtreecommitdiff
path: root/gcc/opt-functions.awk
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2020-05-05 16:13:46 +0200
committerMartin Liska <mliska@suse.cz>2020-05-05 16:13:46 +0200
commit2d8a60a63cafdd9930bdbfb2ec76c47d7d14cd45 (patch)
tree97f2d4fee31df31fd402980aca805bdab64a21e6 /gcc/opt-functions.awk
parent0f62caf58b5d11f375f789385d6d49891ebd9a94 (diff)
downloadgcc-2d8a60a63cafdd9930bdbfb2ec76c47d7d14cd45.zip
gcc-2d8a60a63cafdd9930bdbfb2ec76c47d7d14cd45.tar.gz
gcc-2d8a60a63cafdd9930bdbfb2ec76c47d7d14cd45.tar.bz2
optgen: make more sanity checks for enums.
* opt-functions.awk (opt_args_non_empty): New function. * opt-read.awk: Use the function for various option arguments.
Diffstat (limited to 'gcc/opt-functions.awk')
-rw-r--r--gcc/opt-functions.awk10
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/opt-functions.awk b/gcc/opt-functions.awk
index 2f0442d..b4952b8 100644
--- a/gcc/opt-functions.awk
+++ b/gcc/opt-functions.awk
@@ -72,6 +72,16 @@ function opt_args(name, flags)
return flags
}
+# If FLAGS contains a "NAME(...argument...)" flag, return the value
+# of the argument. Print error message otherwise.
+function opt_args_non_empty(name, flags, description)
+{
+ args = opt_args(name, flags)
+ if (args == "")
+ print "#error Empty option argument '" name "' during parsing of: " flags
+ return args
+}
+
# Return the Nth comma-separated element of S. Return the empty string
# if S does not contain N elements.
function nth_arg(n, s)