Commit Graph

736 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
84b5455f88
Keep dependencies up-to-date.
A few tests change some formatting, but that's fine.
2020-11-13 20:02:30 +01:00
Emilio Cobos Álvarez
a467d3efc6 codegen: Allow to not derive Debug on enums.
Fixes #1899.

This code predated all the derive machinery, and always hardcoded its
derives.

We could avoid hard-coding the other traits, but those seem
usually-useful, so leave them there for backwards compat for now.
2020-10-16 12:12:17 +02:00
Sebastian Imlay
4f714ab79e Fix test for CI 2020-09-16 12:26:24 +02:00
Sebastian Imlay
4a51c4552c Update to fix CI 2020-09-16 12:26:24 +02:00
Sebastian Imlay
59a4c18b17 Updates for CI 2020-09-16 12:26:24 +02:00
Sebastian Imlay
d4e84650c8 Updates from PR comments 2020-09-16 12:26:24 +02:00
Sebastian Imlay
0dff6d65d5 Fix spacing issue 2020-09-16 12:26:24 +02:00
Sebastian Imlay
c24626993d First attempt to fix CI 2020-09-16 12:26:24 +02:00
Sebastian Imlay
81d323d8b1 Updates base on comments
* Added TryInto trait implementation from parent to child interfaces.
* Added HashSet for protocols so that the protocol inheritance works as
well.
2020-09-16 12:26:24 +02:00
Sebastian Imlay
840b738ecf Initial stuff for changing ownership and adding inheritance 2020-09-16 12:26:24 +02:00
Emilio Cobos Álvarez
4608a11b5c
Added constructor return type for wasm32 target (#1877) 2020-08-25 02:15:18 +02:00
Emilio Cobos Álvarez
428189cb41 tests: Improve enum tests to avoid duplication, and add a test for #1880 2020-08-25 00:38:57 +02:00
Audrius
d446a4f6f1 Added expectation test files for clang 3.9 and 4 2020-08-24 21:50:18 +03:00
Audrius
b1cefe2395 Optimized condition order, added regression test 2020-08-24 16:29:43 +03:00
Sebastian Imlay
4299255c8a Added Bindgen names to objective-c pointer return types
* Took advantage of the repr transparent to use Bindgen return type
  names.
* Updated unit tests and book
2020-08-15 13:56:25 +02:00
Chih-Hung Hsieh
53290e8f35 Add --default-macro-constant-type
* --default-macro-constant-type could be 'signed' or 'unsigned'
  * Its default value is 'unsigned' to use u32/u64
    for C macro constants that fit into the u32/u64 ranges.
  * For old C libraries that use macros as int/long parameter
    and/or return value types, their macros are better declared
    as i32/i64 if the values fit the i32/i64 ranges,
    to be compatible with c_int/c_long types.
    They can use "--default-macro-constant-type signed"
2020-08-09 13:01:46 +02:00
Varphone Wong
dfeff8992e Add --anon-fields-prefix option
Allow to use the given prefix for the anon fields instead of `__bindgen_anon_`.
2020-08-04 12:08:11 +02:00
Joseph Angelo
87b2bc033f Fixed const-ness of multidimensional arrays 2020-08-04 12:06:02 +02:00
Emilio Cobos Álvarez
48808ed9d3 tests: Add a test for bool enum with an alias. 2020-08-03 20:17:57 +02:00
Varphone Wong
ff3698189c Add --no-debug <regex> flag 2020-08-03 18:29:07 +02:00
Cameron Mulhern
f56fbcef78 Improves bindings for typed and anonymous enums 2020-08-03 18:11:57 +02:00
Darren Kulp
03dbd1a3f8 Remove testing_only_libclang_3_8 and expectations 2020-07-20 18:55:10 +02:00
Emilio Cobos Álvarez
d794a0823c tests: Check that command_line_args round-trips.
Fixes #1818.
2020-07-01 16:21:13 +02:00
Emilio Cobos Álvarez
51ff49ae63 tests: Minor simplification of test harness.
We were never returning Ok(None), so not sure why this was ever there.
2020-07-01 16:21:13 +02:00
Darren Kulp
eab1137ea9 Introduce expectation test for operator names 2020-07-01 13:30:52 +02:00
Darren Kulp
d4f786ff41 Emit bindgen version in generated header
Update expectations
2020-06-29 03:39:19 +02:00
Darren Kulp
3dafdca17b Disable generated comment in expectations test 2020-06-29 03:39:19 +02:00
Darren Kulp
0bc76716e5 Run cargo +nightly fmt on expectations
Impending overwrites to expectations should be as simple and regular as
possible, so get the formatting done here.
2020-06-29 03:39:19 +02:00
eggyal
806887f05f
Derive traits for newtype aliases (#1802) 2020-06-15 17:40:11 +02:00
Emilio Cobos Álvarez
fc461b8ef7 tests: Fix rustfmt check to allow for RUSTFMT env vars. 2020-06-15 02:13:39 +02:00
kellda
b91353c978 Mangle items with the same name as Rust primitive types 2020-06-08 11:52:11 +02:00
Nathan Froyd
b10fa6f894 add command-line option for disabling untagged unions
One more thing that we can configure from the command line.
2020-05-18 22:21:48 +02:00
Emilio Cobos Álvarez
b1a1ebc918 ir: Fall back to get the cursors from the type if we find no param decls.
It seems libclang sometimes doesn't expose the right paramdecl cursors.

This should be reported upstream, but it's easy enough to workaround. It
loses the parameter names which is a bit unfortunate but...

Fixes #1778
2020-05-14 12:58:30 +02:00
Sebastian Imlay
1f324cabfc Added inheritance to objective-c support. 2020-05-11 17:05:35 -07:00
Stephen Crane
b9eefb6da7 Add test 2020-05-04 16:34:08 -07:00
Joshua Nelson
f0607275b4 Run cargo fix --edition 2020-04-27 15:37:47 -04:00
Sebastian Imlay
4562ef97c0 Added some initial constraints to the objective-c bindgen stuff 2020-03-16 10:51:34 +01:00
Emilio Cobos Álvarez
e09602bb8b var: Constant arrays of const elements should not generate static muts.
Fixes #1727
2020-02-17 19:05:00 +01:00
Emilio Cobos Álvarez
f96dcf97f0 options: Add an opt-in to recover the size_t behavior removed in 5d38f2ac. 2020-02-03 13:20:21 +01:00
Emilio Cobos Álvarez
e951825e85 ir: codegen: Handle too large bitfield units.
By not generating various code for it.

In the future, we could improve on this by splitting contiguous bitfield units,
if needed, so that we can implement them without dealing with rust array derive
limits.

Fixes #1718
2020-02-02 23:10:49 +01:00
Emilio Cobos Álvarez
0153dfe230 ir: Account for packedness when computing bitfield sizes.
Fixes #1716
2020-01-29 02:27:24 +01:00
Emilio Cobos Álvarez
7941b9107a codegen: Max guaranteed alignment is 8 (with u64), not target pointer width. 2020-01-13 02:33:01 +01:00
Emilio Cobos Álvarez
9a2ce1ca6e Remove padding for over-aligned structs when we support repr(align).
Before repr(align), we could only safely guarantee up to 8-bytes of alignment (I
think the pointer-width check is a more conservative way of doing that, in
practice, because I _think_ u64 is 8-byte aligned even for smaller targets).

So when we may generate a potentially-under-aligned struct, we always used to
pad it so as to guarantee that at least the size (and thus reads from rust for
C-allocated structs) was fine.

But if we support repr(align), then the above is always unneeded.
2020-01-13 02:33:01 +01:00
Sebastian Imlay
ba409edf5d Added non-keyword support to objective-c methods. 2020-01-05 14:05:35 +01:00
simlay
f39c4a95cb An initial implementation of objective-c generics for #1259 (#1702) 2020-01-05 14:04:15 +01:00
Conor McAvity
5d38f2aca6 Remove size_t to usize conversion rule 2019-12-13 23:03:15 +01:00
Emilio Cobos Álvarez
560354e4f1
tests: Minor rustc warning fixes. 2019-12-11 03:13:46 +01:00
Jasper-Bekkers
09f6c1d921 Add support for wasm_import_module 2019-12-11 01:48:01 +01:00
David Vo
ac498475e0 Add newtype enum style
This adds an enum style similar to the existing bitfield style, without
the bitwise operator impls.

Closes: #1669
2019-11-14 17:35:38 +01:00
Jon Gjengset
f27fe97089 Warn rather than panic on unknown namespace prefix
When a #defined token was used before a namespace, like so (#1676):

    #define nssv_inline_ns inline
    nssv_inline_ns namespace literals {}

bindgen would crash when encountering the unknown token preceding the
namespace token. This is because we don't get to see "past" the ifdef to
the underlying token. The true fix to this is to find a way to extract
ifdef info through clang, but for the time being we simply change the
panic into a warning when such a token is encountered, and then proceed
as if it were empty.

Fixes #1676.
2019-11-14 15:10:05 +01:00