197 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
aeb69bcc69 Switch default sorting order for items to "None" 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
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
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
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
af6d2e3fbb
test: test MaybeUninit as a simplified type. 2020-09-29 13:36:45 +02:00
Ivan Enderlin
79bb38abda
test: Test ManuallyDrop as a simplified type. 2020-09-29 13:17:04 +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
18110669fc Add docs, move mangling configuration to its own place, add integration tests. 2020-09-22 12:54:55 +02:00
Luni-4
07c3aed03e Add ptrs-as-arrays tests 2020-09-07 20:53:09 +02:00
Tom Solberg
3ca0e75ed9
Add support for specifying line ending style (#568) 2020-08-26 15:28:17 +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
Nick Wilcox
afd4a05d4e update nonnull expectations 2020-08-05 15:09:28 +02:00
Nick Wilcox
41b7866c14 Add support for an optional attribute on pointers whose nullability can be inferred from the Rust type. 2020-08-05 15:09:28 +02:00
Emilio Cobos Álvarez
3527e0f1e3 Update expectation files 2020-07-31 16:22:48 +02:00
Emilio Cobos Álvarez
5eae0bc07b function: Add support for wildcards in arguments.
We don't support unnamed arguments, and we give a terrible error
("Parameter has an unsupported type.") when you use them.

They're very simple to implement so we should just do it.
2020-07-25 13:50:11 +02:00
mexus
a94d6e2c9b Support "never" return type 2020-07-24 22:39:08 +02:00
Luni-4
274c9743ca Add tests 2020-07-14 16:59:54 +02:00
Hayes Neuman
bb00d1c4a8 Support renaming for constants with casts, and properly order them in the output. 2020-05-26 23:21:28 +02:00
Hayes Neuman
967c378308 Support casts in constants 2020-05-26 23:21:28 +02:00
Emilio Cobos Álvarez
b04aa7e699 parser: Introduce cbindgen:ignore comment annotation, to allow ignoring items or modules. 2020-05-15 15:43:54 +02:00
Emilio Cobos Álvarez
a05a223704 tests: Add tests for attribute annotations. 2020-05-01 00:30:40 +02:00
Luca Barbato
1a824c04f2 Add support for verbatim content after includes
Let the user add raw C code in the generated header after the include
blocks.

It matches what bindgen provides with the raw_lines option.
2020-04-22 01:50:16 +02:00
Vincent Tavernier
1ed32adafb Add Rust 2015 edition test for nested modules 2020-04-17 14:22:00 +02:00
Vincent Tavernier
60d60aaf0d Fix #254
By checking the recursion depth in the crate we are currently parsing,
we can decide on the right module directory to find submodules in. The
added `mod_2018` test fails without the changes to `parser.rs`.
2020-04-17 14:22:00 +02:00
Vincent Tavernier
ea6ea24740 Fix #381
As noted by @Benlitz, Cargo metadata supports directly specifying the
target name instead of using the `#[cfg]` syntax. We can support this by
manually creating the `syn::NestedMeta` node from the target name seen
as a string literal.
2020-04-17 14:11:06 +02:00
Igor Sadchenko
6fce1ccc4b Review fixes. Add parameter skip_warning_as_error to skip threat a warning as an error 2020-04-14 19:03:55 +02:00
Igor Sadchenko
4baadb049d Review fixes 2020-04-14 19:03:55 +02:00
Igor Sadchenko
275b36fb09 Added pragma once option. Issue #510 2020-04-14 19:03:55 +02:00
Emilio Cobos Álvarez
33d9ecf11f Handle mangling pointers.
Ugly, but better than crashing.

Closes #506.
Closes #453.
2020-04-10 15:22:16 +02:00
Emilio Cobos Álvarez
0fed9eebc4 enum: Unconditionally generate a return statement in partialeq implementations.
This fixes: https://bugzilla.mozilla.org/show_bug.cgi?id=1628754#c7
2020-04-10 15:01:41 +02:00
Emilio Cobos Álvarez
ec1631f3e4 Allow excluding monomorph structs in C mode.
Fixes #500.
2020-04-01 11:45:53 +02:00
Emilio Cobos Álvarez
c265a7562a parser: Don't panic when finding associated constants to a primitive.
We don't handle it, but no reason to panic.

Fixes #493
2020-03-21 17:23:02 +01:00
Joe Devietti
6218281443 updated constant_big test case with large negative numbers 2020-03-11 09:58:10 -04:00
Joe Devietti
7101465403 avoid gcc warning by appending ULL suffix to integer literals that are too big to fit in a signed 64-bit integer 2020-03-09 23:11:51 -04:00
TheKK
5a4d74b911 ir: escape export_name while writing source of EnumVariant 2020-03-09 15:58:56 +01:00
TheKK
e2b2c81221 ir: escape tagged union's field name 2020-03-09 15:58:56 +01:00
Emilio Cobos Álvarez
c3442809b9 tests: Add tests for cell and refcell. 2020-03-09 01:49:14 +01:00
Emilio Cobos Álvarez
06b1608eff
tests: Add missing expectations to 462871695d621a055d32644f9bbdb4f9f9cdb38e. 2020-03-04 00:52:15 +01:00