Re: [PATCH 3/6] Fortran: Ptype, print type extension.

Yao Qi
2017-08-07T12:08:46Z

Tim Wiederhake <tim.wiederhake@intel.com> writes:

> +static void
> +f_type_print_derivation_info (struct type *type, struct ui_file *stream)
> +{
> + /* Fortran doesn't support multiple inheritance. */
> + int i = 0;

Remove 'i'?

> +
> + if (TYPE_N_BASECLASSES (type) > 0)
> + fprintf_filtered (stream, ", extends(%s) ::",
> + type_name_no_tag (TYPE_BASECLASS (type, i)));
> +}
> +
> /* Print the name of the type (or the ultimate pointer target,
> function value or array element), or the description of a
> structure or union.

> diff --git a/gdb/testsuite/gdb.fortran/oop_extend_type.exp b/gdb/testsuite/gdb.fortran/oop_extend_type.exp
> index a880414..200ce7b 100644
> --- a/gdb/testsuite/gdb.fortran/oop_extend_type.exp
> +++ b/gdb/testsuite/gdb.fortran/oop_extend_type.exp
> @@ -50,11 +50,23 @@ gdb_test "p wp%point" " = \\( coo = \\(1, 2, 1\\) \\)"
> gdb_test "p wp" " = \\( point = \\( coo = \\(1, 2, 1\\) \\), angle = 100 \\)"
>
> gdb_test "whatis wp" "type = Type waypoint"
> -gdb_test "ptype wp" \
> - [multi_line "type = Type waypoint" \
> +set output_pass [multi_line "type = Type, extends\\(point\\) :: waypoint" \
> " Type point :: point" \
> " $real :: angle" \
> "End Type waypoint"]
> +set output_kfail [multi_line "type = Type waypoint" \
> + " Type point :: point" \
> + " $real :: angle" \
> + "End Type waypoint"]
> +set test "ptype wp"
> +gdb_test_multiple $test %test {
> + -re "$output_pass\r\n$gdb_prompt $" {
> + pass "$test"
> + }
> + -re "$output_kfail\r\n$gdb_prompt $" {
> + kfail "gcc/49475" "$test"

s/kfail/xfail/ because it is not an issue in GDB.

> + }
> +}
> set test "ptype wp%coo"
> gdb_test_multiple "$test" "$test" {
> -re "$real \\(3\\)\r\n$gdb_prompt $" {
> @@ -80,11 +92,15 @@ gdb_test "p wp_vla(1)%point" " = \\( coo = \\(10, 12, 10\\) \\)"
> gdb_test "p wp_vla(1)" " = \\( point = \\( coo = \\(10, 12, 10\\) \\), angle = 101 \\)"
>
> gdb_test "whatis wp_vla" "type = Type waypoint \\(3\\)"
> -gdb_test "ptype wp_vla" \
> - [multi_line "type = Type waypoint" \
> - " Type point :: point" \
> - " $real :: angle" \
> - "End Type waypoint \\(3\\)"]
> +set test "ptype wp_vla"
> +gdb_test_multiple $test %test {
> + -re "$output_pass \\(3\\)\r\n$gdb_prompt $" {
> + pass "$test"
> + }
> + -re "$output_kfail \\(3\\)\r\n$gdb_prompt $" {
> + kfail "gcc/49475" "$test"

Likewise.

> + }
> +}

Otherwise, patch is good to me.

--
Yao (齐尧)