jwiegley / c2hsc

Utility for creating .hsc files from C API header files
BSD 3-Clause "New" or "Revised" License
26 stars 15 forks source link

Enum type names are sometimes handled incorrectly #10

Closed jwiegley closed 10 years ago

jwiegley commented 10 years ago

Consider this generated code:

{- typedef struct Foo_ Foo; -}
#opaque_t Foo_
#synonym_t Foo , <Foo_>
{- typedef enum Bar_ { ... } Bar; -}
#integral_t Bar_

In this case, the _ suffix should not have been chosen, but the resulting enum type synonym.

jwiegley commented 10 years ago

For Foo above this is probably OK, but in C, the Bar_ variant is definitely incorrect.

jwiegley commented 10 years ago

Oops, that fixed #11.

jwiegley commented 10 years ago

We now generate:

{- typedef struct Foo_ Foo; -}
#opaque_t struct Foo_
#synonym_t Foo , <struct Foo_>
{- typedef enum Bar_ {
            BAR
        } Bar; -}
#integral_t enum Bar_
#num BAR
#synonym_t Bar , <enum Bar_>

This looks correct, as far as the input source.