81 Commits

Author SHA1 Message Date
a30054014 c1e7498e84 rust-bindgen相关依赖兼容性适配
Signed-off-by: a30054014 <aipeng3@huawei.com>
2025-04-19 16:11:11 +08:00
oh_ci 39e4f73eb8 回退 'Pull Request !9 : bindgen升级0.70.1版本' 2025-04-19 06:22:12 +00:00
月出皎兮 83fcd6d5e2 bindgen升级0.70.1版本
Signed-off-by: 月出皎兮 <xietingwei@h-partners.com>
2025-04-15 20:47:01 +08:00
Christian Poveda Ruiz 3ffe57ec78 Document semantic difference between constructors and wrappers (#2385) 2023-01-10 17:00:27 -05:00
Christian Poveda Ruiz a1943951f4 Run doctoc (#2376) 2022-12-16 12:15:04 -05:00
Christian Poveda Ruiz e7ea8f3f66 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 80fb73865d Add tutorial about non-system libraries (#2318)
* add tutorial about non-system libraries

* fix broken comment

* ignore code snippet
2022-11-01 08:16:41 -05:00
Charlie Barto c1c9ba245f Replace confusing note in cpp.md on "RVO"
The original commit adding this note referenced #778, but then went on to talk about how the problem was RVO and that the problem is not possible to solve in bindgen because bindgen can't know if RVO happened or not. However this is incorrect in several ways. The problem in #778 has nothing whatsoever to do with RVO but rather with bindgen simply not understanding the calling convention for passing or returning types that are "non trivial for the purposes of calls". This is completely consistent and does not depend on what the optimizer decided to do (after all, if callsite side calling-convention did depend on what the optimizer happened to do inside the function it would be impossible for C++ compilers to emit correct calls to external C++ functions!).

You can see this quite clearly [here](https://godbolt.org/#z:OYLghAFBqd5QCxAYwPYBMCmBRdBLAF1QCcAaPECAMzwBtMA7AQwFtMQByARg9KtQYEAysib0QXACx8BBAKoBnTAAUAHpwAMvAFYTStJg1DIApACYAQuYukl9ZATwDKjdAGFUtAK4sGIM6SuADJ4DJgAcj4ARpjEEgDspAAOqAqETgwe3r7%2ByanpAiFhkSwxcVyJdpgOGUIETMQEWT5%2BAVU1AnUNBEUR0bEJtvWNz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a2wmsKrRipVswgvq3tmo9hZoLvDIQEkIA) Notice how the body of `main` is identical no matter if copy elision is enabled or not. To get `test` passed in a register you must remove the copy constructor.

I spent a few hours being really confused by this note before I tracked down the original PR and realized what it was trying to talk about. Hopefully this saves the next person to come across it the same trouble.

As an aside I suspect the clang c bindings can already give you information on special member functions and base classes, making it fairly easy to do this correctly. AFAICT bindgen already does not rely on llvm's code generation facilities to figure out the ABI of calls for C (except perhaps indirectly, via rustc), so this seems reasonable to just do in bindgen, explicitly.
2022-10-31 11:09:27 +01:00
George Bateman 440897dadd Make doctests pass 2022-10-23 00:13:47 +01:00
George Bateman 240b76f82d Document visibility annotation 2022-10-23 00:04:31 +01:00
Christian Poveda cc77a62316 add FAQ about custom targets 2022-10-20 12:11:56 -05:00
Christian Poveda 1213b3dfb1 split the repo into a workspace
remove `clap` dependency 🎉

update the book installation instructions
2022-10-04 20:47:17 -05:00
Cameron Mulhern d1f3a77858 Enables blocklisting of Objective-C methods 2022-10-02 19:40:24 -04:00
jakobgerhardt abca2c80bc provide information how to link to shared objects 2022-05-08 00:59:20 +02:00
Henryk Paluch 8caf52f2a9 Fix panic!() argument (quote it) 2022-04-19 21:18:41 +02:00
Darren Kulp b2ffb56026 docs: Drop references to Clang 4 2022-03-15 03:54:37 +01:00
David Drysdale 52e9185ec3 Add --allowlist-file option 2022-02-18 19:34:58 +01:00
Darren Kulp e608fdf14b book: Update Clang references from 3.9 -> 4.0 2022-02-18 19:33:25 +01:00
MikuroXina 009a7ca6e3 Remove deprecation and Replace 2021-12-29 20:39:01 +01:00
MikuroXina 7b4142f8d5 Replace generate with gen in test 2021-12-29 20:39:01 +01:00
Aapo Alasuutari 0db182bcd0 Add note about RVO in cpp.md
`bindgen`'s inability to currently support RVO should be noted in C++ bindings generation document.
2021-12-07 00:19:02 +01:00
David Drysdale c1c35bec30 Add --blocklist-file option (#2097)
Update Item to hold a `clang::SourceLocation` and use this to allow
blocklisting based on filename.

The existing code has a special case that always maps <stdint.h> integer
types to corresponding Rust integer types, even if the C types are
blocklisted.  To match this special case behaviour, also treat these
C <stdint.h> types as being eligible for derived Copy/Clone/Debug
traits.

Fixes #2096
2021-11-26 02:42:47 +01:00
Karel Peeters 55470edf81 Add must-use-type to the book. 2021-07-31 13:47:39 +02:00
Fernando Jimenez Moreno 3346799101 Point book docs.rs links to latest version of the crate 2021-05-08 23:02:44 +02:00
Hengqi Chen 3f19868aa1 Fix typo
Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2021-04-27 20:43:14 +02:00
Hengqi Chen 9c46840d79 Update TOC for FAQ page
Signed-off-by: Hengqi Chen <chenhengqi@outlook.com>
2021-04-27 20:43:14 +02:00
Ryan Zoeller 8005c56b62 Document clang installation method on Fedora 2021-04-06 11:10:01 +02:00
Mehmet Oguz Derin 2860a13d4b From Nullablibility to Nullability
A basic fix
2021-03-29 15:27:20 +02:00
Marcel Hlopko 7a595a5429 Rename whitelist -> allowlist and blacklist -> blocklist
For the commandline arguments I added undocumented aliases to old flags,
to stay backwards compatible.
2021-02-18 17:25:13 +01:00
Aaron Miller aa2b6d0d6b OpenBSD requirements 2021-02-07 20:31:03 +01:00
Emilio Cobos Álvarez cd16d80899 ci: update mdbook. 2020-12-26 23:19:33 +01:00
Emilio Cobos Álvarez 248124a9ed book: Touch the book to ensure that GH actions deploy works. 2020-12-26 23:04:09 +01:00
Varphone Wong 886bf79756 Add --no-default <regex> flag
Sometimes, we need customize the implement of `Default` for certain types,
In these cases, the `nodefault` annotation can be used to prevent bindgen
to autoderive the `Default` traits for a type.
2020-11-26 11:12:02 +01:00
Sebastian Imlay 75895b6f5e 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
Varphone Wong 4dfb997ad7 Add --no-debug <regex> flag 2020-08-03 18:29:07 +02:00
Darren Kulp d2d07ca149 Update some docs that are not changelogs 2020-06-29 03:39:19 +02:00
Yisu Rem Wang dfe6352c83 Fix regex to be marked opaque
While `std::*` makes informal sense, the user may be mislead into calling `opaque_type("std::*")` instead of the correct `opaque_type("std::.*")` (as I was).
2020-06-12 11:38:50 +02:00
Mossa Merhi Reimert f3bb0359fa Update requirements.md
I was having trouble figuring out how to install Clang for bindgen, and this helped right away.
2020-05-03 16:23:09 +02:00
Sebastian Imlay e4078600a9 Initial objective-c docs 2020-03-24 11:11:04 +01:00
Arthur Gautier 412cbfb45d Update to latest version of bindgen
using version 0.51.1 would trigger a build error like:
```
   |
   |         .parse_callbacks(Box::new(bindgen::CargoCallbacks))
   |                                            ^^^^^^^^^^^^^^ not found in `bindgen`
```

when using sample from tutorial.
2020-03-16 10:52:49 +01:00
Jonas Platte 2ac15310c3 Fix written-out form of SFINAE 2020-02-19 12:14:19 +01:00
katie.martin 7b65fd54ba fix documentation typo
`book/src/cpp.md` can have little a typo fix, as a treat.
2020-02-05 02:03:23 +01:00
Orne Brocaar 73c2dd5b3a Add ,ignore to avoid that CI compiles these examples. 2020-01-13 14:22:31 +01:00
Orne Brocaar facbf2f178 Add how to deal with bindgen padding fields. 2020-01-13 14:22:31 +01:00
Robbie Harwood 8cc387b02f [book] Update most recent version of bindgen
Signed-off-by: Robbie Harwood <rharwood@redhat.com>
2019-10-26 14:10:29 +02:00
chrysn 18262a7d80 Add ParseCallbacks handler for included files
As the clang_File_tryGetRealPathName function is only exposed by
clang_sys for clang >= 7.0, this raises the clang dependency.

Closes: https://github.com/rust-lang/rust-bindgen/issues/1635

The book example code for creating a builder to run inside Cargo is
extended by using the rereun-if-changed headers.
2019-10-08 01:31:49 +02:00
Emilio Cobos Álvarez 63c27ac7f9 Update Debian requirements.
Closes #1613
2019-09-20 12:11:06 +09:00
Emilio Cobos Álvarez 4cac27ea51 Do a breaking version bump, yank 0.49.3
Fixes #1587
2019-07-02 00:02:40 +02:00
Emilio Cobos Álvarez a9b85ecabd Bump bindgen version.
NOTE: For $REASONS (see https://github.com/rust-lang/rust-bindgen/issues/1587),
this is not the actual commit that is tagged on the release.
2019-07-01 23:57:40 +02:00
Georgio Nicolas 7f7fc64245 Update bindgen version 2019-06-13 19:39:03 +03:00