Merge from trunk
[official-gcc.git] / gcc / testsuite / lib / prune.exp
blobdfde204851c554ac66d200d6fbc880b6ed6d2ede
1 # Copyright (C) 1997-2015 Free Software Foundation, Inc.
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 3 of the License, or
6 # (at your option) any later version.
7 #
8 # This program is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
13 # You should have received a copy of the GNU General Public License
14 # along with GCC; see the file COPYING3. If not see
15 # <http://www.gnu.org/licenses/>.
17 # Prune messages from gcc that aren't useful.
19 if ![info exists TEST_ALWAYS_FLAGS] {
20 set TEST_ALWAYS_FLAGS ""
22 set TEST_ALWAYS_FLAGS "-fno-diagnostics-show-caret -fdiagnostics-color=never $TEST_ALWAYS_FLAGS"
24 proc prune_gcc_output { text } {
25 global srcdir
27 #send_user "Before:$text\n"
29 regsub -all "(^|\n)(\[^\n\]*: )?In ((static member |lambda )?function|member|method|(copy )?constructor|destructor|instantiation|substitution|program|subroutine|block-data)\[^\n\]*" $text "" text
30 regsub -all "(^|\n)\[^\n\]*(: )?At (top level|global scope):\[^\n\]*" $text "" text
31 regsub -all "(^|\n)\[^\n\]*: (recursively )?required \[^\n\]*" $text "" text
32 regsub -all "(^|\n)\[^\n\]*: . skipping \[0-9\]* instantiation contexts \[^\n\]*" $text "" text
33 regsub -all "(^|\n)\[^\n\]*: in constexpr expansion \[^\n\]*" $text "" text
34 regsub -all "(^|\n) inlined from \[^\n\]*" $text "" text
35 regsub -all "(^|\n)collect2: error: ld returned \[^\n\]*" $text "" text
36 regsub -all "(^|\n)collect: re(compiling|linking)\[^\n\]*" $text "" text
37 regsub -all "(^|\n)Please submit.*instructions\[^\n\]*" $text "" text
38 regsub -all "(^|\n)\[0-9\]\[0-9\]* errors\." $text "" text
39 regsub -all "(^|\n)(In file included|\[ \]+from)\[^\n\]*" $text "" text
41 # Ignore informational notes.
42 regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text
44 # Ignore harmless -fpic warnings.
45 regsub -all "(^|\n)\[^\n\]*: warning: -f(pic|PIC) ignored for target\[^\n\]*" $text "" text
46 regsub -all "(^|\n)\[^\n\]*: warning: -f(pic|PIC)( and -fpic are| is)? not supported\[^\n\]*" $text "" text
48 # Ignore errata warning from IA64 assembler.
49 regsub -all "(^|\n)\[^\n\]*: Additional NOP may be necessary to workaround Itanium processor A/B step errata" $text "" text
50 regsub -all "(^|\n)\[^\n*\]*: Assembler messages:\[^\n\]*" $text "" text
52 # Ignore harmless VTA note.
53 regsub -all "(^|\n)\[^\n\]*: note: variable tracking size limit exceeded with -fvar-tracking-assignments, retrying without\[^\n\]*" $text "" text
55 # It would be nice to avoid passing anything to gcc that would cause it to
56 # issue these messages (since ignoring them seems like a hack on our part),
57 # but that's too difficult in the general case. For example, sometimes
58 # you need to use -B to point gcc at crt0.o, but there are some targets
59 # that don't have crt0.o.
60 regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $text "" text
61 regsub -all "(^|\n)\[^\n\]*linker input file unused since linking not done" $text "" text
63 # Ignore harmless warnings from Xcode 3.2.x.
64 regsub -all "(^|\n)\[^\n\]*ld: warning: can't add line info to anonymous symbol\[^\n\]*" $text "" text
65 regsub -all "(^|\n)\[^\n\]*warning: DWARFDebugInfoEntry::AppendDependants\[^\n\]*AT_\[^\n\]*FORM_ref4\[^\n\]*" $text "" text
66 regsub -all "(^|\n)\[^\n\]*warning:\[^\n\]*TAG_variable: AT_location\[^\n\]*didn't have valid function low pc\[^\n\]*" $text "" text
68 # Ignore harmless warnings from Xcode 4.0.
69 regsub -all "(^|\n)\[^\n\]*ld: warning: could not create compact unwind for\[^\n\]*" $text "" text
71 #send_user "After:$text\n"
73 return $text
76 proc prune_file_path { text } {
77 global srcdir
79 # Truncate absolute file path into relative path.
80 set topdir "[file dirname [file dirname [file dirname $srcdir]]]"
81 # regsub -all "$srcdir\/" $text "" text
82 regsub -all "$topdir\/" $text "" text
84 return $text
87 # Provide a definition of this if missing (delete after next dejagnu release).
89 if { [info procs prune_warnings] == "" } then {
90 proc prune_warnings { text } {
91 return $text