JuliaInterop / Clang.jl

C binding generator and Julia interface to libclang
https://juliainterop.github.io/Clang.jl/
MIT License
219 stars 68 forks source link

Feature Request: implement `smart_deanonymize` for cenums #420

Closed VarLad closed 5 months ago

VarLad commented 1 year ago

I found this in the example generator.toml:


# if this option is set to true, C code with a style of
# ```c
# typedef struct {
#     int x;
# } my_struct;
# ```
# will be generated as:
# ```julia
# struct my_struct
#     x::Cint
# end
# ```
# instead of
# ```julia
# struct var"##Ctag#NUM"
#     x::Cint
# end
# const my_struct = var"##Ctag#NUM"
# ```
smart_de_anonymize = true

But apparently this is only for structs It'd be nice to have a similar option for (c)enums as well

Gnimuc commented 1 year ago

Have you tried anonymous enums?

typedef enum {
  A,
  B,
  C
} name; 
Gnimuc commented 5 months ago

a workaround was added in https://github.com/JuliaInterop/Clang.jl/pull/413/commits/7fb268ecb49c6738c128e583eab0e6167c7a2156