public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Uros Bizjak <ubizjak@gmail.com>
To: Ian Lance Taylor <iant@google.com>
Cc: gcc@gcc.gnu.org, gofrontend-dev@googlegroups.com
Subject: Re: -fdump-go-spec option does not handle redefinitions
Date: Thu, 27 Oct 2011 21:12:00 -0000	[thread overview]
Message-ID: <CAFULd4bYU3qO=N-dtfDCf40sGd72dWFi1HmvXKT9BKanOLEasA@mail.gmail.com> (raw)
In-Reply-To: <mcrvcra2pyv.fsf@dhcp-172-18-216-180.mtv.corp.google.com>

On Thu, Oct 27, 2011 at 9:29 PM, Ian Lance Taylor <iant@google.com> wrote:

>> This testfile:
>>
>> #define aa 2
>> #undef aa
>> #define aa 3
>>
>> does not generate correct output with -fdump-go-spec. The result is:
>>
>> const _aa = 2
>> // undef _aa
>>
>> One would expect:
>>
>> const _aa = 2
>> // undef _aa
>> const _aa = 3
>
> Did this come up in a real situation?

Yes, it breaks libgo build on Alpha, due to the way TCGETS and friends
are defined. From bits/ioctls.h:

/* Use the definitions from the kernel header files.  */
#include <asm/ioctls.h>

/* Oh well, this is necessary since the kernel data structure is
   different from the user-level version.  */
#undef  TCGETS
#undef  TCSETS
#undef  TCSETSW
#undef  TCSETSF
#define TCGETS	_IOR ('t', 19, char[44])
#define TCSETS	_IOW ('t', 20, char[44])
#define TCSETSW	_IOW ('t', 21, char[44])
#define TCSETSF	_IOW ('t', 22, char[44])

> The problem with your proposal is that the output would be invalid Go,
> because it would attempt to define the name _aa twice.  However, it does
> seem plausible that in most scenarios of this type it would be more
> useful for -fdump-go-spec to generate
>
> const _aa = 3

I agree.

Thanks,
Uros.

      reply	other threads:[~2011-10-27 19:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-27 19:35 Uros Bizjak
2011-10-27 19:41 ` Ian Lance Taylor
2011-10-27 21:12   ` Uros Bizjak [this message]

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='CAFULd4bYU3qO=N-dtfDCf40sGd72dWFi1HmvXKT9BKanOLEasA@mail.gmail.com' \
    --to=ubizjak@gmail.com \
    --cc=gcc@gcc.gnu.org \
    --cc=gofrontend-dev@googlegroups.com \
    --cc=iant@google.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).