This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [rfc] Ada simplification: desc_data_type
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Ulrich Weigand <uweigand at de dot ibm dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 15 May 2009 17:01:33 +0200
- Subject: Re: [rfc] Ada simplification: desc_data_type
- References: <200905141137.n4EBbSwM004281@d12av02.megacenter.de.ibm.com>
> * ada-lang.c (desc_data_type): Remove, replace by ...
> (desc_data_target_type): ... this.
> (thin_data_pntr): Use desc_data_target_type instead of desc_data_type.
> (ada_is_array_descriptor_type): Likewise.
> (ada_type_of_array): Likewise.
> (ada_coerce_to_simple_array_type): Likewise.
> (ada_array_element_type): Likewise.
Yes, that looks good to me.
Would you mind making a couple of tiny adjustments for me, please?
> + {
> + struct type *data_type = lookup_struct_elt_type (type, "P_ARRAY", 1);
> + if (data_type
> + && TYPE_CODE (ada_check_typedef (data_type)) == TYPE_CODE_PTR)
> + return TYPE_TARGET_TYPE (data_type);
> + }
> +
> + return NULL;
> }
Can you add an empty line after the declaration part? Mark usually
requests us to follow this style, and I like it, so...
> return
> data_type != NULL
> - && ((TYPE_CODE (data_type) == TYPE_CODE_PTR
> - && TYPE_TARGET_TYPE (data_type) != NULL
> - && TYPE_CODE (TYPE_TARGET_TYPE (data_type)) == TYPE_CODE_ARRAY)
> - || TYPE_CODE (data_type) == TYPE_CODE_ARRAY)
> + && TYPE_CODE (data_type) == TYPE_CODE_ARRAY
> && desc_arity (desc_bounds_type (type)) > 0;
> }
Can you bracket the return condition in between parens? This is not
strictly necessary, but I remember reading a coding style document
that suggests it in order to help formatters such as GNU indent.
Independently of gdbarch dependency, the code does look nicer this way.
--
Joel