dmd
dmd copied to clipboard
WIP: Compare type sizes in druntime with ImportC
Types for bindings of C libraries in druntime need to match the C headers. Small differences can result in hard to debug problems.
This test tries to automatically find types with a wrong size. This is done by also getting type sizes from C headers using ImportC and comparing them. Differences between the sizes can have different reasons:
- Bugs in ImportC (e.g. for bitfields) can result in a wrong size
- Type definitions in druntime can be wrong
- Different preprocessor options could be used, like _FILE_OFFSET_BITS
- Size differences can be fine, because some structs contain a member for the size or a version
Members of structs and unions with the same name are also compared. For types with potential problems a comparison of the layout is printed.