This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gengtype and typedef to enum
- From: Geoff Keating <geoffk at geoffk dot org>
- To: gdr at integrable-solutions dot net
- Cc: gcc at gcc dot gnu dot org
- Date: Wed, 19 Mar 2003 16:00:09 -0800
- Subject: Re: gengtype and typedef to enum
- References: <m3llzbugdz.fsf@uniton.integrable-solutions.net>
> Cc: gcc at gcc dot gnu dot org
> From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
> Date: 19 Mar 2003 23:43:20 +0100
> I discovered by the hard way (2 hours chasing the "problem") that the
> gengtype machinery does not recognize typedef to enums. I.e., given
>
> typedef enum number { zero, one } number;
>
> struct foo GTY(())
> {
> number n; // #1
> };
>
> gengtype complains about use of "nunmber" at line "#1" as being
> unindentified. Is this a feature?
>
> Thanks,
Only in the sense of "feature, missing". The typedef parsing is
pretty simple-minded, and doesn't cover this case or even the simpler
case of
typedef enum number number;
which it certainly could handle properly with very little work, in
fact by replacing
[^[:alnum:]_]typedef{WS}{ITYPE}{WS}{ID}{WS}?";" {
in gengtype-lex.l with
[^[:alnum:]_]typedef{WS}({ITYPE}|"enum"{WS}{ID}){WS}{ID}{WS}?";" {
--
- Geoffrey Keating <geoffk at geoffk dot org>