This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH][AArch64] Fix geniterators.sh to use standard BRE syntax in sed


GCC can be compiled for aarch64 target with busybox sed except for
the geniterators.sh script which uses nonstandard basic regex.

I explicitly set LC_ALL=C too because the regex depends on collation
order.

I tested that the script gives the same result on iterators.md.

Ok?

gcc/Changelog:

2015-03-23  Szabolcs Nagy  <szabolcs.nagy@arm.com>

	* config/aarch64/geniterators.sh: Use standard BRE in sed.
diff --git a/gcc/config/aarch64/geniterators.sh b/gcc/config/aarch64/geniterators.sh
index de9dfd2..f908e89 100644
--- a/gcc/config/aarch64/geniterators.sh
+++ b/gcc/config/aarch64/geniterators.sh
@@ -32,14 +32,15 @@ echo "#define GCC_AARCH64_ITERATORS_H"
 # which does not have a matching brace because it contains characters we
 # don't want to or can't handle (e.g P, PTR iterators change depending on
 # Pmode and ptr_mode).
+export LC_ALL=C
 cat $1 | tr "\n" " " \
        | sed 's/(define_mode_iterator \([A-Za-z0-9_]*\) \([]\[A-Z0-9 \t]*\)/\n#define BUILTIN_\1(T, N, MAP) \\ \2\n/g' \
        | grep '#define [A-Z0-9_(), \\]* \[[A-Z0-9[:space:]]*]' \
        | sed 's/\t//g' \
-       | sed 's/  \+/ /g' \
-       | sed 's/ \[\([A-Z0-9 ]*\)]/\n\L\1/' \
+       | sed 's/  */ /g' \
+       | sed 's/ \[\([A-Z0-9 ]*\)]/\n\1/' \
        | awk ' BEGIN { FS = " " ; OFS = ", "} \
 	       /#/ { print } \
-               ! /#/ { $1 = $1 ; printf "  VAR%d (T, N, MAP, %s)\n", NF, $0 }'
+               ! /#/ { $1 = $1 ; printf "  VAR%d (T, N, MAP, %s)\n", NF, tolower($0) }'
 
 echo "#endif /* GCC_AARCH64_ITERATORS_H  */"

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]