Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@adacore.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Tom Tromey <tromey@adacore.com>,  gdb-patches@sourceware.org
Subject: Re: [PATCH 2/2] Change ptype/o to print bit offset
Date: Mon, 29 Apr 2019 18:57:00 -0000	[thread overview]
Message-ID: <87ftq04p38.fsf@tromey.com> (raw)
In-Reply-To: <83zho8skya.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 29 Apr	2019 21:52:29 +0300")

>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:

>> /*    5: 0   |     4 */        unsigned int y : 3;
>> /*    5: 3   |     4 */        unsigned int z : 3;
>> /* XXX  2-bit padding  */
>> /* XXX  3-byte padding */

Eli> This loses information, because now the bits part is just a trivial
Eli> conversion of the field size in the declaration.  The current display
Eli> shows something that cannot be trivially gleaned by looking at the
Eli> bitfield sizes.

Eli> I'm not objecting to the change, I'm just saying we lose something
Eli> here.

We don't actually lose anything here, because the padding is spelled out
explicitly in the comments that are printed.


Also, consider an example like this, from an Ada test case:

/* offset    |  size */  type = struct aggregates__nested_packed {
/*    0: 5   |     1 */    <range type> q000 : 3;
/*    0:23   |     8 */    struct aggregates__packed_rec {
/*    0      |     4 */        integer packed_array_assign_w;
/*    4: 5   |     1 */        <range type> packed_array_assign_x : 3;
/*    4: 2   |     1 */        <range type> packed_array_assign_y : 3;
/* XXX  2-bit padding  */
/* XXX  3-byte padding */

                               /* total size (bytes):    8 */
                           } r000 : 38;

The "0:23" here is, IMO, actively confusing.

Tom


  reply	other threads:[~2019-04-29 18:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-29 18:31 [PATCH 0/2] two ptype/o changes Tom Tromey
2019-04-29 18:31 ` [PATCH 2/2] Change ptype/o to print bit offset Tom Tromey
2019-04-29 18:52   ` Eli Zaretskii
2019-04-29 18:57     ` Tom Tromey [this message]
2019-04-29 20:10   ` John Baldwin
2019-05-08 16:14 ` [PATCH 0/2] two ptype/o changes Tom Tromey

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=87ftq04p38.fsf@tromey.com \
    --to=tromey@adacore.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    /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