Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.fortran / ptype-on-functions.exp
CommitLineData
88b9d363 1# Copyright 2019-2022 Free Software Foundation, Inc.
bf7a4de1
AB
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, see <http://www.gnu.org/licenses/>.
15
16# This file contains a test for printing the types of functions.
17
18if { [skip_fortran_tests] } { return -1 }
19
20standard_testfile .f90
21load_lib "fortran.exp"
22
23if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90}]} {
24 return -1
25}
26
86cd6bc8
AKS
27if ![fortran_runto_main] then {
28 perror "couldn't run to main"
bf7a4de1
AB
29 continue
30}
31
05b85772
BK
32set integer4 [fortran_int4]
33set logical4 [fortran_logical4]
34set integer8 [fortran_int8]
35
52e44e8d
TV
36# A fortran string parameter is passed as a char *, and an additional
37# argument str_ for the string length. The type used for the string length
38# argument is size_t, but for gcc 7 and earlier, the actual type is int
39# instead ( see
40# https://gcc.gnu.org/onlinedocs/gfortran/Argument-passing-conventions.html ).
41set stringlen ($integer8|$integer4)
42
05b85772
BK
43if {[test_compiler_info {clang-*}]} {
44 set some_module_class_type "Type number"
45 set some_module_aux_info ", $integer8 \\(10\\)"
46} else {
47 set some_module_class_type "Type __class_some_module_Number(_t)?"
48 set some_module_aux_info ""
49}
50
bf7a4de1 51gdb_test "ptype some_module::get_number" \
05b85772 52 "type = $integer4 \\(${some_module_class_type}${some_module_aux_info}\\)"
bf7a4de1
AB
53
54gdb_test "ptype some_module::set_number" \
05b85772 55 "type = void \\(${some_module_class_type}, $integer4${some_module_aux_info}\\)"
bf7a4de1
AB
56
57gdb_test "ptype is_bigger" \
05b85772 58 "type = $logical4 \\($integer4, $integer4\\)"
bf7a4de1
AB
59
60gdb_test "ptype say_numbers" \
05b85772
BK
61 "type = void \\($integer4, $integer4, $integer4\\)"
62
63set fun_ptr_arg "$integer4"
64if {[test_compiler_info {gcc-*}]} {
65 set fun_ptr_arg "REF TO -> \\( ${fun_ptr_arg} \\)"
66}
bf7a4de1
AB
67
68gdb_test "ptype fun_ptr" \
05b85772 69 "type = PTR TO -> \\( $integer4 \\(\\) \\(${fun_ptr_arg}\\) \\)"
3dcc261c
AB
70
71gdb_test "ptype say_string" \
52e44e8d 72 "type = void \\(character\[^,\]+, $stringlen\\)"
05b85772
BK
73
74set say_array_artificial_first_arg ""
75if {[test_compiler_info {clang-*}]} {
76 set say_array_artificial_first_arg "$integer8, "
77}
3dcc261c
AB
78
79gdb_test "ptype say_array" \
05b85772 80 "type = void \\(${say_array_artificial_first_arg}$integer4 \\(:,:\\)\\)"
This page took 0.34432 seconds and 4 git commands to generate.