On 3/17/20 9:46 AM, Martin Liška wrote:
Hi.
The patch is about better sanity check in option generation script.
Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
Ready to be installed in stage1?
@@ -72,6 +72,19 @@ 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 "Empty option argument '" name "' during parsing of: " flags >>
"/dev/stderr"
The script reports errors by emitting them as #error directives into
standard output (so they cause the build to fail). Should this new
routine do the same thing? (/dev/stderr is also not available on all
flavors of UNIX but I'm not sure how much that matters here.)
Martin
+ exit 1
+ }
+ return args
+}
Thanks,
Martin
gcc/ChangeLog:
2020-03-17 Martin Liska <mli...@suse.cz>
* opt-functions.awk (opt_args_non_empty): New function.
* opt-read.awk: Use the function for various option arguments.
---
gcc/opt-functions.awk | 13 +++++++++++++
gcc/opt-read.awk | 10 +++++-----
2 files changed, 18 insertions(+), 5 deletions(-)