1 # This test code is part of GDB, the GNU debugger.
3 # Copyright 2010-2022 Free Software Foundation, Inc.
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.
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.
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/>.
18 # Auxiliary function to set the language to fortran.
19 # The result is 1 (true) for success, 0 (false) for failure.
21 proc set_lang_fortran {} {
22 if [gdb_test_no_output "set language fortran"] {
25 if [gdb_test "show language" ".* source language is \"fortran\"." \
26 "set language to \"fortran\""] {
32 proc fortran_int4 {} {
33 if {[test_compiler_info {gcc-4-[012]-*}]} {
35 } elseif {[test_compiler_info {gcc-*}]} {
36 return "integer\\(kind=4\\)"
37 } elseif {[test_compiler_info {clang-*}]} {
39 } elseif {[test_compiler_info {icc-*}]} {
40 return "INTEGER\\(4\\)"
46 proc fortran_int8 {} {
47 if {[test_compiler_info {gcc-4-[012]-*}]} {
49 } elseif {[test_compiler_info {gcc-*}]} {
50 return "integer\\(kind=8\\)"
51 } elseif {[test_compiler_info {clang-*}]} {
53 } elseif {[test_compiler_info {icc-*}]} {
54 return "INTEGER\\(8\\)"
60 proc fortran_real4 {} {
61 if {[test_compiler_info {gcc-4-[012]-*}]} {
63 } elseif {[test_compiler_info {gcc-*}]} {
64 return "real\\(kind=4\\)"
65 } elseif {[test_compiler_info {clang-*}]} {
67 } elseif {[test_compiler_info {icc-*}]} {
74 proc fortran_real8 {} {
75 if {[test_compiler_info {gcc-4-[012]-*}]} {
77 } elseif {[test_compiler_info {gcc-*}]} {
78 return "real\\(kind=8\\)"
79 } elseif {[test_compiler_info {clang-*}]} {
80 return "double precision"
81 } elseif {[test_compiler_info {icc-*}]} {
88 proc fortran_complex4 {} {
89 if {[test_compiler_info {gcc-4-[012]-*}]} {
91 } elseif {[test_compiler_info {gcc-*}]} {
92 return "complex\\(kind=4\\)"
93 } elseif {[test_compiler_info {clang-*}]} {
95 } elseif {[test_compiler_info {icc-*}]} {
96 return "COMPLEX\\(4\\)"
102 proc fortran_complex8 {} {
103 if {[test_compiler_info {gcc-4-[012]-*}]} {
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\\)"
116 proc fortran_complex16 {} {
117 if {[test_compiler_info {gcc-4-[012]-*}]} {
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\\)"
130 proc fortran_logical4 {} {
131 if {[test_compiler_info {gcc-4-[012]-*}]} {
133 } elseif {[test_compiler_info {gcc-*}]} {
134 return "logical\\(kind=4\\)"
135 } elseif {[test_compiler_info {clang-*}]} {
137 } elseif {[test_compiler_info {icc-*}]} {
138 return "LOGICAL\\(4\\)"
144 proc fortran_character1 {} {
145 if {[test_compiler_info {gcc-4-[012]-*}]} {
147 } elseif {[test_compiler_info {gcc-*}]} {
148 return "character\\(kind=1\\)"
149 } elseif {[test_compiler_info {clang-*}]} {
151 } elseif {[test_compiler_info {icc-*}]} {
152 return "CHARACTER\\(1\\)"
158 # Return name of the main procedure based on the compiler version.
160 proc fortran_main {} {
161 if {[test_compiler_info {gcc-4-[012]-*}]
162 || [test_compiler_info {gcc-*}]
163 || [test_compiler_info {icc-*}]} {
165 } elseif {[test_compiler_info {clang-*}]} {
172 # Fortran version of runto_main.
174 proc fortran_runto_main { } {
175 return [runto [fortran_main]]