]> Git Repo - binutils.git/blob - gdb/testsuite/lib/fortran.exp
Automatic date update in version.in
[binutils.git] / gdb / testsuite / lib / fortran.exp
1 # This test code is part of GDB, the GNU debugger.
2
3 # Copyright 2010-2022 Free Software Foundation, Inc.
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     }
29     return 1
30 }
31
32 proc fortran_int4 {} {
33     if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
34         return "int4"
35     } elseif {[test_compiler_info {gfortran-*} f90]} {
36         return "integer\\(kind=4\\)"
37     } elseif {[test_compiler_info {flang-*} f90]} {
38         return "integer"
39     } elseif {[test_compiler_info {ifort-*} f90]} {
40         return "INTEGER\\(4\\)"
41     } elseif {[test_compiler_info {ifx-*} f90]} {
42         return "INTEGER\\*4"
43     } else {
44         return "unknown"
45     }
46 }
47
48 proc fortran_int8 {} {
49     if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
50         return "int8"
51     } elseif {[test_compiler_info {gfortran-*} f90]} {
52         return "integer\\(kind=8\\)"
53     } elseif {[test_compiler_info {flang-*} f90]} {
54         return "integer\\*8"
55     } elseif {[test_compiler_info {ifort-*} f90]} {
56         return "INTEGER\\(8\\)"
57     } elseif {[test_compiler_info {ifx-*} f90]} {
58         return "INTEGER\\*8"
59     } else {
60         return "unknown"
61     }
62 }
63
64 proc fortran_real4 {} {
65     if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
66         return "real4"
67     } elseif {[test_compiler_info {gfortran-*} f90]} {
68         return "real\\(kind=4\\)"
69     } elseif {[test_compiler_info {flang-*} f90]} {
70         return "real"
71     } elseif {[test_compiler_info {ifort-*} f90]} {
72         return "REAL\\(4\\)"
73     } elseif {[test_compiler_info {ifx-*} f90]} {
74         return "REAL\\*4"
75     } else {
76         return "unknown"
77     }
78 }
79
80 proc fortran_real8 {} {
81     if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
82         return "real8"
83     } elseif {[test_compiler_info {gfortran-*} f90]} {
84         return "real\\(kind=8\\)"
85     } elseif {[test_compiler_info {flang-*} f90]} {
86         return "double precision"
87     } elseif {[test_compiler_info {ifort-*} f90]} {
88         return "REAL\\(8\\)"
89     } elseif {[test_compiler_info {ifx-*} f90]} {
90         return "REAL\\*8"
91     } else {
92         return "unknown"
93     }
94 }
95
96 proc fortran_complex4 {} {
97     if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
98         return "complex4"
99     } elseif {[test_compiler_info {gfortran-*} f90]} {
100         return "complex\\(kind=4\\)"
101     } elseif {[test_compiler_info {flang-*} f90]} {
102         return "complex"
103     } elseif {[test_compiler_info {ifort-*} f90]} {
104         return "COMPLEX\\(4\\)"
105     } elseif {[test_compiler_info {ifx-*} f90]} {
106         return "COMPLEX\\*8"
107     } else {
108         return "unknown"
109     }
110 }
111
112 proc fortran_complex8 {} {
113     if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
114         return "complex8"
115     } elseif {[test_compiler_info {gfortran-*} f90]} {
116         return "complex\\(kind=8\\)"
117     } elseif {[test_compiler_info {flang-*} f90]} {
118         return "double complex"
119     } elseif {[test_compiler_info {ifort-*} f90]} {
120         return "COMPLEX\\(8\\)"
121     } elseif {[test_compiler_info {ifx-*} f90]} {
122         return "COMPLEX\\*16"
123     } else {
124         return "unknown"
125     }
126 }
127
128 proc fortran_complex16 {} {
129     if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
130         return "complex16"
131     } elseif {[test_compiler_info {gfortran-*} f90]} {
132         return "complex\\(kind=16\\)"
133     } elseif {[test_compiler_info {flang-*} f90]} {
134         return "quad complex"
135     } elseif {[test_compiler_info {ifort-*} f90]} {
136         return "COMPLEX\\(16\\)"
137     } elseif {[test_compiler_info {ifx-*} f90]} {
138         return "COMPLEX\\*32"
139     } else {
140         return "unknown"
141     }
142 }
143
144 proc fortran_logical4 {} {
145     if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
146         return "logical4"
147     } elseif {[test_compiler_info {gfortran-*} f90]} {
148         return "logical\\(kind=4\\)"
149     } elseif {[test_compiler_info {flang-*} f90]} {
150         return "logical"
151     } elseif {[test_compiler_info {ifort-*} f90]} {
152         return "LOGICAL\\(4\\)"
153     } elseif {[test_compiler_info {ifx-*} f90]} {
154         return "LOGICAL\\*4"
155     } else {
156         return "unknown"
157     }
158 }
159
160 proc fortran_character1 {} {
161     if {[test_compiler_info {gfortran-4-[012]-*} f90]} {
162         return "character1"
163     } elseif {[test_compiler_info {gfortran-*} f90]} {
164         return "character\\(kind=1\\)"
165     } elseif {[test_compiler_info {flang-*} f90]} {
166         return "character"
167     } elseif {[test_compiler_info {ifort-*} f90]} {
168         return "CHARACTER\\(1\\)"
169     } elseif {[test_compiler_info {ifx-*} f90]} {
170         return "CHARACTER\\*1"
171     } else {
172         return "unknown"
173     }
174 }
175
176 # Return name of the main procedure based on the compiler version.
177
178 proc fortran_main {} {
179     if {[test_compiler_info {gfortran-*} f90]
180         || [test_compiler_info {ifort-*} f90]
181         || [test_compiler_info {ifx-*} f90]
182         || [test_compiler_info {flang-llvm-*} f90]} {
183         return "MAIN__"
184     } elseif {[test_compiler_info {flang-classic-*} f90]} {
185         return "MAIN_"
186     } else {
187         return "unknown"
188     }
189 }
190
191 # Fortran version of runto_main.
192
193 proc fortran_runto_main { } {
194     return [runto [fortran_main]]
195 }
This page took 0.035196 seconds and 4 git commands to generate.