Debian Codegraph @

libstdc++-v3/testsuite/lib/prune.exp

raw
1 # Copyright (C) 1997-2025 Free Software Foundation, Inc.
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
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.
12 #
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/>.
16
17 # Prune messages from g++ that aren't useful.
18
19 # Prune any messages matching ARGS[1] (a regexp) from test output.
20 proc dg-prune-output { args } {
21 global additional_prunes
22
23 if { [llength $args] != 2 } {
24 error "[lindex $args 1]: need one argument"
25 return
26 }
27
28 lappend additional_prunes [lindex $args 1]
29 }
30
31 proc libstdc++-dg-prune { system text } {
32 global additional_prunes
33
34 # send_user "Before:$text\n"
35
36 if { [string match "*This header is not available in freestanding mode.*" $text] } {
37 return "::unsupported::hosted C++ headers not supported"
38 }
39
40 regsub -all "std::__8::" $text "std::" text
41
42 # Ignore caret diagnostics. Unfortunately dejaGNU trims leading
43 # spaces, so one cannot rely on them being present.
44 regsub -all "(^|\n)\[^\n\]+\n *\\^\n" $text "\n" text
45
46 # Cygwin warns about -ffunction-sections
47 regsub -all "(^|\n)\[^\n\]*: -ffunction-sections may affect debugging on some targets\[^\n\]*" $text "" text
48
49 # Remove parts of warnings that refer to location of previous
50 # definitions, etc as these confuse dejagnu
51 regsub -all "(^|\n)(\[^\n\]*: )?In ((static member |lambda )?function|member|method|(copy )?constructor|destructor|instantiation|substitution|program|subroutine|block-data)\[^\n\]*" $text "" text
52 regsub -all "(^|\n)\[^\n\]*(: )?At (top level|global scope):\[^\n\]*" $text "" text
53 regsub -all "(^|\n)\[^\n\]*: (recursively )?required \[^\n\]*" $text "" text
54 regsub -all "(^|\n)\[^\n\]*: . skipping \[0-9\]* instantiation contexts \[^\n\]*" $text "" text
55 regsub -all "(^|\n)\[^\n\]*: in .constexpr. expansion \[^\n\]*" $text "" text
56 regsub -all "(^|\n)\[^\n\]*: in requirements .with\[^\n\]*" $text "" text
57 regsub -all "(^|\n)\[^\n\]*: in requirements with\[^\n\]*" $text "" text
58 regsub -all "(^|\n) inlined from \[^\n\]*" $text "" text
59 # Why doesn't GCC need these to strip header context?
60 regsub -all "(^|\n)In file included from \[^\n\]*" $text "" text
61 regsub -all "(^|\n)\[ \t\]*from \[^\n\]*" $text "" text
62
63 # Ignore informational notes.
64 #TODO As this isn't even using 'gcc-dg.exp', cannot consider its
65 # 'variable prune_notes' (for 'dg-note') here.
66 regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text
67
68 # Ignore errata warning from IA64 assembler.
69 regsub -all "(^|\n)\[^\n\]*: Additional NOP may be necessary to workaround Itanium processor A/B step errata" $text "" text
70 regsub -all "(^|\n)\[^\n*\]*: Assembler messages:\[^\n\]*" $text "" text
71
72 # Ignore harmless warnings from Xcode 3.2.x.
73 regsub -all "(^|\n)\[^\n\]*ld: warning: can't add line info to anonymous symbol\[^\n\]*" $text "" text
74 regsub -all "(^|\n)\[^\n\]*warning: DWARFDebugInfoEntry::AppendDependants\[^\n\]*AT_\[^\n\]*_bound\[^\n\]*FORM_ref4\[^\n\]*" $text "" text
75 regsub -all "(^|\n)\[^\n\]*warning:\[^\n\]*TAG_variable: AT_location\[^\n\]*didn't have valid function low pc\[^\n\]*" $text "" text
76
77 # Ignore harmless warnings from Xcode 4+.
78 regsub -all "(^|\n)\[^\n\]*ld: warning: could not create compact unwind for\[^\n\]*" $text "" text
79
80 # Ignore duplicate path warnings from Xcode 16+.
81 regsub -all "(^|\n)\[^\n\]*ld: warning: duplicate -rpath\[^\n\]*" $text "" text
82
83 # Ignore dsymutil warning (tool bug is actually in the linker)
84 regsub -all "(^|\n)\[^\n\]*could not find object file symbol for symbol\[^\n\]*" $text "" text
85
86 # This pattern, except requiring a capitalized "In" and with a
87 # sub-pattern matching a subsequent line "is not implemented and will
88 # always fail", is part of the standard dejagnu prune_warnings function.
89 # There's also a separate single-line pattern pruning the "is not
90 # implemented and will always fail". Since that pattern is processed
91 # before this ${tool}-dg-prune function is called, we have to handle
92 # the single uncapitalized "in function" line.
93 regsub -all "(^|\n)\[^\n\]*: in function\[^\n\]*" $text "" text
94
95 # If exception handling is not supported, expectant tests are UNSUPPORTED.
96 if { ![check_effective_target_exceptions] } {
97 if [regexp "(^|\n)\[^\n\]*: sorry, unimplemented: exception handling not supported" $text] {
98 return "::unsupported::exception handling not supported"
99 }
100 }
101
102 # If exception handling is disabled, expectant tests are UNSUPPORTED.
103 if { ![check_effective_target_exceptions_enabled] } {
104 if [regexp "(^|\n)\[^\n\]*: error: exception handling disabled" $text] {
105 return "::unsupported::exception handling disabled"
106 }
107
108 if [regexp "(^|\n)\[^\n\]*: error: #error .__cpp_exceptions." $text] {
109 return "::unsupported::exception handling disabled"
110 }
111 }
112
113 # If dynamic stack allocation is not supported, expectant tests are UNSUPPORTED.
114 if { ![check_effective_target_alloca] } {
115 if [regexp "(^|\n)\[^\n\]*: sorry, unimplemented: dynamic stack allocation not supported" $text] {
116 return "::unsupported::dynamic stack allocation not supported"
117 }
118 }
119
120 foreach p $additional_prunes {
121 if { [string length $p] > 0 } {
122 # Following regexp matches a complete line containing $p.
123 regsub -all "(^|\n)\[^\n\]*$p\[^\n\]*" $text "" text
124 }
125 }
126
127 # send_user "After:$text\n"
128 return $text
129 }