gdb.fortran: Allow Flang kind printing in fortran testing
[deliverable/binutils-gdb.git] / gdb / testsuite / lib / fortran.exp
CommitLineData
f1208f9e
DE
1# This test code is part of GDB, the GNU debugger.
2
b811d2c2 3# Copyright 2010-2020 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
21proc 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
32proc 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
46proc 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
60proc 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
74proc 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
88proc 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
102proc fortran_logical4 {} {
103 if {[test_compiler_info {gcc-4-[012]-*}]} {
104 return "logical4"
0a709cba 105 } elseif {[test_compiler_info {gcc-*}]} {
0c13f7e5 106 return "logical\\(kind=4\\)"
0a709cba
AKS
107 } elseif {[test_compiler_info {clang-*}]} {
108 return "logical"
0c13f7e5
BH
109 } elseif {[test_compiler_info {icc-*}]} {
110 return "LOGICAL\\(4\\)"
111 } else {
112 return "unknown"
113 }
114}
1f20c35e
AB
115
116proc fortran_character1 {} {
117 if {[test_compiler_info {gcc-4-[012]-*}]} {
118 return "character1"
0a709cba 119 } elseif {[test_compiler_info {gcc-*}]} {
1f20c35e 120 return "character\\(kind=1\\)"
0a709cba
AKS
121 } elseif {[test_compiler_info {clang-*}]} {
122 return "character"
1f20c35e
AB
123 } elseif {[test_compiler_info {icc-*}]} {
124 return "CHARACTER\\(1\\)"
125 } else {
126 return "unknown"
127 }
128}
This page took 1.076907 seconds and 4 git commands to generate.