Commit Graph

882 Commits

Author SHA1 Message Date
Vadim Petrochenkov d09fe6b753 test suite: Use suffixes instead of directories for test variants 2020-10-19 20:33:29 +02:00
Vadim Petrochenkov c943a99194 CI: Add a minimum version check 2020-10-14 10:12:50 +02:00
Emilio Cobos Álvarez fbdad17dc6 ci: Remove clippy check.
While useful sometimes, it doesn't have stability guarantees (so CI can
break when new rust stable versions are released), and it can do
suggestions that make us require newer rustc versions than needed, which
is not ideal.
2020-10-12 12:07:07 +02:00
Yury Mikhaylov 4be2fb4598 Add missing function with_style to the Builder
It's impossible to select desired style when cbindgen is configured from
the build script.
2020-10-11 16:43:24 +02:00
Emilio Cobos Álvarez e03830134b Fix a typo in the changes for the last version. 2020-10-07 15:56:32 +02:00
Emilio Cobos Álvarez 83b3be9f88 v0.15.0
* Allow customizing mangling of generic parameters in C (#575)
  * Box<T> simplifies to T* in C (4ce324c)
  * ManuallyDrop<T> and MaubeUninit<T> simplify to T in C, and are opaque in C++ (0076a17)
  * C++ supports a derive-ostream annotation to derive serialization of structs, unions and enums (#582)
  * Large character constants have been fixed on Windows (#586)
  * Constants are now generated for typedefs, etc (#589)
  * The `sort_by` configuration option has been made to work for constants (#587)
  * Default sort order is source order now (sort_by = "None"), and can be changed by the above option (#587)
2020-10-07 12:51:20 +02:00
Vadim Petrochenkov aeb69bcc69 Switch default sorting order for items to "None" 2020-10-05 19:57:33 +02:00
Vadim Petrochenkov ea919a4edf mem::replace -> mem::take 2020-10-05 19:57:33 +02:00
Vadim Petrochenkov f3d5a20363 Support sort_by for constants
Also support a global default for `sort_by` affecting both functions and constants.
2020-10-05 19:57:33 +02:00
Vadim Petrochenkov 6439e6df56 Support constants with arbitrary types 2020-10-05 10:52:05 +02:00
Vadim Petrochenkov 9669cadf60 Rename ARCHITECTURE.md to internals.md in contributing instructions 2020-10-03 17:34:27 +02:00
Vadim Petrochenkov 56d0799366 Use U'...' character literals instead of L'...' character literals
On Windows `L'...'` is 16 bit, so Rust `char` won't generally fit into it.
2020-10-03 17:34:27 +02:00
Vadim Petrochenkov f4b26fef2a Checkout files with LF line endings
Running test suite will reset line endings to LF, so it they are checked out as CRLF it'll mark the files as dirty.
2020-10-03 17:34:27 +02:00
Emilio Cobos Álvarez d1d97d4482 enumeration: Only propagate derive_ostream annotation if not present.
It seems reasonable to want to derive it for a variant, but want to
provide your own for the containing enum or such, for example.
2020-10-01 18:14:12 +02:00
Emilio Cobos Álvarez 36a3f8ba6e enumertion: Add a using declaration rather than qualifying all branches. 2020-10-01 18:14:12 +02:00
Kartikaya Gupta 2be47c88e6 Add support for tagged enums that turn into structs.
This happens when the tags are separated. In this case the output is slightly
different since the tag is not part of the struct body, so we need the top-level
serializer to write the tag type.
2020-10-01 12:22:51 +02:00
Kartikaya Gupta c5c17403b4 Add support for tagged enums that turn into unions. 2020-10-01 12:22:51 +02:00
Kartikaya Gupta b17beaf650 Propagate the derive-ostream annotation into enum variant bodies
This seems like a relatively reasonable way to get the variant body structs
to generate their own ostream serializers.
2020-10-01 12:22:51 +02:00
Kartikaya Gupta 12149d4071 Add option for ostream serializer for structures and untagged enums
Tagged enums will be handled in later patches.
2020-10-01 12:22:51 +02:00
Kartikaya Gupta 5f6b223237 Add ostream header to all generated .cpp files.
Ideally we'd just do this when we need it, but the ostream derivation
will be controlled by both global config and per-structure config, so
it's hard to know exactly when we need it and when we don't.
2020-10-01 12:22:51 +02:00
Emilio Cobos Álvarez 1fc4cb0724 test: Ensure Option<Box<T>> reduces to *T.
Co-Authored-by: Ivan Enderlin <ivan@mnt.io>
2020-09-29 13:40:07 +02:00
Emilio Cobos Álvarez 0b9f90bb55 ty: Remove swift_macro special case. 2020-09-29 13:36:46 +02:00
Emilio Cobos Álvarez 5d1217c7c0 tests: Instead of adding skip_cpp as a feature, make the tests work with C++ 2020-09-29 13:36:46 +02:00
Ivan Enderlin 4ce324cd2d feat: Simplify Box<T> to *T for C only. 2020-09-29 13:36:46 +02:00
Ivan Enderlin eefce50c6d test: Skip CPP for the manuallydrop and maybeuninit test cases. 2020-09-29 13:36:46 +02:00
Ivan Enderlin 4304907d01 test: Support a new .skip_cpp test suffix.
Following the example of `.skip_warning_as_error`, this patch
introduces a `.skip_cpp` suffix to skip the generation of `.cpp`
files.

This patch also simplifies the code. Ideally, we would create and
implement a new trait offering an API like `is_cpp_skipped`,
`is_warning_as_error_skipped`, and `normalize` (to remove all
suffixes), but it's a little bit overkill for our needs right now.
2020-09-29 13:36:46 +02:00
Ivan Enderlin 0076a17ac9 feat(ir) Simplify ManuallyDrop and MaybeUninit only for C. 2020-09-29 13:36:45 +02:00
Ivan Enderlin af6d2e3fbb test: test MaybeUninit as a simplified type. 2020-09-29 13:36:45 +02:00
Ivan Enderlin 501911c864 feat(parser,ir) Declare MaybeUninit as a simplified type. 2020-09-29 13:17:04 +02:00
Ivan Enderlin 79bb38abda test: Test ManuallyDrop as a simplified type. 2020-09-29 13:17:04 +02:00
Ivan Enderlin f7471e5a5e feat(parser,ir) Declare ManuallyDrop as a simplified type. 2020-09-29 13:17:04 +02:00
Emilio Cobos Álvarez 1e6234f1ad General dependency + Cargo.toml format update. 2020-09-22 13:11:29 +02:00
Emilio Cobos Álvarez 297be51686 Refactor rename-rules to make more sense.
Option<RenameRule> doesn't make sense anywhere because there's a
RenameRule::None itself, which is also default.

This simplifies a bit the rename rules code, and removes one weird
"default-to-gecko-case" that seems snuck by.
2020-09-22 13:01:52 +02:00
Emilio Cobos Álvarez 4906184a5f Remove unknown-on-stable clippy lint. 2020-09-22 12:54:55 +02:00
Emilio Cobos Álvarez 18110669fc Add docs, move mangling configuration to its own place, add integration tests. 2020-09-22 12:54:55 +02:00
Adam Wilson 0005ad1f24 Change mangle_separator to remove_underscores, and allow converting case of types instead. 2020-09-22 12:54:55 +02:00
Emilio Cobos Álvarez b159bca6f6 Appease rustfmt. 2020-09-22 11:38:43 +02:00
Emilio Cobos Álvarez a54a8d63c6 Fix some clippy lints. 2020-09-22 11:06:31 +02:00
Emilio Cobos Álvarez e4da7d39a6 v0.14.6
Don't use matches!() to support older rustc versions.

Fixes #574
2020-09-21 20:56:12 +02:00
Emilio Cobos Álvarez 1e46e53ae2 v0.14.5 2020-09-19 16:24:32 +02:00
Luni-4 fe656442a5 Document ptrs-as-arrays annotation 2020-09-07 20:53:09 +02:00
Luni-4 07c3aed03e Add ptrs-as-arrays tests 2020-09-07 20:53:09 +02:00
Luni-4 ee4638ab10 Add an annotation to represent pointers as arrays 2020-09-07 20:53:09 +02:00
Luni-4 73ea04c2b0 Add badge to README 2020-09-07 00:24:10 +02:00
Luni-4 6b56082be8 Replace travis with Github Actions 2020-09-07 00:24:10 +02:00
Luni-4 fec6bdad8c Fix clippy warnings 2020-09-06 20:19:48 +02:00
Tom Solberg 3ca0e75ed9 Add support for specifying line ending style (#568) 2020-08-26 15:28:17 +02:00
Emilio Cobos Álvarez 83cdbd897f Release v.0.14.4 2020-08-20 18:42:17 +02:00
Adam Wilson 030916e399 Add option for mangling_separator in ExportConfig (#502) 2020-08-18 21:45:30 +02:00
Emilio Cobos Álvarez d652d29ae2 ir: Be less strict when instantiating opaque types.
There are two situations where we can legitimately end up with a
different number of template params.

Fixes #532.
Fixes #527.
2020-08-15 13:40:54 +02:00