summaryrefslogtreecommitdiff
path: root/gcc/testsuite/lib/prune.exp
blob: 5a835098e2599ddb916bb473f6c28ffa213e58b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#   Copyright (C) 1997, 1999, 2000, 2002, 2004, 2007, 2008
#   Free Software Foundation, Inc.

# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with GCC; see the file COPYING3.  If not see
# <http://www.gnu.org/licenses/>.

# Prune messages from gcc that aren't useful.

proc prune_gcc_output { text } {
    #send_user "Before:$text\n"

    regsub -all "(^|\n)(\[^\n\]*: )?In ((static member )?function|member|method|(copy )?constructor|destructor|instantiation|program|subroutine|block-data) \[^\n\]*" $text "" text
    regsub -all "(^|\n)\[^\n\]*(: )?At (top level|global scope):\[^\n\]*" $text "" text
    regsub -all "(^|\n)\[^\n\]*:   instantiated from \[^\n\]*" $text "" text
    regsub -all "(^|\n)    inlined from \[^\n\]*" $text "" text
    regsub -all "(^|\n)collect2: ld returned \[^\n\]*" $text "" text
    regsub -all "(^|\n)collect: re(compiling|linking)\[^\n\]*" $text "" text
    regsub -all "(^|\n)Please submit.*instructions\[^\n\]*" $text "" text
    regsub -all "(^|\n)\[0-9\]\[0-9\]* errors\." $text "" text

    # Ignore harmless -fpic warnings.
    regsub -all "(^|\n)\[^\n\]*: warning: -f(pic|PIC) ignored for target\[^\n\]*" $text "" text
    regsub -all "(^|\n)\[^\n\]*: warning: -f(pic|PIC)( and -fpic are| is)? not supported\[^\n\]*" $text "" text

    # Ignore errata warning from IA64 assembler.
    regsub -all "(^|\n)\[^\n\]*: Additional NOP may be necessary to workaround Itanium processor A/B step errata" $text "" text
    regsub -all "(^|\n)\[^\n*\]*: Assembler messages:\[^\n\]*" $text "" text

    # It would be nice to avoid passing anything to gcc that would cause it to
    # issue these messages (since ignoring them seems like a hack on our part),
    # but that's too difficult in the general case.  For example, sometimes
    # you need to use -B to point gcc at crt0.o, but there are some targets
    # that don't have crt0.o.
    regsub -all "(^|\n)\[^\n\]*file path prefix \[^\n\]* never used" $text "" text
    regsub -all "(^|\n)\[^\n\]*linker input file unused since linking not done" $text "" text

    #send_user "After:$text\n"

    return $text
}

# Provide a definition of this if missing (delete after next dejagnu release).

if { [info procs prune_warnings] == "" } then {
    proc prune_warnings { text } {
	return $text
    }
}