Skip to content

Commit 582d900

Browse files
authored
Merge pull request #1401 from Yarwin/blocklist_max_align_t_from_codegen
Blocklist `max_align_t` from bindings generation
2 parents 315ba46 + 173592c commit 582d900

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ serde_json = "1"
2929
# Related to tooling/build setup.
3030
# * regex: not used for unicode parsing -> features unicode-bool + unicode-gencat are enabled instead of unicode-perl.
3131
# 'unicode-gencat' needed for \d, see https://docs.rs/regex/latest/regex/#unicode-features.
32-
bindgen = { version = "0.71", default-features = false, features = ["runtime"] }
32+
bindgen = { version = "0.72.1", default-features = false, features = ["runtime"] }
3333
libc = "0.2.172"
3434
regex = { version = "1.11", default-features = false, features = ["std", "unicode-bool", "unicode-gencat"] }
3535
which = "7"

godot-bindings/src/header_gen.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@ pub(crate) fn generate_rust_binding(in_h_path: &Path, out_rs_path: &Path) {
2626
let builder = bindgen::Builder::default()
2727
.header(c_header_path)
2828
.parse_callbacks(Box::new(cargo_cfg))
29-
.prepend_enum_name(false);
29+
.prepend_enum_name(false)
30+
// Bindgen can generate wrong size checks for types defined as `__attribute__((aligned(__alignof__(struct {...}))))`,
31+
// which is how clang defines max_align_t: https://clang.llvm.org/doxygen/____stddef__max__align__t_8h_source.html.
32+
// Size checks seems to be fine on all the targets but `wasm32-unknown-emscripten`, disallowing web builds.
33+
// We don't use `max_align_t` anywhere, so blacklisting it until upstream fixes the problem seems to be the most sane solution.
34+
// See: https://github.com/rust-lang/rust-bindgen/issues/3295.
35+
.blocklist_type("max_align_t");
3036

3137
std::fs::create_dir_all(
3238
out_rs_path

0 commit comments

Comments
 (0)