* -fdump-go-spec option does not handle redefinitions
@ 2011-10-27 19:35 Uros Bizjak
2011-10-27 19:41 ` Ian Lance Taylor
0 siblings, 1 reply; 3+ messages in thread
From: Uros Bizjak @ 2011-10-27 19:35 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc, gofrontend-dev
Hello!
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
xgcc (GCC) 4.7.0 20111027 (experimental) [trunk revision 180567]
Uros.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: -fdump-go-spec option does not handle redefinitions
2011-10-27 19:35 -fdump-go-spec option does not handle redefinitions Uros Bizjak
@ 2011-10-27 19:41 ` Ian Lance Taylor
2011-10-27 21:12 ` Uros Bizjak
0 siblings, 1 reply; 3+ messages in thread
From: Ian Lance Taylor @ 2011-10-27 19:41 UTC (permalink / raw)
To: Uros Bizjak; +Cc: gcc, gofrontend-dev
Uros Bizjak <ubizjak@gmail.com> writes:
> 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?
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
Ian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: -fdump-go-spec option does not handle redefinitions
2011-10-27 19:41 ` Ian Lance Taylor
@ 2011-10-27 21:12 ` Uros Bizjak
0 siblings, 0 replies; 3+ messages in thread
From: Uros Bizjak @ 2011-10-27 21:12 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: gcc, gofrontend-dev
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-10-27 19:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-27 19:35 -fdump-go-spec option does not handle redefinitions Uros Bizjak
2011-10-27 19:41 ` Ian Lance Taylor
2011-10-27 21:12 ` Uros Bizjak
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).