diff options
author | rwild <rwild@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-11 17:58:53 +0000 |
---|---|---|
committer | rwild <rwild@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-11 17:58:53 +0000 |
commit | ca40ed4b7391a303e3cee292e5e6fb65ac99933a (patch) | |
tree | e230e56a44ee4e614522f930110bcf311d7b7dd6 | |
parent | 09a175857d1d874775dcd00100214ece4945d9bb (diff) | |
download | gcc-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
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/opt-functions.awk | 12 | ||||
-rw-r--r-- | gcc/optc-gen.awk | 2 | ||||
-rw-r--r-- | gcc/opth-gen.awk | 8 |
4 files changed, 25 insertions, 7 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c9501f4a14e..d7f8da4e32b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2010-10-11 Ralf Wildenhues <Ralf.Wildenhues@gmx.de> + + 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. + 2010-10-11 Anatoly Sokolov <aesok@post.ru> * target.def (preferred_reload_class): New hook. 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 } diff --git a/gcc/optc-gen.awk b/gcc/optc-gen.awk index ba2238aeebf..fbe8007c8a2 100644 --- a/gcc/optc-gen.awk +++ b/gcc/optc-gen.awk @@ -145,7 +145,7 @@ print "" print "const char * const lang_names[] =\n{" for (i = 0; i < n_langs; i++) { macros[i] = "CL_" langs[i] - gsub( "[^A-Za-z0-9_]", "X", macros[i] ) + gsub( "[^" alnum "_]", "X", macros[i] ) s = substr(" ", length (macros[i])) print " " quote langs[i] quote "," } diff --git a/gcc/opth-gen.awk b/gcc/opth-gen.awk index 789f9bf3486..240bc2c5cc9 100644 --- a/gcc/opth-gen.awk +++ b/gcc/opth-gen.awk @@ -208,13 +208,13 @@ n_target_int = 0; n_target_other = 0; for (i = 0; i < n_target_save; i++) { - if (target_save_decl[i] ~ "^((un)?signed +)?int +[_a-zA-Z0-9]+$") + if (target_save_decl[i] ~ "^((un)?signed +)?int +[_" alnum "]+$") var_target_int[n_target_int++] = target_save_decl[i]; - else if (target_save_decl[i] ~ "^((un)?signed +)?short +[_a-zA-Z0-9]+$") + else if (target_save_decl[i] ~ "^((un)?signed +)?short +[_" alnum "]+$") var_target_short[n_target_short++] = target_save_decl[i]; - else if (target_save_decl[i] ~ "^((un)?signed +)?char +[_a-zA-Z0-9]+$") + else if (target_save_decl[i] ~ "^((un)?signed +)?char +[_ " alnum "]+$") var_target_char[n_target_char++] = target_save_decl[i]; else @@ -352,7 +352,7 @@ print "" for (i = 0; i < n_langs; i++) { macros[i] = "CL_" langs[i] - gsub( "[^A-Za-z0-9_]", "X", macros[i] ) + gsub( "[^" alnum "_]", "X", macros[i] ) s = substr(" ", length (macros[i])) print "#define " macros[i] s " (1 << " i ")" } |