Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Mark Wielaard <mjw@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Handle volatile array types in dwarf2read.c.
Date: Tue, 01 Jul 2014 16:05:00 -0000	[thread overview]
Message-ID: <87simlrroa.fsf@fleche.redhat.com> (raw)
In-Reply-To: <1404164071-24432-1-git-send-email-mjw@redhat.com> (Mark	Wielaard's message of "Mon, 30 Jun 2014 23:34:31 +0200")

>>>>> "Mark" == Mark Wielaard <mjw@redhat.com> writes:

Mark> read_tag_const_type propagates the cv-qualifier to the array
Mark> element type, but read_tag_volatile_type didn't. Make sure that
Mark> both cv-qualifiers that apply to array types are handled the same.

Thanks Mark.

Mark> 	* gdb.base/constvars.c (violent, violet, vips, virgen, vulgar,
Mark> 	vulture, vilify, villar): New volatile array constants.
Mark> 	(vindictive, vegetation): New const volatile array constants.

Lovely names.

Mark> +   the cv-qualifiers.  This is mimics section 6.7.3 of the C99
Mark> +   specification.  */

"This is" -> "This".

Mark> +static struct type *
Mark> +add_array_cv_type (struct die_info *die, struct dwarf2_cu *cu,
Mark> +		   struct type *base_type, int cnst, int voltl)

gdb usually puts a blank line between the intro comment and the function
head.

Mark> +  while (TYPE_CODE (TYPE_TARGET_TYPE (inner_array)) == TYPE_CODE_ARRAY)
Mark> +    {
Mark> +      TYPE_TARGET_TYPE (inner_array) =
Mark> +	copy_type (TYPE_TARGET_TYPE (inner_array));
Mark> +      inner_array = TYPE_TARGET_TYPE (inner_array);
Mark> +    }

I think this may be overly eager in the case where the underlying type
already has the needed qualifications.

Mark> +  cnst |= TYPE_CONST (el_type);
Mark> +  voltl |= TYPE_VOLATILE (el_type);
Mark> +  TYPE_TARGET_TYPE (inner_array) = make_cv_type (cnst, voltl, el_type, NULL);

make_cv_type preserves the already existing qualifiers so you don't need
to track "cnst" and "voltl".  You can just pass in the ones you want to
add.

Mark> +  /* In case the volatile qualifier is applied to an array type, the
Mark> +     element type is so qualified, not the array type (section 6.7.3
Mark> +     of C99).  */
Mark> +  if (TYPE_CODE (base_type) == TYPE_CODE_ARRAY)
Mark> +    return add_array_cv_type (die, cu, base_type, 0, 1);

I wonder about typedefs to array type.
Calling check_typedef here is probably not so great but I assume we can
just ignore incomplete types.

Tom


  reply	other threads:[~2014-07-01 16:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-30 21:35 Mark Wielaard
2014-07-01 16:05 ` Tom Tromey [this message]
2014-07-01 18:11   ` Mark Wielaard
2014-07-01 18:25     ` Tom Tromey
2014-07-01 20:15       ` Mark Wielaard

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=87simlrroa.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=mjw@redhat.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