Map enum tuple variants with no contents as unitary enum variants
authorMatt Corallo <git@bluematt.me>
Fri, 30 Apr 2021 23:41:18 +0000 (23:41 +0000)
committerMatt Corallo <git@bluematt.me>
Fri, 30 Apr 2021 23:41:31 +0000 (23:41 +0000)
commitc0af862562cc201eba7e31535833569b0fab4e3c
treed28827c828793725b2a2ecf6ee26d0d1da324b42
parentdb0ed2ef02f28a8b393eb3640959587bfe1a7e52
Map enum tuple variants with no contents as unitary enum variants

cbindgen maps `enum A { V() }` with a `struct A_V_Body {}` which
has different size on C and C++ (0 and 1 bytes). While this is
fine if a different variant has non-0 size as the union will be
correctly sized. However, there isn't a lot of reason to rely on
this when we can just have a unitary variant as well.
c-bindings-gen/src/main.rs