This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] *.exp: Robustify uses of regsub.
- From: Kazu Hirata <kazu at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 8 Sep 2006 10:48:14 -0700
- Subject: [patch] *.exp: Robustify uses of regsub.
Hi,
Attached is a patch to robustify uses of regsub.
While I was running dejagnu tests, I noticed that the lines with
regsub in the patch below caused an error. It turned out that the
name of my build directory contained '+', which caused $dir to contain
'+', which in turn confused regsub.
The patch fixes this problem by treating $dir as a literal. This way,
characters like '+' and '?' won't be treated as special characters.
Unfortunately, this patch loses '^', but I don't know how to express
that with "(?b)".
Tested by running dejagnu. OK to apply?
Kazu Hirata
2006-09-08 Kazu Hirata <kazu@codesourcery.com>
* lib/c-torture.exp (c-torture-compile, c-torture-execute):
Treat $srcdir as a literal.
* lib/fortran-torture.exp (fortran-torture-compile,
fortran-torture-execute): Likewise.
* lib/objc-torture.exp (objc-torture-compile,
objc-torture-execute): Likewise.
* lib/profopt.exp (profopt-execute): Likewise.
Index: lib/c-torture.exp
===================================================================
--- lib/c-torture.exp (revision 116750)
+++ lib/c-torture.exp (working copy)
@@ -65,7 +65,7 @@ proc c-torture-compile { src option } {
set output "$tmpdir/[file tail [file rootname $src]].o"
- regsub "^$srcdir/?" $src "" testcase
+ regsub "(?b)$srcdir/" $src "" testcase
# If we couldn't rip $srcdir out of `src' then just do the best we can.
# The point is to reduce the unnecessary noise in the logs. Don't strip
# out too much because different testcases with the same name can confuse
@@ -127,7 +127,7 @@ proc c-torture-execute { sources args }
set executable $tmpdir/[file tail [file rootname $src].x]
- regsub "^$srcdir/?" $src "" testcase
+ regsub "(?b)$srcdir/" $src "" testcase
# If we couldn't rip $srcdir out of `src' then just do the best we can.
# The point is to reduce the unnecessary noise in the logs. Don't strip
# out too much because different testcases with the same name can confuse
Index: lib/fortran-torture.exp
===================================================================
--- lib/fortran-torture.exp (revision 116750)
+++ lib/fortran-torture.exp (working copy)
@@ -54,7 +54,7 @@ proc fortran-torture-compile { src optio
set output "$tmpdir/[file tail [file rootname $src]].o"
- regsub "^$srcdir/?" $src "" testcase
+ regsub "(?b)$srcdir/" $src "" testcase
# If we couldn't rip $srcdir out of `src' then just do the best we can.
# The point is to reduce the unnecessary noise in the logs. Don't strip
@@ -152,7 +152,7 @@ proc fortran-torture-execute { src } {
# Setup the options for the testcase run.
set option_list $TORTURE_OPTIONS
set executable $tmpdir/[file tail [file rootname $src].x]
- regsub "^$srcdir/?" $src "" testcase
+ regsub "(?b)$srcdir/" $src "" testcase
# If we couldn't rip $srcdir out of `src' then just do the best we can.
# The point is to reduce the unnecessary noise in the logs. Don't strip
Index: lib/objc-torture.exp
===================================================================
--- lib/objc-torture.exp (revision 116750)
+++ lib/objc-torture.exp (working copy)
@@ -88,7 +88,7 @@ proc objc-torture-compile { src option }
set output "$tmpdir/[file tail [file rootname $src]].o"
- regsub "^$srcdir/?" $src "" testcase
+ regsub "(?b)$srcdir/" $src "" testcase
# If we couldn't rip $srcdir out of `src' then just do the best we can.
# The point is to reduce the unnecessary noise in the logs. Don't strip
# out too much because different testcases with the same name can confuse
@@ -146,7 +146,7 @@ proc objc-torture-execute { src args } {
set executable $tmpdir/[file tail [file rootname $src].x]
- regsub "^$srcdir/?" $src "" testcase
+ regsub "(?b)$srcdir/" $src "" testcase
# If we couldn't rip $srcdir out of `src' then just do the best we can.
# The point is to reduce the unnecessary noise in the logs. Don't strip
# out too much because different testcases with the same name can confuse
Index: lib/profopt.exp
===================================================================
--- lib/profopt.exp (revision 116750)
+++ lib/profopt.exp (working copy)
@@ -221,7 +221,7 @@ proc profopt-execute { src } {
error "No feedback option specified for second compile."
}
- regsub "^$srcdir/?" $src "" testcase
+ regsub "(?b)$srcdir/" $src "" testcase
# If we couldn't rip $srcdir out of `src' then just do the best we can.
# The point is to reduce the unnecessary noise in the logs. Don't strip
# out too much because different testcases with the same name can confuse