mirror of git://gcc.gnu.org/git/gcc.git
prune.exp (escape_regex_chars): New.
2016-03-29 Zachary T Welch <zwelch@codesourcery.com> * lib/prune.exp (escape_regex_chars): New. (prune_file_path): Update to quote metcharacters for regexp. From-SVN: r234533
This commit is contained in:
parent
f8a1abf8e3
commit
13f0e8c7e7
|
|
@ -1,3 +1,8 @@
|
||||||
|
2016-03-29 Zachary T Welch <zwelch@codesourcery.com>
|
||||||
|
|
||||||
|
* lib/prune.exp (escape_regex_chars): New.
|
||||||
|
(prune_file_path): Update to quote metcharacters for regexp.
|
||||||
|
|
||||||
2016-03-29 Jakub Jelinek <jakub@redhat.com>
|
2016-03-29 Jakub Jelinek <jakub@redhat.com>
|
||||||
|
|
||||||
PR rtl-optimization/70429
|
PR rtl-optimization/70429
|
||||||
|
|
|
||||||
|
|
@ -78,12 +78,33 @@ proc prune_gcc_output { text } {
|
||||||
return $text
|
return $text
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# escape metacharacters in literal string, so it can be used in regex
|
||||||
|
|
||||||
|
proc escape_regex_chars { line } {
|
||||||
|
return [string map {"^" "\\^"
|
||||||
|
"$" "\\$"
|
||||||
|
"(" "\\("
|
||||||
|
")" "\\)"
|
||||||
|
"[" "\\["
|
||||||
|
"]" "\\]"
|
||||||
|
"{" "\\{"
|
||||||
|
"}" "\\}"
|
||||||
|
"." "\\."
|
||||||
|
"\\" "\\\\"
|
||||||
|
"?" "\\?"
|
||||||
|
"+" "\\+"
|
||||||
|
"*" "\\*"
|
||||||
|
"|" "\\|"} $line]
|
||||||
|
}
|
||||||
|
|
||||||
proc prune_file_path { text } {
|
proc prune_file_path { text } {
|
||||||
global srcdir
|
global srcdir
|
||||||
|
|
||||||
|
set safedir [escape_regex_chars $srcdir]
|
||||||
|
regsub -all "$safedir\/" $text "" text
|
||||||
|
|
||||||
# Truncate absolute file path into relative path.
|
# Truncate absolute file path into relative path.
|
||||||
set topdir "[file dirname [file dirname [file dirname $srcdir]]]"
|
set topdir "[file dirname [file dirname [file dirname $safedir]]]"
|
||||||
regsub -all "$srcdir\/" $text "" text
|
|
||||||
regsub -all "$topdir\/" $text "" text
|
regsub -all "$topdir\/" $text "" text
|
||||||
|
|
||||||
return $text
|
return $text
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue