aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/lib
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2023-02-24 20:07:23 +0100
committerHans-Peter Nilsson <hp@bitrange.com>2023-03-07 01:12:16 +0100
commit82318c57607ca983742630c9884e5d30920a3ce1 (patch)
tree9d9cda75b800ac5957899f0ff8ed7a5d9dd8e0dd /gcc/testsuite/lib
parentdfb14cdd796ad9df6b5f2def047ef36b29385902 (diff)
downloadgcc-82318c57607ca983742630c9884e5d30920a3ce1.zip
gcc-82318c57607ca983742630c9884e5d30920a3ce1.tar.gz
gcc-82318c57607ca983742630c9884e5d30920a3ce1.tar.bz2
testsuite: Provide means to regexp in multiline patterns
Those multi-line-patterns are literal. Sometimes a regexp needs to be matched. This is a start: just three elements are supported: "(" ")" and the compound ")?" (and on second thought, it can be argued that "(...)" alone is not useful). Note that Tcl "string map" is documented to have the desired effect: a once-over but no re-recognitions of previously replaced mapped elements. Also, drop a doubled "containing". testsuite: * lib/multiline.exp (_build_multiline_regex): Map "{re:" to "(", similarly ")?" from ":re?}" and the same without question mark.
Diffstat (limited to 'gcc/testsuite/lib')
-rw-r--r--gcc/testsuite/lib/multiline.exp7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/testsuite/lib/multiline.exp b/gcc/testsuite/lib/multiline.exp
index cfd928f..73621a0 100644
--- a/gcc/testsuite/lib/multiline.exp
+++ b/gcc/testsuite/lib/multiline.exp
@@ -297,7 +297,7 @@ proc _get_lines { filename first_line last_line } {
# Convert $multiline from a list of strings to a multiline regex
# We need to support matching arbitrary followup text on each line,
-# to deal with comments containing containing DejaGnu directives.
+# to deal with comments containing DejaGnu directives.
proc _build_multiline_regex { multiline index } {
verbose "_build_multiline_regex: $multiline $index" 4
@@ -307,7 +307,10 @@ proc _build_multiline_regex { multiline index } {
verbose " line: $line" 4
# We need to escape "^" and other regexp metacharacters.
- set line [string map {"^" "\\^"
+ set line [string map {"\{re:" "("
+ ":re?\}" ")?"
+ ":re\}" ")"
+ "^" "\\^"
"(" "\\("
")" "\\)"
"[" "\\["