Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Joel Brobecker <brobecker@adacore.com>
To: Ulrich Weigand <uweigand@de.ibm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [rfc] Ada simplification: desc_data_type
Date: Fri, 15 May 2009 15:01:00 -0000	[thread overview]
Message-ID: <20090515150133.GM7292@adacore.com> (raw)
In-Reply-To: <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


  reply	other threads:[~2009-05-15 15:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-14 11:37 Ulrich Weigand
2009-05-15 15:01 ` Joel Brobecker [this message]
2009-05-18 13:58   ` Ulrich Weigand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090515150133.GM7292@adacore.com \
    --to=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    --cc=uweigand@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox