Commit | Line | Data |
---|---|---|
82704155 | 1 | # Copyright (C) 2018-2019 Free Software Foundation, Inc. |
af03af8f NC |
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; if not, write to the Free Software | |
15 | # Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. | |
16 | ||
17 | proc test_cxxfilt {options mangled_string demangled_string} { | |
18 | global CXXFILT | |
19 | global CXXFILTFLAGS | |
20 | ||
236f4ebe NC |
21 | if { [istarget "arm*-*-pe"] \ |
22 | || [istarget "cris*-*-*"] \ | |
23 | || [istarget "cr16-*-*"] \ | |
24 | || [istarget "crx*-*-*"] \ | |
25 | || [istarget "epiphany-*-*"] \ | |
26 | || [istarget "ip2k-*-*"] \ | |
27 | || [istarget "metag-*-*"] \ | |
28 | || [istarget "mn10200-*-*"] \ | |
29 | || [istarget "mn10300-*-*"] \ | |
30 | || [istarget "ns32k-*-*"] \ | |
31 | || [istarget "pdp11-*-*"] \ | |
32 | || [istarget "rl78-*-*"] \ | |
33 | || [istarget "rx-*-*"] \ | |
34 | || [istarget "sh-*-*"] \ | |
35 | || [istarget "tic4*-*-*"] \ | |
36 | || [istarget "tic54*-*-*"] \ | |
37 | || [istarget "v850-*-*"] \ | |
38 | || [istarget "z8k-*-*"] \ | |
39 | || [istarget "*-*-cygwin"] \ | |
40 | || [istarget "*-*-mingw32"] } then { | |
41 | set cxxfilt_strip_opt "--no-strip-underscore" | |
42 | } else { | |
43 | set cxxfilt_strip_opt "" | |
44 | } | |
45 | ||
af03af8f | 46 | set testname "cxxfilt: demangling $mangled_string" |
236f4ebe | 47 | set got [binutils_run $CXXFILT "$cxxfilt_strip_opt $options $CXXFILTFLAGS $mangled_string"] |
af03af8f NC |
48 | |
49 | if ![regexp $demangled_string $got] then { | |
50 | fail "$testname" | |
51 | verbose 0 "expected: $demangled_string" | |
52 | return | |
53 | } | |
54 | ||
55 | pass $testname | |
56 | } | |
57 | ||
58 | # Mangled and demangled strings stolen from libiberty/testsuite/demangle-expected. | |
59 | test_cxxfilt {} \ | |
236f4ebe NC |
60 | "_Z1fIvJiELb0EEvPDOT1_EFT_DpT0_E" \ |
61 | "void f.void, int, false.(void (.)(int) noexcept(false))*" | |
af03af8f | 62 | |
236f4ebe NC |
63 | test_cxxfilt {--format=gnu-v3} \ |
64 | "_Z14int_if_addableI1YERiP1AIXszpldecvPT_Li0EdecvS4_Li0EEE" \ | |
65 | "int& int_if_addable.Y.(A.sizeof ((.((Y.)(0))).(.((Y.)(0))))..)*" | |
af03af8f NC |
66 | |
67 | test_cxxfilt {--no-recurse-limit} \ | |
68 | "Z3fooiPiPS_PS0_PS1_PS2_PS3_PS4_PS5_PS6_PS7_PS8_PS9_PSA_PSB_PSC_" \ | |
69 | "foo(int, int., int.., int..., int...., int....., int......, int......., int........, int........., int.........., int..........., int............, int............., int.............., int...............)*" |