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.

From-SVN: r165322
This commit is contained in:
Ralf Wildenhues 2010-10-11 17:58:53 +00:00 committed by Ralf Wildenhues
parent fba42e243e
commit e4590d6388
4 changed files with 25 additions and 7 deletions

View File

@ -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.

View File

@ -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
}

View File

@ -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 ","
}

View File

@ -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 ")"
}