Commit Graph

3312 Commits

Author SHA1 Message Date
Emilio Cobos Álvarez
18ed6f418e
codegen: Simplify a bit the code in #1847 2020-08-15 13:58:30 +02: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
Mike Hommey
802561e177 Add --target to the clang args earlier
Because the --target was passed after the include path detection, in
cases of cross-compilation, the include path detection would add paths
relevant to the host (e.g. /usr/include/x86_64_linux-gnu on x86_64 linux
while targeting something else), possibly breaking things along the way.
2020-08-14 11:09:19 +02:00
Emilio Cobos Álvarez
d55b063e80 context: Don't pass --target=rust-target to clang when building for the host.
This will prevent common issues in platforms where the Rust target is
not the clang target, like aarch64-apple-darwin (Rust) vs.
arm64-apple-darwin.

We may want to special-case those too when cross-compiling.
2020-08-13 15:23:05 +02:00
Varphone Wong
f91c9b6604 Cleanup some clippy::unused_io_amount errors 2020-08-09 13:02:35 +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
1127561bb2 Move __bindgen_anon_ to constant DEFAULT_ANON_FIELDS_PREFIX 2020-08-04 12:08:11 +02:00
Varphone Wong
8e6a6999e9 Fix “warning: irrefutable if-let pattern” on add to output_vector 2020-08-04 12:08:11 +02:00
Darren Kulp
4a75b21c13 Make anon-fields-prefix non-optional 2020-08-04 12:08:11 +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
7f7809f779 codegen: Use shorthand initialization in EnumBuilder.
This was introduced in #1850.
2020-08-03 20:17:57 +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
1f1766de43 ci: Remove extraneous variable declaration 2020-08-03 17:57:55 +02:00
Darren Kulp
5a638c0a11 ci: Explicitly select Ubuntu 16.04 (xenial)
Xenial was being used anyway, but it is wise to be explicit. This lets
us download a newer precompiled LLVM, too.
2020-08-03 17:57:55 +02:00
Darren Kulp
ed3ae0fcf6 ci: Remove overrides for unsupported LLVM versions 2020-08-03 17:57:55 +02:00
Darren Kulp
5678a142bc ci: Use llvm-5.0.1 to simplify target triple 2020-08-03 17:57:55 +02:00
Darren Kulp
b424c17608 Explicitly run four macOS jobs 2020-07-27 12:31:17 +02:00
Darren Kulp
5e7f2e9b11 Refactor before_install script
Remove needless pushd that was causing trouble with `set -e`

Remove old osx workaround for rvm

Add shebang line

Fix target descriptor

Support LLVM versions 9.0.1+
2020-07-27 12:31:17 +02:00
leo60228
94bce1610a Change non-fatal errors to warnings 2020-07-21 19:02:43 +02:00
Darren Kulp
3e2566d6a7 Remove obsoleted is_loaded checks
It is not clear what version of libclang these supported.

Refer to #1321, #1304, #916, #915.
2020-07-20 18:55:10 +02:00
Darren Kulp
03dbd1a3f8 Remove testing_only_libclang_3_8 and expectations 2020-07-20 18:55:10 +02:00
Darren Kulp
4ea1e21bcc Simplify handle_function_macro for clang 3.9+ 2020-07-20 18:55:10 +02:00
Darren Kulp
f4f773b611 Stop accommodating libclang 3.8 2020-07-20 18:55:10 +02:00
Darren Kulp
682a32959f Stop testing libclang 3.8 2020-07-20 18:55:10 +02:00
Darren Kulp
7427017a53 Stop accommodating libclang < 3.8 2020-07-20 18:55:10 +02:00
Darren Kulp
1bfb3ad051 Avoid needless std::mem::replace
In Rust 1.45.0, `std::mem::replace` gained the `#[must_use]` attribute,
causing a new diagnostic for some `bindgen` code :

    error: unused return value of `std::mem::replace` that must be used
       --> src/ir/comp.rs:751:17
        |
    751 | /                 mem::replace(
    752 | |                     self,
    753 | |                     CompFields::AfterComputingBitfieldUnits {
    754 | |                         fields,
    755 | |                         has_bitfield_units,
    756 | |                     },
    757 | |                 );
        | |__________________^
        |
        = note: `-D unused-must-use` implied by `-D warnings`
        = note: if you don't need the old value, you can just assign the new value directly

    error: unused return value of `std::mem::replace` that must be used
       --> src/ir/comp.rs:760:17
        |
    760 |                 mem::replace(self, CompFields::ErrorComputingBitfieldUnits);
        |                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        |
        = note: if you don't need the old value, you can just assign the new value directly

    error: aborting due to 2 previous errors
2020-07-20 12:26:11 +02:00
Emilio Cobos Álvarez
f94036fd18
Release v0.54.1 2020-07-06 19:17:12 +02:00
Emilio Cobos Álvarez
17b6ae835e
main: Remove unused use statement. 2020-07-06 19:14:22 +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
243359c36c lib: Trivially fix various command line arguments that are not properly round-tripping. 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
d4c3d4c5ff Refine test for C++ operators 2020-07-01 13:30:52 +02:00
Emilio Cobos Álvarez
a2fa62422f
lib: Fix msrv build.
error[E0277]: the trait bound `std::string::String: std::convert::From<&std::string::String>` is not satisfied
   --> src/lib.rs:460:37
    |
460 |             output_vector.push(line.into());
    |                                     ^^^^ the trait `std::convert::From<&std::string::String>` is not implemented for `std::string::String`
2020-06-29 15:36:48 +02:00
Travis Finkenauer
d8968fb275 Properly shell quote flags in test output 2020-06-29 13:25:00 +02:00
Travis Finkenauer
394648a5f1 Simplify multiple headers test
Ensure that we try to generate() the test Builder.

Remove unnecessary reserve() optimization.
2020-06-29 13:25:00 +02:00
Travis Finkenauer
3151087a3a Handle multiple headers for command_line_flags()
Output from Builder::command_line_flags() would fail if more than one
header were provided. This adds extra headers via the '-include' clang
option.
2020-06-29 13:25:00 +02:00
Emilio Cobos Álvarez
30ac96231a lib: Stop using count() to do for loops.
This itched me when reviewing #1816. Seems easier to switch those to
loop over `get_items()`, but this patch also deduplicates the code a
bit, because all that copy-pasta was also itching me.

These flags don't have ordering dependencies, so the result builder
should be equivalent.
2020-06-29 13:08:03 +02:00
Darren Kulp
a492a9ea9d Update some docs that are not changelogs 2020-06-29 03:39:19 +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
21ca3f1288 Add option to disable generated header comment 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
Travis Finkenauer
01b1418800 Output clang args after '--'
For command_line_flags(), some arguments (like '--no-record-matches')
were added after '--'. The bindgen program would interpret these as
clang args.
2020-06-29 02:48:11 +02:00
Darren Kulp
939959a7df Respect changes to BINDGEN_EXTRA_CLANG_ARGS 2020-06-22 11:40:35 +02:00
Emilio Cobos Álvarez
b2ddb9d3dd build: move the rebuild dependencies to somewhere where they don't seem test specific. 2020-06-22 02:42:00 +02:00
Darren Kulp
871d472520 Rebuild when clang_sys environment changes 2020-06-22 01:36:38 +02:00