]>
Commit | Line | Data |
---|---|---|
f1208f9e DE |
1 | # This test code is part of GDB, the GNU debugger. |
2 | ||
3666a048 | 3 | # Copyright 2010-2021 Free Software Foundation, Inc. |
f1208f9e DE |
4 | # |
5 | # This program is free software; you can redistribute it and/or modify | |
6 | # it under the terms of the GNU General Public License as published by | |
7 | # the Free Software Foundation; either version 3 of the License, or | |
8 | # (at your option) any later version. | |
9 | # | |
10 | # This program is distributed in the hope that it will be useful, | |
11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | # GNU General Public License for more details. | |
14 | # | |
15 | # You should have received a copy of the GNU General Public License | |
16 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | ||
18 | # Auxiliary function to set the language to fortran. | |
19 | # The result is 1 (true) for success, 0 (false) for failure. | |
20 | ||
21 | proc set_lang_fortran {} { | |
22 | if [gdb_test_no_output "set language fortran"] { | |
23 | return 0 | |
24 | } | |
25 | if [gdb_test "show language" ".* source language is \"fortran\"." \ | |
26 | "set language to \"fortran\""] { | |
27 | return 0 | |
28 | } | |
ae59b1da | 29 | return 1 |
f1208f9e | 30 | } |
0c13f7e5 BH |
31 | |
32 | proc fortran_int4 {} { | |
33 | if {[test_compiler_info {gcc-4-[012]-*}]} { | |
34 | return "int4" | |
0a709cba | 35 | } elseif {[test_compiler_info {gcc-*}]} { |
0c13f7e5 | 36 | return "integer\\(kind=4\\)" |
0a709cba AKS |
37 | } elseif {[test_compiler_info {clang-*}]} { |
38 | return "integer" | |
0c13f7e5 BH |
39 | } elseif {[test_compiler_info {icc-*}]} { |
40 | return "INTEGER\\(4\\)" | |
41 | } else { | |
42 | return "unknown" | |
43 | } | |
44 | } | |
45 | ||
8077c50d TV |
46 | proc fortran_int8 {} { |
47 | if {[test_compiler_info {gcc-4-[012]-*}]} { | |
48 | return "int8" | |
0a709cba | 49 | } elseif {[test_compiler_info {gcc-*}]} { |
8077c50d | 50 | return "integer\\(kind=8\\)" |
0a709cba AKS |
51 | } elseif {[test_compiler_info {clang-*}]} { |
52 | return "integer*8" | |
8077c50d TV |
53 | } elseif {[test_compiler_info {icc-*}]} { |
54 | return "INTEGER\\(8\\)" | |
55 | } else { | |
56 | return "unknown" | |
57 | } | |
58 | } | |
59 | ||
0c13f7e5 BH |
60 | proc fortran_real4 {} { |
61 | if {[test_compiler_info {gcc-4-[012]-*}]} { | |
62 | return "real4" | |
0a709cba | 63 | } elseif {[test_compiler_info {gcc-*}]} { |
0c13f7e5 | 64 | return "real\\(kind=4\\)" |
0a709cba AKS |
65 | } elseif {[test_compiler_info {clang-*}]} { |
66 | return "real" | |
0c13f7e5 BH |
67 | } elseif {[test_compiler_info {icc-*}]} { |
68 | return "REAL\\(4\\)" | |
69 | } else { | |
70 | return "unknown" | |
71 | } | |
72 | } | |
73 | ||
74 | proc fortran_real8 {} { | |
75 | if {[test_compiler_info {gcc-4-[012]-*}]} { | |
76 | return "real8" | |
0a709cba | 77 | } elseif {[test_compiler_info {gcc-*}]} { |
0c13f7e5 | 78 | return "real\\(kind=8\\)" |
0a709cba AKS |
79 | } elseif {[test_compiler_info {clang-*}]} { |
80 | return "double precision" | |
0c13f7e5 BH |
81 | } elseif {[test_compiler_info {icc-*}]} { |
82 | return "REAL\\(8\\)" | |
83 | } else { | |
84 | return "unknown" | |
85 | } | |
86 | } | |
87 | ||
88 | proc fortran_complex4 {} { | |
89 | if {[test_compiler_info {gcc-4-[012]-*}]} { | |
90 | return "complex4" | |
0a709cba | 91 | } elseif {[test_compiler_info {gcc-*}]} { |
0c13f7e5 | 92 | return "complex\\(kind=4\\)" |
0a709cba AKS |
93 | } elseif {[test_compiler_info {clang-*}]} { |
94 | return "complex" | |
0c13f7e5 BH |
95 | } elseif {[test_compiler_info {icc-*}]} { |
96 | return "COMPLEX\\(4\\)" | |
97 | } else { | |
98 | return "unknown" | |
99 | } | |
100 | } | |
101 | ||
c5cd900e AKS |
102 | proc fortran_complex8 {} { |
103 | if {[test_compiler_info {gcc-4-[012]-*}]} { | |
104 | return "complex8" | |
105 | } elseif {[test_compiler_info {gcc-*}]} { | |
106 | return "complex\\(kind=8\\)" | |
107 | } elseif {[test_compiler_info {clang-*}]} { | |
108 | return "double complex" | |
109 | } elseif {[test_compiler_info {icc-*}]} { | |
110 | return "COMPLEX\\(8\\)" | |
111 | } else { | |
112 | return "unknown" | |
113 | } | |
114 | } | |
115 | ||
116 | proc fortran_complex16 {} { | |
117 | if {[test_compiler_info {gcc-4-[012]-*}]} { | |
118 | return "complex16" | |
119 | } elseif {[test_compiler_info {gcc-*}]} { | |
120 | return "complex\\(kind=16\\)" | |
121 | } elseif {[test_compiler_info {clang-*}]} { | |
122 | return "quad complex" | |
123 | } elseif {[test_compiler_info {icc-*}]} { | |
124 | return "COMPLEX\\(16\\)" | |
125 | } else { | |
126 | return "unknown" | |
127 | } | |
128 | } | |
129 | ||
0c13f7e5 BH |
130 | proc fortran_logical4 {} { |
131 | if {[test_compiler_info {gcc-4-[012]-*}]} { | |
132 | return "logical4" | |
0a709cba | 133 | } elseif {[test_compiler_info {gcc-*}]} { |
0c13f7e5 | 134 | return "logical\\(kind=4\\)" |
0a709cba AKS |
135 | } elseif {[test_compiler_info {clang-*}]} { |
136 | return "logical" | |
0c13f7e5 BH |
137 | } elseif {[test_compiler_info {icc-*}]} { |
138 | return "LOGICAL\\(4\\)" | |
139 | } else { | |
140 | return "unknown" | |
141 | } | |
142 | } | |
1f20c35e AB |
143 | |
144 | proc fortran_character1 {} { | |
145 | if {[test_compiler_info {gcc-4-[012]-*}]} { | |
146 | return "character1" | |
0a709cba | 147 | } elseif {[test_compiler_info {gcc-*}]} { |
1f20c35e | 148 | return "character\\(kind=1\\)" |
0a709cba AKS |
149 | } elseif {[test_compiler_info {clang-*}]} { |
150 | return "character" | |
1f20c35e AB |
151 | } elseif {[test_compiler_info {icc-*}]} { |
152 | return "CHARACTER\\(1\\)" | |
153 | } else { | |
154 | return "unknown" | |
155 | } | |
156 | } | |
86cd6bc8 AKS |
157 | |
158 | # Return name of the main procedure based on the compiler version. | |
159 | ||
160 | proc fortran_main {} { | |
161 | if {[test_compiler_info {gcc-4-[012]-*}] | |
162 | || [test_compiler_info {gcc-*}] | |
163 | || [test_compiler_info {icc-*}]} { | |
164 | return "MAIN__" | |
165 | } elseif {[test_compiler_info {clang-*}]} { | |
166 | return "MAIN_" | |
167 | } else { | |
168 | return "unknown" | |
169 | } | |
170 | } | |
171 | ||
172 | # Fortran version of runto_main. | |
173 | ||
174 | proc fortran_runto_main { } { | |
175 | return [runto [fortran_main]] | |
176 | } |