This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [rfc] Ada simplification: desc_data_type


> 	* 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]