summaryrefslogtreecommitdiff
path: root/gcc/opt-functions.awk
diff options
context:
space:
mode:
authorrwild <rwild@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-11 17:58:53 +0000
committerrwild <rwild@138bc75d-0d04-0410-961f-82ee72b054a4>2010-10-11 17:58:53 +0000
commitca40ed4b7391a303e3cee292e5e6fb65ac99933a (patch)
treee230e56a44ee4e614522f930110bcf311d7b7dd6 /gcc/opt-functions.awk
parent09a175857d1d874775dcd00100214ece4945d9bb (diff)
downloadgcc-ca40ed4b7391a303e3cee292e5e6fb65ac99933a.tar.gz
Fix PR bootstrap/35855: awk character classes.
gcc/: PR bootstrap/35855 * opt-functions.awk (BEGIN): New section. (lower, upper, digit, alnum): New variables. (static_var, opt_sanitized_name): Use alnum instead of character classes, for non-C locale. * optc-gen.awk: Likewise. * opth-gen.awk: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165322 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/opt-functions.awk')
-rw-r--r--gcc/opt-functions.awk12
1 files changed, 10 insertions, 2 deletions
diff --git a/gcc/opt-functions.awk b/gcc/opt-functions.awk
index 67d428a7d24..bd75b43410f 100644
--- a/gcc/opt-functions.awk
+++ b/gcc/opt-functions.awk
@@ -19,6 +19,14 @@
# Some common subroutines for use by opt[ch]-gen.awk.
+# Define some helpful character classes, for portability.
+BEGIN {
+ lower = "abcdefghijklmnopqrstuvwxyz"
+ upper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ digit = "0123456789"
+ alnum = lower "" upper "" digit
+}
+
# Return nonzero if FLAGS contains a flag matching REGEX.
function flag_set_p(regex, flags)
{
@@ -127,7 +135,7 @@ function static_var(name, flags)
{
if (global_state_p(flags) || !needs_state_p(flags))
return ""
- gsub ("[^A-Za-z0-9]", "_", name)
+ gsub ("[^" alnum "]", "_", name)
return "VAR_" name
}
@@ -204,7 +212,7 @@ function var_ref(name, flags)
# Given the option called NAME return a sanitized version of its name.
function opt_sanitized_name(name)
{
- gsub ("[^A-Za-z0-9]", "_", name)
+ gsub ("[^" alnum "]", "_", name)
return name
}