den-run-ai / ctypesgen

Automatically exported from code.google.com/p/ctypesgen
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Failed to parse real anonymous field in struct. #17

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
For code like this:

typedef struct SteamState_struct{
    char region;
    union{
        int R1;
        long int R4;
        float R2;
        double R3;
    };
} SteamState;

the union part will be discarded. If I give the union a name like 'rvalue', the 
union will be generated properly.

The same is true for anonymous enum inside struct.

ctypes Structure class has a special attribute for _anonymous_.

Original issue reported on code.google.com by mozbug...@gmail.com on 24 Jun 2011 at 2:46

GoogleCodeExporter commented 9 years ago
This seems to be a C11 feature. Before C11, it's a gcc extension.

Attached patch make the anonymous fields available. anonymous field will have 
its name as `null` in json.

Original comment by mozbug...@gmail.com on 17 Feb 2012 at 9:23

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks; committed.

Original comment by rrt@sc3d.org on 17 Feb 2012 at 11:39