Commit Graph

541 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez 80da1f59aa Allow to generate associated constants in the body of C++ structs.
Opt-in since it uses a C++17 feature, but this allow exactly the same usage in
C++ and Rust, which I think is nice.

This also fixes constants of transparent structs in general, since the initial
version of this patch broke a test (associated constants in enums), so I added a
test for that too.
2019-02-23 17:58:22 -08:00
Emilio Cobos Álvarez 9761df66c2 tests: Add a test that exercises all the previous patches. 2019-02-23 15:38:34 -08:00
Emilio Cobos Álvarez 5c40ea2d8c library: Properly add dependencies of constants. 2019-02-23 15:36:02 -08:00
Emilio Cobos Álvarez cadce9871e constant: Extend binary operation support in literals. 2019-02-23 15:29:10 -08:00
Emilio Cobos Álvarez da359baff5 Cleanup matching in Literal::load. 2019-02-23 15:19:25 -08:00
Emilio Cobos Álvarez 38e3f886e2 parser: Special-case bitflags macro.
Fixes #100.

I want to add some more ergonomic improvements when in C++, but that's better in
another PR.
2019-02-23 15:11:17 -08:00
Emilio Cobos Álvarez 4293899cd1 Cleanup matching of items. 2019-02-23 12:29:43 -08:00
Ryan Hunt e712cc42c7 Release 0.8.0
* support for 'includes' without default includes
* removed dependency on ancient serde_derive!
2019-02-13 21:11:41 -06:00
Ryan Hunt 07ab3bcce8 Fix travis-ci to not use rustfmt-preview 2019-02-13 21:11:41 -06:00
Ryan Hunt 191d8ca917 Add badge for minimum required rustc 2019-02-13 20:58:38 -06:00
Mrmaxmeier 82804bb862 Unpin serde_derive
This bumps the minimal supported `rustc` version to 1.32.
2019-02-11 19:27:37 -06:00
Elichai Turkel 5855f98ab0 Cargo fmt 2019-02-06 10:49:19 -06:00
Elichai Turkel b4887febca Added tests for specific includes without default 2019-02-06 10:49:19 -06:00
Elichai Turkel f54cd515d9 Added support to includes without default includes 2019-02-06 10:49:19 -06:00
Ryan Hunt fbe9eff351 Release 0.7.1
* Fix for crash when unwrapping unsupported type with associated constants
2019-01-25 18:55:32 -06:00
Emilio Cobos Álvarez bc67e076d1 parser: Properly skip associated constants on unsupported types.
This fixes a crash when running cbindgen 0.7.0 on the style crate.
2019-01-25 18:52:31 -06:00
Emilio Cobos Álvarez 1644af96f6 ir: Give more information for unsupported types. 2019-01-25 18:52:31 -06:00
Ryan Hunt e1bad0e708 Release 0.7.0
* support for libc::ssize_t
* fixed some warnings on nightly
* fix for transparent associated constants
* switched more API's to use AsRef<Path>
* impl std::error::Error for cbindgen::Error
* now support putting user-defined content in item bodies
2019-01-24 12:50:08 -06:00
Emilio Cobos Álvarez 0a6324f4e6 config: Allow to output user-defined stuff in the struct body. 2019-01-22 18:50:12 -06:00
Emilio Cobos Álvarez 97348107aa Merge pull request #276 from emilio/less-warn
utilities: Fix Nightly warnings.
2019-01-23 01:16:49 +01:00
messense 24ae567c7a Impl std::error::Error for cbindgen::Error
Closes #278
2019-01-22 13:23:42 -06:00
Ingvar Stepanyan bc517fd899 Update few more APIs to use AsRef<Path>
This makes few more final APIs that work with files consistent with the rest.

Fixes #280.
2019-01-22 13:19:11 -06:00
Emilio Cobos Álvarez 2932819567 Merge pull request #274 from RReverser/ssize_t
Add support for ssize_t
2019-01-18 23:31:45 +01:00
Emilio Cobos Álvarez 85aa989fd1 utilities: Fix Nightly warnings. 2019-01-18 23:28:31 +01:00
Ingvar Stepanyan 2b6904886e Add support for ssize_t
Fixes #273.
2019-01-18 20:45:24 +00:00
Joshua Groves 7dc667ba32 Remove unnecessary clone 2019-01-11 09:23:02 -06:00
Joshua Groves 678e5a8d90 Run cargo-fmt 2019-01-11 09:23:02 -06:00
Joshua Groves 8c3e26424d Handle enum associated constants and reduce memory usage 2019-01-11 09:23:02 -06:00
Joshua Groves 0de44edd88 Remove member name from transparent associated constants 2019-01-11 09:23:02 -06:00
Ryan Hunt 44e9b2112a Release 0.6.8
* ptrdiff_t is now a recognized primitive type
* named function type arguments are now propagated
* fixes for struct literals in constants
* reserved C/C++ keywords are now escaped automatically
* negative enum discriminants are now supported
* fix for prefixing and formatting variant names
* fix for snake_case formatter
* syn update
* doxygen style comments are now output by default
* VaList is now a recognized primitive type
* fix for comment processing
* constant is propagated into array types
* references are now supported in IR, and used for some helper method generation
* assignment helper functions will generate array copies if necessary
2019-01-07 09:33:49 -06:00
Jeff Muizelaar 42b4290c64 Manually copy arrays
C++ arrays can't be assigned. We detect this situation and manually copy
over the elements.
2019-01-03 16:06:33 -06:00
Jeff Muizelaar b718662520 Support references better
This adds better support for references in the type system
and uses them for enumeration helpers instead of string
concatenation.
2019-01-03 14:14:42 -06:00
Jeff Muizelaar 3d5791731c Properly propagate const into arrays.
i.e. 'type I = *const [i32; 16]' should map to 'typedef const int32_t (*I)[16]'
instead of 'typedef int32_t (*I)[16]'
2019-01-03 09:58:06 -06:00
Ryan Hunt 9248f84d0c Move comment processing to a helper, and have it work with more comment types 2019-01-03 09:47:18 -06:00
Dan Robertson 304f752c06 Add support for VaList functions 2019-01-03 09:46:55 -06:00
Yurii Rashkovskii f974d7baec Problem: Doxygen not picking up documentation
Documentation generated by cbindgen is not displayed in Doxygen's
output.

Solution: use comment styles supported by Doxygen

For C, this will be

```
/**
 * ...
 */
```

For C++, this will be

```
///
/// ...
///
```

as described at http://www.stack.nl/~dimitri/doxygen/manual/docblocks.html
2019-01-03 09:42:31 -06:00
Emilio Cobos Álvarez ef2f926d54 Merge pull request #264 from emilio/synup
Update syn.
2019-01-03 15:27:53 +01:00
Emilio Cobos Álvarez 9653127578 rustfmt 2019-01-03 15:09:51 +01:00
Emilio Cobos Álvarez 094cd2bf5d Update syn.
Fixes #244
2018-12-29 14:25:50 +01:00
Luca Barbato d021772346 Make the ScreamingSnakeCase formatter behave as the SnakeCase one 2018-11-26 10:32:16 -06:00
Luca Barbato 5a9c8b1e30 Make the SnakeCase formatter not emit additional _ 2018-11-26 10:32:16 -06:00
Luca Barbato 57f7ec222b Apply the variant formatting over the exported name
Useful when you want to combine prefixing and formatting.
2018-11-26 10:32:16 -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
Ryan Hunt 68246af8e8 Format for nightly rustfmt changes 2018-11-26 09:54:03 -06:00
Ryan Hunt 032af08579 Escape reserved C/C++ keywords from struct fields and function arguments 2018-11-26 09:54:03 -06:00
Dzmitry Malyshau 3e07fe7ffe Add wgpu as a user 2018-11-09 08:43:09 -06:00
IGI-111 9861755b05 Add tests for nested struct literals 2018-11-05 08:59:44 -06:00
IGI-111 d163daad57 Propagate rename in struct literals 2018-11-05 08:59:44 -06:00
IGI-111 d310b7c181 Formatting 2018-11-05 08:59:44 -06:00
IGI-111 e35ea840d3 Propagate prefixes to struct literals
Fix #238

This ensures that constants of a struct type have their type and the
type of their underlying value expressions renamed in the case of a
prefix.
2018-11-05 08:59:44 -06:00