Commit Graph

3314 Commits

Author SHA1 Message Date
openharmony_ci 12a9d9c85f !7 rust_bindgen适配syn升级至2.0
Merge pull request !7 from Future/master
OpenHarmony-v5.0.3-Release OpenHarmony-v5.0.2-Release OpenHarmony-v5.0.1-Release OpenHarmony-v5.0.0-Release OpenHarmony-v5.0-Beta1
2024-04-08 15:02:28 +00:00
徐未来 ad75cef3e3 适配syn升级至2.0
Signed-off-by: 徐未来 <xuweilai2@huawei.com>
2024-04-02 15:05:30 +08:00
openharmony_ci 4a8ad4201d !6 OAT 查缺补漏
Merge pull request !6 from fangting/master
OpenHarmony-v4.1.4-Release OpenHarmony-v4.1.3-Release OpenHarmony-v4.1.2-Release OpenHarmony-v4.0.4-Release OpenHarmony-v4.0.3-Release OpenHarmony-v4.0.2-Release OpenHarmony-v4.1-Release OpenHarmony-v4.0-Release OpenHarmony-v4.0.1-Release OpenHarmony-v4.1-Beta1 OpenHarmony-v4.1.1-Release master-v weekly_20240115-v
2023-08-07 03:36:42 +00:00
fangting 9d45033aa0 OAT补漏
Signed-off-by: fangting <fangting12@huawei.com>
2023-08-07 10:45:51 +08:00
openharmony_ci 9726f752fb !5 Add oh user guide
Merge pull request !5 from fangting/master
OpenHarmony-v4.0-Beta1 OpenHarmony-v4.0-Beta2
2023-05-04 06:17:03 +00:00
fangting 71a0ae1f77 add oh user guide
Signed-off-by: fangting <fangting12@huawei.com>
2023-05-04 11:58:04 +08:00
openharmony_ci d38bf94a83 !4 Add README_zh.md
Merge pull request !4 from fangting/readme_zh
2023-04-25 03:45:14 +00:00
fangting 3ccb35ccbb Add RAEDME_zh.md
Issue:#I6YAO1

Signed-off-by: fangting <fangting12@huawei.com>
2023-04-25 10:18:36 +08:00
openharmony_ci eb7e6a4968 !2 Add OAT.xml and README.OpenSource
Merge pull request !2 from fangting/master
2023-04-14 08:11:09 +00:00
fangting bb75b69ed4 Add OAT.xml and README.OpenSource
Signed-off-by: fangting <fangting12@huawei.com>
2023-04-14 14:14:38 +08:00
openharmony_ci e0f82c2c4a !1 [bindgen]Add GN Build Files and Custom Modifications to Rust Third-party Libraries
Merge pull request !1 from lubinglun/master
2023-04-13 11:34:32 +00:00
lubinglun e1e25344e6 Add GN Build Files and Custom Modifications
Issue:https://gitee.com/openharmony/build/issues/I6UFTP
Signed-off-by: lubinglun <lubinglun@huawei.com>
2023-04-12 17:25:45 +08:00
Justin W Smith ae6817256a Release 0.64.0 Request (#2399)
Prepare 0.64.0 Release

---------

Co-authored-by: Christian Poveda <christian.poveda@ferrous-systems.com>
github.com/rust-lang/rust-bindgen/v0.64.0 github.com/rust-lang/rust-bindgen.git/v0.64.0
2023-02-07 10:36:50 -05:00
Christian Poveda Ruiz 2be14a3345 Generate extern wrappers for inlined functions (#2335)
* Generate extern wrappers for inlined functions

If bindgen finds an inlined function and the
`--generate-extern-functions` options is enabled, then:

- It will generate two new source and header files with external
  functions that wrap the inlined functions.
- Rerun `Bindings::generate` using the new header file to include these
  wrappers in the generated bindings.

The following additional options were added:
- `--extern-function-suffix=<suffix>`: Adds <suffix> to the name of each
  external wrapper function (`__extern` is used by default).
- `--extern-functions-file-name=<name>`: Uses <name> as the file name
  for the header and source files (`extern` is used by default).
- `--extern-function-directory=<dir>`: Creates the source and header
  files inside <dir> (`/tmp/bindgen` is used by default).

The C code serialization is experimental and only supports a very
limited set of C functions.

Fixes #1090.

---------

Co-authored-by: Amanjeev Sethi <aj@amanjeev.com>
2023-02-07 10:13:48 -05:00
Christian Poveda Ruiz 62b48c5670 Fix wrong entry in changelog (#2404) 2023-02-06 15:40:30 -05:00
Josh Guilfoyle a7ff8e1360 Add *-espidf target triple mappings (#2397)
Fixes #2396.

This makes it possible to workaround cc/bindgen issues with esp-rs
projects by using only environment varaibles (TARGET_CC, CLANG_PATH,
etc).  Without this, it requires modifying each crate's build.rs that
you try to depend on to add a target option passed along to clang.
2023-01-25 17:54:19 -05:00
Dan Dumont bca47cd9c2 Implement cli option for custom derive (#2328)
* custom derives after DeriveInfo

* Introduce `TypeKind` instead of `CompKind`

* Add tests

* Emit CLI flags for callbacks

* update changelog

* run rustfmt

* fix tests

* fix features

Co-authored-by: Christian Poveda <christian.poveda@ferrous-systems.com>
2023-01-20 15:12:42 -05:00
Christian Poveda Ruiz 190a017a10 Migrate CLI argument parse to the clap derive API (#2390)
* Migrate CLI argument parsing to the derive API

* Fix docs

* Fix tests

* Use `override_usage`

* Update changelog
2023-01-18 12:38:19 -05:00
Christian Poveda Ruiz 758ec87c95 Remove any references to master (#2391) 2023-01-18 12:23:13 -05:00
Amanjeev Sethi 6322b2d9eb Add trigger for push to main branch for sync'ing with master (#2387)
* gh action for merging main to master on pr merge

* remove pull_request as trigger. only use push, that is after merging the pull_request
2023-01-16 11:21:36 -05:00
Andrew Walbran ed2d06eae3 Update to clap 4. (#2380)
* Update to clap 4.

* Bump MSRV to minimum required by clap 4.

* Mention clap update in CHANGELOG.
2023-01-12 15:37:48 -05:00
Christian Poveda Ruiz e6dd2c6363 Document semantic difference between constructors and wrappers (#2385) 2023-01-10 17:00:27 -05:00
Amanjeev Sethi 8ebeef4502 fix: test runner for fuzzy tests and update documentation
Signed-off-by: Amanjeev Sethi <aj@amanjeev.com>
2023-01-08 01:12:53 +01:00
Emilio Cobos Álvarez 5875949e8e codegen: Look through typedefs to detect void return type. (#2379)
* codegen: Look through typedefs to detect void return type.

And reuse a bit more code.

Should fix #2377, but needs a test (can't run tests atm).

* Add tests

* Run rustfmt

* Update changelog

Co-authored-by: Christian Poveda <christian.poveda@ferrous-systems.com>
2023-01-06 13:07:28 -05:00
Christian Poveda Ruiz 1abaf7ebbf Run doctoc (#2376) 2022-12-16 12:15:04 -05:00
Christian Poveda Ruiz 3f1b9ae995 Document how to format code (#2375)
* Document how to format code

* Fix typo

* Fix formatting

* Ignore code snippet
2022-12-15 16:16:38 -05:00
Christian Poveda Ruiz 87b535c3c1 Extend documentation about deprecation of wildcard patterns (#2374) 2022-12-15 16:02:28 -05:00
Christian Poveda Ruiz c17c292c73 Fix clippy warnings (#2371) 2022-12-09 16:15:59 -05:00
Christian Poveda Ruiz 8582fb383d Bump clang-sys version (#2368)
* Bump `clang-sys` version

* add libtinfo5 package to fix CI
2022-12-07 12:27:01 +01:00
Emilio Cobos Álvarez aa9849ba06 codegen: Do generate field offset checks for classes with multiple bases.
The bug only affects virtual inheritance, so instead disable layout
tests in the test that we know is broken. Not generating layout tests is
wrong anyways, because the offset would be wrong.
2022-12-07 12:18:35 +01:00
Christian Poveda Ruiz a9d4198531 Document callback changes and avoid static lifetime (#2366) 2022-11-28 14:01:25 -05:00
Justin W Smith 199dfcc8e5 Extend generated_name_override callback to variables (#2351)
* This change updates `ParseCallbacks::generated_name_override` to accept a second parameter indicating the kind of item the name applies to (currently, either `Function` or `Var`).
* A `CallbackItemKind` enum was added to serve as the type for this second parameter.
* Tests have been updated to verify that the names of both function and variable can be updated by this callback.
2022-11-28 13:16:10 -05:00
Christian Poveda Ruiz 690feb398b Update CHANGELOG.md (#2365) 2022-11-28 09:49:51 -05:00
David Tolnay 0a78cde484 Fix name collision between C enum and typedef (#2326)
Fixes #2008.

Example:

```c
enum Enum { Variant };
typedef int16_t Enum;
```

This is valid and idiomatic C (though not valid C++). `cbindgen` uses this idiom as the default C translation of Rust enums, the equivalent of what would be `enum Enum : int16_t { Variant };` in C++.

`bindgen header.h` before:

```rust
pub const Enum_Variant: Enum = 0;
pub type Enum = ::std::os::raw::c_uint;
pub type Enum = i16;
```

```console
error[E0428]: the name `Enum` is defined multiple times
 --> generated.rs:3:1
  |
2 | pub type Enum = ::std::os::raw::c_uint;
  | --------------------------------------- previous definition of the type `Enum` here
3 | pub type Enum = i16;
  | ^^^^^^^^^^^^^^^^^^^^ `Enum` redefined here
  |
  = note: `Enum` must be defined only once in the type namespace of this module
```

After:

```rust

pub const Enum_Variant: Enum = 0;
pub type Enum = i16;
```
2022-11-28 09:40:20 -05:00
Christian Poveda Ruiz 95fd17b874 Remove traits that have a single implementation (#2363) 2022-11-24 11:17:08 -05:00
Christian Poveda Ruiz 73f33e5a02 Fix clippy warnings (#2362) 2022-11-24 10:50:15 -05:00
Christian Poveda Ruiz 6e5a666507 Escape method fragments that happen to be rust keywords (#2359) 2022-11-23 12:48:24 -05:00
Emilio Cobos Álvarez c51591941e CONTRIBUTING: Add docs for doing a release. (#2358) 2022-11-22 13:27:27 -05:00
Christian Poveda Ruiz d828f3f7ad Release v0.63.0 (#2357) 2022-11-22 12:44:10 -05:00
Christian Poveda Ruiz 7e4174990c Deprecate Rust targets lower or equal than 1.30 (#2356) 2022-11-22 12:31:14 -05:00
Christian Poveda Ruiz 046d6f9eea Add --wrap-unsafe-ops option (#2354)
This reverts commit e8ffb42ab6 and adds a new `--wrap-unsafe-ops` option as a workaround.
2022-11-22 11:41:32 -05:00
Christian Poveda Ruiz f160d11d56 Add ParseCallbacks::process_comment (#2347)
This method can be used to process comments and replace them with whatever the user wants.
2022-11-22 11:25:13 -05:00
Christian Poveda Ruiz 34f0bacb7e Introduce DeriveInfo (#2355)
This PR introduces a new non-exhaustive `struct` called `DeriveInfo` to be used as the sole argument of `ParseCallbacks::add_derives` with the purpose of being able to extend the information passed to this method in a backwards-compatible manner, meaning that adding new fields to `DeriveInfo` won't be a breaking change when releasing a new version.
2022-11-21 10:38:42 -05:00
Christian Poveda Ruiz 8fe230830f Remove deprecated methods (#2346) 2022-11-17 10:02:29 -05:00
Fabio Valentini ce534c1a13 add LICENSE symlinks to all individually published crates 2022-11-17 14:35:56 +01:00
Emilio Cobos Álvarez c09bd2f5b5 v0.62.0 2022-11-17 04:36:23 +01:00
Christian Poveda Ruiz 678daf56a2 document regex arguments handling (#2345) 2022-11-14 12:34:05 -05:00
Christian Poveda Ruiz 4574d766d5 Document and test allowlisting and blocklisting methods (#2344) 2022-11-11 13:01:53 -05:00
Christian Poveda Ruiz 67dfa7ed41 Fix duplicated function names (#2341)
Even though this change does name deduplication in a slower way, it
avoids name collisions without any breaking changes in the test suite.

Fixes #2202
2022-11-11 11:48:39 -05:00
Christian Poveda Ruiz db4ea32e2d Handle the const struct * and struct * patterns (#2304)
Given that C keeps a different namespace for `struct`/`enum`/`union` and `typedef` aliases. The
following patterns
```c
typedef const struct foo {
    void *inner;
} *foo;

typedef struct bar {
    void *inner;
} *bar;
```
are valid C code and produces both a `struct` and a pointer called `foo`
and `bar` in different namespaces. Given that Rust does not make this
distinction, we add the `_ptr` prefix to the pointer type aliases to
avoid any name collisions.
2022-11-10 10:43:02 -05:00