crystal-lang / crystal_lib

Automatic binding generator for native libraries in Crystal
138 stars 30 forks source link

quick partial fix for clang 3.9 #35

Closed danny8376 closed 7 years ago

danny8376 commented 7 years ago

Quick fix for #34 Solving by treat Elaborated like Unexposed. However, for some struct ref as type in itself or some struct/enum ref as type before definition, this fix won't work. It seems that real fix need some recode.

spalladino commented 7 years ago

After checking whether we are good to drop 3.8 and earlier, we'll merge it ;-)

asterite commented 7 years ago

@danny8376 Thank you for this! Could you add a spec or two that exhibits some C code where this change is needed?

danny8376 commented 7 years ago

@asterite If you change to clang 3.9, tests like "parses struct with unexposed struct" or "parses recursive struct" will fail. Clang 3.9 return new type Elaborated for those situation. However,I'm not sure it's right or not to treat it like Unexposed.

result of running parser spec with current master, crystal 0.20.3, clang 3.9.1 https://gist.github.com/0bdb1ce91973c2aa1884f21c14378b9e result of running parser spec with this patch, crystal 0.20.3, clang 3.9.1 https://gist.github.com/434cabd5916459585442482e859505a9