]>
Commit | Line | Data |
---|---|---|
a5544970 | 1 | # Copyright (C) 1997-2019 Free Software Foundation, Inc. |
a4d81081 JM |
2 | |
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 | |
cd976c16 | 5 | # the Free Software Foundation; either version 3 of the License, or |
a4d81081 JM |
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. | |
12 | # | |
13 | # You should have received a copy of the GNU General Public License | |
cd976c16 NC |
14 | # along with GCC; see the file COPYING3. If not see |
15 | # <http://www.gnu.org/licenses/>. | |
a4d81081 JM |
16 | |
17 | # Prune messages from gcc that aren't useful. | |
18 | ||
9e531d37 DM |
19 | load_lib multiline.exp |
20 | ||
559d990c MLI |
21 | if ![info exists TEST_ALWAYS_FLAGS] { |
22 | set TEST_ALWAYS_FLAGS "" | |
23 | } | |
56b61d7f | 24 | set TEST_ALWAYS_FLAGS "-fno-diagnostics-show-caret -fno-diagnostics-show-line-numbers -fdiagnostics-color=never $TEST_ALWAYS_FLAGS" |
9fec0042 | 25 | |
a4d81081 | 26 | proc prune_gcc_output { text } { |
d30fc980 JW |
27 | global srcdir |
28 | ||
a4d81081 JM |
29 | #send_user "Before:$text\n" |
30 | ||
ab6e54a6 DM |
31 | # Handle any freeform regexps. |
32 | set text [handle-dg-regexps $text] | |
33 | ||
678127a8 | 34 | regsub -all "(^|\n)(\[^\n\]*: \[iI\]|I)n ((static member |lambda )?function|member|method|(copy )?constructor|destructor|instantiation|substitution|program|subroutine|block-data)\[^\n\]*" $text "" text |
369dcbd9 | 35 | regsub -all "(^|\n)\[^\n\]*(: )?At (top level|global scope):\[^\n\]*" $text "" text |
3ff60975 | 36 | regsub -all "(^|\n)\[^\n\]*: (recursively )?required \[^\n\]*" $text "" text |
88274c4d | 37 | regsub -all "(^|\n)\[^\n\]*: . skipping \[0-9\]* instantiation contexts \[^\n\]*" $text "" text |
3e605b20 | 38 | regsub -all "(^|\n)\[^\n\]*: in constexpr expansion \[^\n\]*" $text "" text |
c94ed7a1 | 39 | regsub -all "(^|\n) inlined from \[^\n\]*" $text "" text |
9e350e99 | 40 | regsub -all "(^|\n)collect2: error: ld returned \[^\n\]*" $text "" text |
ab37d57e | 41 | regsub -all "(^|\n)collect: re(compiling|linking)\[^\n\]*" $text "" text |
c9342257 | 42 | regsub -all "(^|\n)Please submit.*instructions\[^\n\]*" $text "" text |
ab37d57e | 43 | regsub -all "(^|\n)\[0-9\]\[0-9\]* errors\." $text "" text |
07a0b324 | 44 | regsub -all "(^|\n)(In file included|\[ \]+from)\[^\n\]*" $text "" text |
a4d81081 | 45 | |
0dbe3777 JM |
46 | # Ignore informational notes. |
47 | regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text | |
48 | ||
d860bdd3 | 49 | # Ignore harmless -fpic warnings. |
617d988c | 50 | regsub -all "(^|\n)\[^\n\]*: warning: -f(pic|PIC) ignored for target\[^\n\]*" $text "" text |
d860bdd3 | 51 | regsub -all "(^|\n)\[^\n\]*: warning: -f(pic|PIC)( and -fpic are| is)? not supported\[^\n\]*" $text "" text |
617d988c | 52 | |
d62c1a1f AS |
53 | # Ignore errata warning from IA64 assembler. |
54 | regsub -all "(^|\n)\[^\n\]*: Additional NOP may be necessary to workaround Itanium processor A/B step errata" $text "" text | |
55 | regsub -all "(^|\n)\[^\n*\]*: Assembler messages:\[^\n\]*" $text "" text | |
56 | ||
ec8c3978 JJ |
57 | # Ignore harmless VTA note. |
58 | regsub -all "(^|\n)\[^\n\]*: note: variable tracking size limit exceeded with -fvar-tracking-assignments, retrying without\[^\n\]*" $text "" text | |
59 | ||
a4d81081 JM |
60 | # It would be nice to avoid passing anything to gcc that would cause it to |
61 | # issue these messages (since ignoring them seems like a hack on our part), | |
62 | # but that's too difficult in the general case. For example, sometimes | |
63 | # you need to use -B to point gcc at crt0.o, but there are some targets | |
64 | # that don't have crt0.o. | |
65 | regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $text "" text | |
66 | regsub -all "(^|\n)\[^\n\]*linker input file unused since linking not done" $text "" text | |
67 | ||
2f78283b JH |
68 | # Ignore harmless warnings from Xcode 3.2.x. |
69 | regsub -all "(^|\n)\[^\n\]*ld: warning: can't add line info to anonymous symbol\[^\n\]*" $text "" text | |
40c65b18 | 70 | regsub -all "(^|\n)\[^\n\]*warning: DWARFDebugInfoEntry::AppendDependants\[^\n\]*AT_\[^\n\]*FORM_ref4\[^\n\]*" $text "" text |
082b966f | 71 | regsub -all "(^|\n)\[^\n\]*warning:\[^\n\]*TAG_variable: AT_location\[^\n\]*didn't have valid function low pc\[^\n\]*" $text "" text |
5513ecd5 JH |
72 | |
73 | # Ignore harmless warnings from Xcode 4.0. | |
74 | regsub -all "(^|\n)\[^\n\]*ld: warning: could not create compact unwind for\[^\n\]*" $text "" text | |
75 | ||
9e531d37 DM |
76 | # Call into multiline.exp to handle any multiline output directives. |
77 | set text [handle-multiline-outputs $text] | |
78 | ||
4feb5dd8 MP |
79 | #send_user "After:$text\n" |
80 | ||
81 | return $text | |
82 | } | |
83 | ||
13f0e8c7 ZW |
84 | # escape metacharacters in literal string, so it can be used in regex |
85 | ||
86 | proc escape_regex_chars { line } { | |
87 | return [string map {"^" "\\^" | |
88 | "$" "\\$" | |
89 | "(" "\\(" | |
90 | ")" "\\)" | |
91 | "[" "\\[" | |
92 | "]" "\\]" | |
93 | "{" "\\{" | |
94 | "}" "\\}" | |
95 | "." "\\." | |
96 | "\\" "\\\\" | |
97 | "?" "\\?" | |
98 | "+" "\\+" | |
99 | "*" "\\*" | |
100 | "|" "\\|"} $line] | |
101 | } | |
102 | ||
4feb5dd8 MP |
103 | proc prune_file_path { text } { |
104 | global srcdir | |
105 | ||
13f0e8c7 ZW |
106 | set safedir [escape_regex_chars $srcdir] |
107 | regsub -all "$safedir\/" $text "" text | |
108 | ||
d30fc980 | 109 | # Truncate absolute file path into relative path. |
13f0e8c7 | 110 | set topdir "[file dirname [file dirname [file dirname $safedir]]]" |
d30fc980 JW |
111 | regsub -all "$topdir\/" $text "" text |
112 | ||
a4d81081 JM |
113 | return $text |
114 | } | |
115 | ||
116 | # Provide a definition of this if missing (delete after next dejagnu release). | |
117 | ||
118 | if { [info procs prune_warnings] == "" } then { | |
119 | proc prune_warnings { text } { | |
120 | return $text | |
121 | } | |
122 | } |