[testsuite] Fix retrieval of testname
[official-gcc.git] / libstdc++-v3 / testsuite / lib / prune.exp
blob9160ed8f251afe57eb529c9bc08e20d1b5f9c25a
1 # Copyright (C) 1997-2017 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 this program; see the file COPYING3. If not see
15 # <http://www.gnu.org/licenses/>.
17 # Prune messages from g++ that aren't useful.
19 # Prune any messages matching ARGS[1] (a regexp) from test output.
20 proc dg-prune-output { args } {
21 global additional_prunes
23 if { [llength $args] != 2 } {
24 error "[lindex $args 1]: need one argument"
25 return
28 lappend additional_prunes [lindex $args 1]
31 proc libstdc++-dg-prune { system text } {
32 global additional_prunes
34 # send_user "Before:$text\n"
36 # Ignore caret diagnostics. Unfortunately dejaGNU trims leading
37 # spaces, so one cannot rely on them being present.
38 regsub -all "(^|\n)\[^\n\]+\n *\\^\n" $text "\n" text
40 # Cygwin warns about -ffunction-sections
41 regsub -all "(^|\n)\[^\n\]*: -ffunction-sections may affect debugging on some targets\[^\n\]*" $text "" text
43 # Remove parts of warnings that refer to location of previous
44 # definitions, etc as these confuse dejagnu
45 regsub -all "(^|\n)(\[^\n\]*: )?In ((static member |lambda )?function|member|method|(copy )?constructor|destructor|instantiation|substitution|program|subroutine|block-data)\[^\n\]*" $text "" text
46 regsub -all "(^|\n)\[^\n\]*(: )?At (top level|global scope):\[^\n\]*" $text "" text
47 regsub -all "(^|\n)\[^\n\]*: (recursively )?required \[^\n\]*" $text "" text
48 regsub -all "(^|\n)\[^\n\]*: . skipping \[0-9\]* instantiation contexts \[^\n\]*" $text "" text
49 regsub -all "(^|\n) inlined from \[^\n\]*" $text "" text
50 # Why doesn't GCC need these to strip header context?
51 regsub -all "(^|\n)In file included from \[^\n\]*" $text "" text
52 regsub -all "(^|\n)\[ \t\]*from \[^\n\]*" $text "" text
54 # Ignore informational notes.
55 regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text
57 # Ignore errata warning from IA64 assembler.
58 regsub -all "(^|\n)\[^\n\]*: Additional NOP may be necessary to workaround Itanium processor A/B step errata" $text "" text
59 regsub -all "(^|\n)\[^\n*\]*: Assembler messages:\[^\n\]*" $text "" text
61 # Ignore harmless warnings from Xcode 3.2.x.
62 regsub -all "(^|\n)\[^\n\]*ld: warning: can't add line info to anonymous symbol\[^\n\]*" $text "" text
63 regsub -all "(^|\n)\[^\n\]*warning: DWARFDebugInfoEntry::AppendDependants\[^\n\]*AT_\[^\n\]*_bound\[^\n\]*FORM_ref4\[^\n\]*" $text "" text
64 regsub -all "(^|\n)\[^\n\]*warning:\[^\n\]*TAG_variable: AT_location\[^\n\]*didn't have valid function low pc\[^\n\]*" $text "" text
66 # Ignore harmless warnings from Xcode 4.0.
67 regsub -all "(^|\n)\[^\n\]*ld: warning: could not create compact unwind for\[^\n\]*" $text "" text
69 foreach p $additional_prunes {
70 if { [string length $p] > 0 } {
71 # Following regexp matches a complete line containing $p.
72 regsub -all "(^|\n)\[^\n\]*$p\[^\n\]*" $text "" text
76 # send_user "After:$text\n"
77 return $text