mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-03-25 10:30:43 +08:00
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>
|
||||
|
||||
PR rtl-optimization/70429
|
||||
|
@ -78,12 +78,33 @@ proc prune_gcc_output { 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 } {
|
||||
global srcdir
|
||||
|
||||
set safedir [escape_regex_chars $srcdir]
|
||||
regsub -all "$safedir\/" $text "" text
|
||||
|
||||
# Truncate absolute file path into relative path.
|
||||
set topdir "[file dirname [file dirname [file dirname $srcdir]]]"
|
||||
regsub -all "$srcdir\/" $text "" text
|
||||
set topdir "[file dirname [file dirname [file dirname $safedir]]]"
|
||||
regsub -all "$topdir\/" $text "" text
|
||||
|
||||
return $text
|
||||
|
Loading…
x
Reference in New Issue
Block a user