Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Tom Tromey <tom@tromey.com>
Cc: Manish Goregaokar <manish@mozilla.com>,  gdb-patches@sourceware.org
Subject: Re: [PATCH] Print void types correctly in Rust
Date: Mon, 27 Jun 2016 16:26:00 -0000	[thread overview]
Message-ID: <871t3ik38a.fsf@tromey.com> (raw)
In-Reply-To: <8760suk3qg.fsf@tromey.com> (Tom Tromey's message of "Mon, 27 Jun	2016 10:15:19 -0600")

Tom> ... I wonder if that is something that changed after 1.8, or if it's the
Tom> case that the unit type can be represented in multiple ways.  (Or maybe
Tom> this only handles the unit type constructed by rust_language_arch_info?)

[...]

Manish> +// Empty function, should not have "void"
Manish> +// or "()" in its return type
Manish> +fn empty() {

Tom> I'm curious what happens if it does say "-> ()"?

I did the experiment myself and I think I see what's going on now.

For an explicit "()", like "let y = ()", we'll end up with a zero-sized
integer type:

 <1><98>: Abbrev Number: 7 (DW_TAG_base_type)
    <99>   DW_AT_name        : (indirect string, offset: 0x88): ()
    <9d>   DW_AT_encoding    : 7	(unsigned)
    <9e>   DW_AT_byte_size   : 0


However, "fn empty()" (or in my experiment also "fn empty()->()"), the
type is left unspecified in the DWARF, which gdb turns into
TYPE_CODE_VOID (see dwarf2read.c:read_unspecified_type).

I think both have to be handled.  However I think it's fine to do some
cleanup in a follow-up patch, which I'm happy to do.

So your patch is OK with the ChangeLog entry and the indentation fixed.

Tom


  parent reply	other threads:[~2016-06-27 16:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-27 15:52 Manish Goregaokar
2016-06-27 16:15 ` Tom Tromey
2016-06-27 16:25   ` Manish Goregaokar
2016-06-27 16:35     ` Tom Tromey
2016-06-27 16:26   ` Tom Tromey [this message]
2016-06-27 16:53 ` Manish Goregaokar

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=871t3ik38a.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=manish@mozilla.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