Closed ian-h-chamberlain closed 3 months ago
If anything the scary/weird part is that gcc seems to use short enums by default for arm-none-eabi
while clang doesn't. You'd think they would agree on those settings, but at least we can do it manually this way. We'll probably want a similar PR for citro3d-rs
too
Closes #166 I guess?
Related to https://github.com/rust3ds/ctru-rs/pull/178#pullrequestreview-2013120422 and some of the changes in #162
By passing -fshort-enums to clang, we can get the same smaller types that gcc generates for some of these enums.
This also makes sure the layout tests have the same smaller sizes, so the expected sizes now match the actual sizes of the same C structs.
One thing this doesn't do is truly check that GCC is generating the same everything... ideally, I think we'd want to link against a C lib that had a bunch of APIs like this or something:
and then a Rust test like
But without
bindgen
doing something like this for us, this seems like a tricky thing to write unless we just do it manually. So for now I think I'll kinda ignore that and leave it as a future enhancement if we really need it.