Skip to content

Commit

Permalink
Switch from attributes to callbacks.
Browse files Browse the repository at this point in the history
This is a major change to autocxx-bindgen which aims to improve maintainability
by reducing divergence from upstream bindgen. Specifically, it:

* Significantly reduces the textual diffence
* Makes the remaining changes less invasive, such that merge conflicts should
  be easier to resolve
* Redoes the changes such that they're more attuned to the current
  evolution of upstream bindgen, so it may be possible to upstream some or
  ideally all of these changes. (The ultimate goal is to unfork bindgen!)

See google/autocxx#124 and
rust-lang#2943 for the background here.

Specifically this change:
* Removes the #[bindgen_semantic_attributes] which were added to all
  sorts of items. Instead,
* Much more is communicated via the existing ParseCallbacks mechansim.
* In some cases, it's still necessary to annotate individual types -
  in this case we generate a newtype wrapper instead of attributes.

This commit also re-enables the bindgen test suite. It does not yet add
tests for all the above new functionality; that's yet to come.
  • Loading branch information
adetaylor committed Feb 14, 2025
1 parent 40daade commit 90fc72d
Show file tree
Hide file tree
Showing 113 changed files with 784 additions and 911 deletions.
112 changes: 112 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ members = [
"bindgen",
#"bindgen-cli",
#"bindgen-integration",
#"bindgen-tests",
"bindgen-tests",
#"bindgen-tests/tests/quickchecking",
#"bindgen-tests/tests/expectations",
]
Expand All @@ -22,7 +22,7 @@ edition = "2021"
# All dependency version management is centralized here
[workspace.dependencies]
annotate-snippets = "0.11.4"
bindgen = { version = "0.71.1", path = "./bindgen", default-features = false }
autocxx-bindgen = { version = "0.71.1", path = "./bindgen", default-features = false }
bitflags = "2.2.1"
block = "0.1"
cc = "1.0"
Expand Down
14 changes: 7 additions & 7 deletions bindgen-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ rust-version.workspace = true
edition.workspace = true

[dev-dependencies]
bindgen = { workspace = true, default-features = true, features = ["__cli", "experimental"] }
autocxx-bindgen = { workspace = true, default-features = true, features = ["__cli", "experimental"] }
owo-colors.workspace = true
prettyplease = { workspace = true, features = ["verbatim"] }
proc-macro2.workspace = true
Expand All @@ -19,10 +19,10 @@ syn.workspace = true
tempfile.workspace = true

[features]
logging = ["bindgen/logging"]
static = ["bindgen/static"]
runtime = ["bindgen/runtime"]
logging = ["autocxx-bindgen/logging"]
static = ["autocxx-bindgen/static"]
runtime = ["autocxx-bindgen/runtime"]

__testing_only_extra_assertions = ["bindgen/__testing_only_extra_assertions"]
__testing_only_libclang_9 = ["bindgen/__testing_only_libclang_9"]
__testing_only_libclang_16 = ["bindgen/__testing_only_libclang_16"]
__testing_only_extra_assertions = ["autocxx-bindgen/__testing_only_extra_assertions"]
__testing_only_libclang_9 = ["autocxx-bindgen/__testing_only_libclang_9"]
__testing_only_libclang_16 = ["autocxx-bindgen/__testing_only_libclang_16"]
2 changes: 0 additions & 2 deletions bindgen-tests/tests/expectations/tests/381-decltype-alias.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion bindgen-tests/tests/expectations/tests/allowlist_basic.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions bindgen-tests/tests/expectations/tests/anon_enum_trait.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions bindgen-tests/tests/expectations/tests/anon_union.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion bindgen-tests/tests/expectations/tests/builtin-template.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions bindgen-tests/tests/expectations/tests/class_nested.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 6 additions & 21 deletions bindgen-tests/tests/expectations/tests/class_with_enum.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 90fc72d

Please sign in to comment.