-fdump-go-spec option does not handle redefinitions

Ian Lance Taylor iant@google.com
Thu Oct 27 19:41:00 GMT 2011


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



More information about the Gcc mailing list