1039 Commits

Author SHA1 Message Date
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
Alan Somers
a9a893ee6c Fix dependencies spec and add CI testing with -Zminimal-versions 2020-04-10 18:30:29 +02:00
Emilio Cobos Álvarez
0761b9bbe4 Release 0.14.1
* Handle mangling pointers. (#508)
 * Unconditionally generate a return statement in partialeq implementations. (#509)
2020-04-10 16:38:41 +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
a519f1bda4 Actually use the temp dir for temporary compiled objects.
If the cbindgen_output is an absolute path, then join() will just return it.

Really fixes #499.
2020-04-04 23:46:42 +02:00
Emilio Cobos Álvarez
4a38a48937 Release 0.14.0
* Minor tweak at how [export.exclude] is handled to allow excluding generic
   instantiations in C mode. (#501)
 * Documented cpp_compat option. (#496)
 * Fixed a panic when parsing associated constants for a built-in type. (#494)
2020-04-04 23:32:40 +02:00
Emilio Cobos Álvarez
39bae60ad7 Generate test object files in a temporary directory instead of in-tree
Closes #499

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2020-04-04 17:54:52 +02:00
Emilio Cobos Álvarez
ec1631f3e4 Allow excluding monomorph structs in C mode.
Fixes #500.
2020-04-01 11:45:53 +02:00
Evgeniy Reizner
6fd245096d Add missing cpp_compat documentation. 2020-03-23 10:54:49 +01: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
Emilio Cobos Álvarez
17d7aad7d0 Release v0.13.2 2020-03-21 03:31:26 +01:00
Emilio Cobos Álvarez
fc577f2a28
support large integer constants (#490)
Avoid gcc warning by appending ULL suffix to integer literals that are too big to fit in a signed 64-bit integer.
2020-03-11 15:34:33 +01:00
Joe Devietti
6218281443 updated constant_big test case with large negative numbers 2020-03-11 09:58:10 -04:00
Joe Devietti
8638652d1d ran rustfmt 2020-03-09 23:13:54 -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
249b41ce8a ir: Add support for RefCell and Cell.
RefCell is opaque. Cell is repr(transparent) so can just be the inner type.

Simplify it the same way as we simplify Option<&mut T> and such.

Fixes #488
2020-03-09 01:49:14 +01:00
Emilio Cobos Álvarez
6654f99251
main: Provide a somewhat-useful error message for --verify changes. 2020-03-04 00:58:45 +01:00
Emilio Cobos Álvarez
06b1608eff
tests: Add missing expectations to 462871695d621a055d32644f9bbdb4f9f9cdb38e. 2020-03-04 00:52:15 +01:00
Emilio Cobos Álvarez
93f1fc2666
Blind-ish attempt to fix CI 2020-03-04 00:11:50 +01:00
Emilio Cobos Álvarez
910e1ee88f
template: Add allow_constexpr to template.toml. 2020-03-03 21:15:27 +01:00
Emilio Cobos Álvarez
3483359374
remove a test which was causing CI to go red. 2020-03-03 21:14:06 +01:00
Emilio Cobos Álvarez
b6c2f3c59d
constant: Fix the interaction of allow_constexpr and inline consts. 2020-03-03 21:10:47 +01:00
Emilio Cobos Álvarez
f50fbda469
parser: Fix a warning that somehow didn't turn the build red. 2020-03-03 20:47:18 +01:00
AlaskanEmily
462871695d
Add option to output constexpr generated constant primitive values
This is controlled by the [const] allow_constexpr option, similar to the
allow_static_const option.

It's only applied to primitives currently.
2020-03-03 20:46:12 +01:00
TheKK
61e55ce4d9 ir: write declaration of global variable like struct fields 2020-02-25 21:06:43 +01:00
AlaskanEmily
dfa6e5f982 Check for CFLAGS and CXXFLAGS when running tests
This is needed when running tests with clang/clang++, as some of the tests have
errors that clang reports which gcc does not such as unused static const
variables.
2020-02-25 01:24:27 +01:00
yingrueil
3b6647ba04 parser: warn when function is partial exported
Functions will be fully exported when they are `pub, `no_mangle`, and `extern
"C"`. Only two cases we should not generate warning which are `pub, `no_mangle`,
and `extern "C"` are all enabled or disabled.
2020-02-24 14:37:30 +01:00
yingrueil
b4d3b393c3 parser: don't warn when function is not extern c and not no_mangle 2020-02-24 14:37:30 +01:00
yingrueil
4463267bd2 parser: use match statement to replace nested if-else statement 2020-02-24 14:37:30 +01:00
yingrueil
bd2e43001e parser: extract condition for abstractions 2020-02-24 14:37:30 +01:00
Emilio Cobos Álvarez
69b3d20a92
Add tests for #475. 2020-02-22 14:17:00 +01:00
Jeff Gilbert
776d010aab Only write default cases if the switch is not exhaustive.
This fixes C++ -Wcovered-switch-default warnings.
2020-02-22 14:16:28 +01:00
Emilio Cobos Álvarez
c83137f366
cargo: don't read cargo.toml if not needed. 2020-02-20 23:21:47 +01:00
Emilio Cobos Álvarez
97ab4345f1
cdecl: pass config instead of recomputing void_prototype all over the place. 2020-02-17 22:50:48 +01:00
Emilio Cobos Álvarez
953390ba5e
bindgen: enable "void prototype" while writing struct field (#473)
This fixs typedef's signature in C as well because a typedef statement is
constructed like, "typedef " + field_like_string.
2020-02-17 22:37:11 +01:00
yingrueil
4c44e8a382 ty: decide if using void prototype in field by checking language 2020-02-17 13:23:30 +08:00
yingrueil
0163b83d76 bindgen: enable "void prototype" while writing struct field
This fixs typedef's signature in C as well because a typedef statement is
constructed like, "typedef " + field_like_string.
2020-02-15 13:03:44 +08:00
Arnav Singh
c6809b00fb
Emit documentation on constants (#471)
Fixes #403
2020-02-11 01:51:57 +01:00
Emilio Cobos Álvarez
3b97f4ff6b
Release 0.13.1.
* Support #[cfg] on individual enum variants. (#469)
2020-02-09 15:48:11 +01:00
Emilio Cobos Álvarez
5c2fab7919
ir: Minor fix for conditions around enums. 2020-02-08 23:21:42 +01:00
Emilio Cobos Álvarez
4d2b2026b6
ir: cfg: Cleanup the cfg code a bit more. 2020-02-02 19:48:14 +01:00
Emilio Cobos Álvarez
0f0ea8596d
ir: cfg: Deindent some code. 2020-02-02 19:42:51 +01:00