This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: gengtype and typedef to enum


> 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>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]