23 Commits

Author SHA1 Message Date
kavoor 5b418d968c Support rename rule for union body members.
Closes #751.
2022-04-19 11:22:04 +02:00
Emilio Cobos Álvarez 09284108eb enumeration: simplify standard types in variants.
Fixes #745
2022-04-04 20:25:01 +02:00
Marc-André Lureau ccea33ecb4 tests: check renaming enum affects variant prefix
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2021-03-29 14:08:02 +02:00
Vadim Petrochenkov b82e375254 enum: Support inlined definitions for tuple variants with a single field 2020-12-09 19:38:21 +01:00
Vadim Petrochenkov 1c1d4754ce tests: Remove Cython-specific configs 2020-11-25 17:30:30 +01:00
John VanEnk 8048748419 Add a test that demonstrates Style::Tag can emit structures with incorrect sizes in C. 2020-01-26 04:43:27 +01:00
Evan Shaw 6a9066f7cd Add enum_class option
This option allows specifying that a C++ enum should be emitted with
plain `enum` rather than `enum class`. It's true that `enum class` should
generally be preferred, but sometimes there's existing code which is
already using plain `enum`, and porting that code to Rust becomes easier when
`cbindgen` can emit plain `enum`.

This option can be overridden on a per-enum basis using a `cbindgen:` annotation.

It defaults to true for two reasons:

* Backward compatibility.
* `enum class` is probably actually what you want, in general.
2019-12-29 12:55:59 +01:00
Aleksa Sarai 8c66c0c1dc tests: enum: add #[repr(u64)] test
Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
2019-12-22 14:06:12 +01:00
Emilio Cobos Álvarez 9b5dd80d84 Stop including <uchar.h>, and instead map Rust char to uint32_t.
This is technically a breaking change for C++, unfortunately.

Fixes #423.
2019-12-04 00:03:38 +01:00
Adrian Wong 9b1fd8ecca Fix missing C header for char32_t 2019-12-02 19:55:04 +01:00
Dan Robertson 304f752c06 Add support for VaList functions 2019-01-03 09:46:55 -06:00
Emilio Cobos Álvarez e08fb32d74 ir: Add support for negative enum discriminants.
Pretty straight-forward, but it bit me today :)
2018-11-26 09:57:34 -06:00
Johan Anderholm 3a9bb17e8a Modify test to run all three styles for C. 2018-03-27 10:05:45 -05:00
Ingvar Stepanyan 70d8b95f78 Disallow unknown and conflicting repr markers 2018-01-31 09:35:29 -06:00
Ingvar Stepanyan 0ebcf99d31 Fix wrapper kind for C-like tagged enum
Fixes #126
2018-01-31 09:35:29 -06:00
Ingvar Stepanyan 07eae4c171 Implement support for repr(C, Int)
Fixes #119
2018-01-31 09:35:29 -06:00
Ryan Hunt 4e481c1338 Add dependencies for tagged enums 2018-01-29 14:08:02 -06:00
Ingvar Stepanyan bd494d4646 Simplify enum variant handling 2018-01-29 11:36:59 -06:00
Ingvar Stepanyan 3355f2b1ff Rename fields generated by tagged enum 2018-01-29 11:36:59 -06:00
Ingvar Stepanyan 905b9a09aa Add support for repr(C) tagged enums too 2018-01-29 11:36:59 -06:00
Ingvar Stepanyan 3b61c8ead5 Initial support for tagged enums 2018-01-29 11:36:59 -06:00
Ingvar Stepanyan f0bef30daa Simplify opaque struct output in C
There is no need for a separate forward struct declaration, just like in case with regular structures.
2017-11-16 23:26:07 -06:00
Ryan Hunt 6a02ec4a7f Commit test expectations 2017-11-09 18:04:22 -05:00