]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/lib/scantree.exp
Update copyright years.
[thirdparty/gcc.git] / gcc / testsuite / lib / scantree.exp
CommitLineData
85ec4feb 1# Copyright (C) 2000-2018 Free Software Foundation, Inc.
6de9cd9a
DN
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
6de9cd9a
DN
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/>.
6de9cd9a
DN
16
17# Various utilities for scanning tree dump output, used by gcc-dg.exp and
18# g++-dg.exp.
9cb5fdd0
JC
19
20load_lib scandump.exp
6de9cd9a
DN
21
22# Utility for scanning compiler result, invoked via dg-final.
23# Call pass if pattern is present, otherwise fail.
24#
9cb5fdd0
JC
25# Argument 0 is the regexp to match
26# Argument 1 is the name of the dumped tree pass
6de9cd9a
DN
27# Argument 2 handles expected failures and the like
28proc scan-tree-dump { args } {
9cb5fdd0 29
6de9cd9a
DN
30 if { [llength $args] < 2 } {
31 error "scan-tree-dump: too few arguments"
9cb5fdd0 32 return
6de9cd9a
DN
33 }
34 if { [llength $args] > 3 } {
35 error "scan-tree-dump: too many arguments"
36 return
37 }
38 if { [llength $args] >= 3 } {
a4add13f 39 scan-dump "tree" [lindex $args 0] "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" [lindex $args 2]
6de9cd9a 40 } else {
a4add13f 41 scan-dump "tree" [lindex $args 0] "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]"
6de9cd9a
DN
42 }
43}
44
45# Call pass if pattern is present given number of times, otherwise fail.
9cb5fdd0 46# Argument 0 is the regexp to match
6de9cd9a 47# Argument 1 is number of times the regexp must be found
9cb5fdd0 48# Argument 2 is the name of the dumped tree pass
6de9cd9a
DN
49# Argument 3 handles expected failures and the like
50proc scan-tree-dump-times { args } {
9cb5fdd0 51
6de9cd9a
DN
52 if { [llength $args] < 3 } {
53 error "scan-tree-dump: too few arguments"
9cb5fdd0 54 return
6de9cd9a
DN
55 }
56 if { [llength $args] > 4 } {
57 error "scan-tree-dump: too many arguments"
58 return
59 }
60 if { [llength $args] >= 4 } {
9cb5fdd0 61 scan-dump-times "tree" [lindex $args 0] [lindex $args 1] \
a4add13f 62 "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 2]" [lindex $args 3]
6de9cd9a 63 } else {
9cb5fdd0 64 scan-dump-times "tree" [lindex $args 0] [lindex $args 1] \
a4add13f 65 "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 2]"
6de9cd9a
DN
66 }
67}
68
69# Call pass if pattern is not present, otherwise fail.
70#
9cb5fdd0
JC
71# Argument 0 is the regexp to match
72# Argument 1 is the name of the dumped tree pass
6de9cd9a
DN
73# Argument 2 handles expected failures and the like
74proc scan-tree-dump-not { args } {
9cb5fdd0 75
6de9cd9a
DN
76 if { [llength $args] < 2 } {
77 error "scan-tree-dump-not: too few arguments"
9cb5fdd0 78 return
6de9cd9a
DN
79 }
80 if { [llength $args] > 3 } {
81 error "scan-tree-dump-not: too many arguments"
82 return
83 }
84 if { [llength $args] >= 3 } {
9cb5fdd0 85 scan-dump-not "tree" [lindex $args 0] \
a4add13f 86 "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" [lindex $args 2]
6de9cd9a 87 } else {
9cb5fdd0 88 scan-dump-not "tree" [lindex $args 0] \
a4add13f 89 "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]"
6de9cd9a
DN
90 }
91}
92
93# Utility for scanning demangled compiler result, invoked via dg-final.
94# Call pass if pattern is present, otherwise fail.
95#
9cb5fdd0
JC
96# Argument 0 is the regexp to match
97# Argument 1 is the name of the dumped tree pass
6de9cd9a
DN
98# Argument 2 handles expected failures and the like
99proc scan-tree-dump-dem { args } {
6de9cd9a
DN
100
101 if { [llength $args] < 2 } {
102 error "scan-tree-dump-dem: too few arguments"
9cb5fdd0 103 return
6de9cd9a
DN
104 }
105 if { [llength $args] > 3 } {
106 error "scan-tree-dump-dem: too many arguments"
107 return
108 }
109 if { [llength $args] >= 3 } {
9cb5fdd0 110 scan-dump-dem "tree" [lindex $args 0] \
a4add13f 111 "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" [lindex $args 2]
6de9cd9a 112 } else {
9cb5fdd0 113 scan-dump-dem "tree" [lindex $args 0] \
a4add13f 114 "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]"
6de9cd9a
DN
115 }
116}
117
118# Call pass if demangled pattern is not present, otherwise fail.
119#
9cb5fdd0
JC
120# Argument 0 is the regexp to match
121# Argument 1 is the name of the dumped tree pass
6de9cd9a
DN
122# Argument 2 handles expected failures and the like
123proc scan-tree-dump-dem-not { args } {
6de9cd9a
DN
124
125 if { [llength $args] < 2 } {
126 error "scan-tree-dump-dem-not: too few arguments"
9cb5fdd0 127 return
6de9cd9a
DN
128 }
129 if { [llength $args] > 3 } {
130 error "scan-tree-dump-dem-not: too many arguments"
131 return
132 }
133 if { [llength $args] >= 3 } {
9cb5fdd0 134 scan-dump-dem-not "tree" [lindex $args 0] \
a4add13f 135 "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]" \
9cb5fdd0 136 [lindex $args 2]
6de9cd9a 137 } else {
9cb5fdd0 138 scan-dump-dem-not "tree" [lindex $args 0] \
a4add13f 139 "\[0-9\]\[0-9\]\[0-9\]t.[lindex $args 1]"
6de9cd9a
DN
140 }
141}