From: Bhuvanendra Kumar N Date: Mon, 28 Jun 2021 05:21:57 +0000 (+0530) Subject: gdb/fortran: Add type info of formal parameter for clang. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=05b857720611bc2e1f9cca2573085b774181af9d;p=binutils-gdb.git gdb/fortran: Add type info of formal parameter for clang. Additional compiler generated formal parameter exist with clang and type information for the same is added accordingly. Also few kind parameter printing are removed which is not default for clang. Note: More details about this kind parameter omission while printing can be found with similar patch commit 0a709cba00d36d490482d0e8673e323ac1e897a6 Author Alok Kumar Sharma (alokkumar.sharma@amd.com) gdb/testsuite/ChangeLog: * gdb.fortran/ptype-on-functions.exp: Add type info of formal parameter for clang. Also removed the kind parameter for clang. --- diff --git a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp index 14f522d6d42..75197952b6f 100644 --- a/gdb/testsuite/gdb.fortran/ptype-on-functions.exp +++ b/gdb/testsuite/gdb.fortran/ptype-on-functions.exp @@ -29,23 +29,45 @@ if ![fortran_runto_main] then { continue } +set integer4 [fortran_int4] +set logical4 [fortran_logical4] +set integer8 [fortran_int8] + +if {[test_compiler_info {clang-*}]} { + set some_module_class_type "Type number" + set some_module_aux_info ", $integer8 \\(10\\)" +} else { + set some_module_class_type "Type __class_some_module_Number(_t)?" + set some_module_aux_info "" +} + gdb_test "ptype some_module::get_number" \ - "type = integer\\(kind=4\\) \\(Type __class_some_module_Number(_t)?\\)" + "type = $integer4 \\(${some_module_class_type}${some_module_aux_info}\\)" gdb_test "ptype some_module::set_number" \ - "type = void \\(Type __class_some_module_Number(_t)?, integer\\(kind=4\\)\\)" + "type = void \\(${some_module_class_type}, $integer4${some_module_aux_info}\\)" gdb_test "ptype is_bigger" \ - "type = logical\\(kind=4\\) \\(integer\\(kind=4\\), integer\\(kind=4\\)\\)" + "type = $logical4 \\($integer4, $integer4\\)" gdb_test "ptype say_numbers" \ - "type = void \\(integer\\(kind=4\\), integer\\(kind=4\\), integer\\(kind=4\\)\\)" + "type = void \\($integer4, $integer4, $integer4\\)" + +set fun_ptr_arg "$integer4" +if {[test_compiler_info {gcc-*}]} { + set fun_ptr_arg "REF TO -> \\( ${fun_ptr_arg} \\)" +} gdb_test "ptype fun_ptr" \ - "type = PTR TO -> \\( integer\\(kind=4\\) \\(\\) \\(REF TO -> \\( integer\\(kind=4\\) \\)\\) \\)" + "type = PTR TO -> \\( $integer4 \\(\\) \\(${fun_ptr_arg}\\) \\)" gdb_test "ptype say_string" \ - "type = void \\(character\\*\\(\\*\\), integer\\(kind=\\d+\\)\\)" + "type = void \\(character\[^,\]+, $integer8\\)" + +set say_array_artificial_first_arg "" +if {[test_compiler_info {clang-*}]} { + set say_array_artificial_first_arg "$integer8, " +} gdb_test "ptype say_array" \ - "type = void \\(integer\\(kind=4\\) \\(:,:\\)\\)" + "type = void \\(${say_array_artificial_first_arg}$integer4 \\(:,:\\)\\)"