diff --git a/Cargo.toml b/Cargo.toml index e93fac674..144c736ed 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -29,7 +29,7 @@ serde_json = "1" # Related to tooling/build setup. # * regex: not used for unicode parsing -> features unicode-bool + unicode-gencat are enabled instead of unicode-perl. # 'unicode-gencat' needed for \d, see https://docs.rs/regex/latest/regex/#unicode-features. -bindgen = { version = "0.71", default-features = false, features = ["runtime"] } +bindgen = { version = "0.72.1", default-features = false, features = ["runtime"] } libc = "0.2.172" regex = { version = "1.11", default-features = false, features = ["std", "unicode-bool", "unicode-gencat"] } which = "7" diff --git a/godot-bindings/src/header_gen.rs b/godot-bindings/src/header_gen.rs index c6fc2d9a6..d999d383e 100644 --- a/godot-bindings/src/header_gen.rs +++ b/godot-bindings/src/header_gen.rs @@ -26,7 +26,13 @@ pub(crate) fn generate_rust_binding(in_h_path: &Path, out_rs_path: &Path) { let builder = bindgen::Builder::default() .header(c_header_path) .parse_callbacks(Box::new(cargo_cfg)) - .prepend_enum_name(false); + .prepend_enum_name(false) + // Bindgen can generate wrong size checks for types defined as `__attribute__((aligned(__alignof__(struct {...}))))`, + // which is how clang defines max_align_t: https://clang.llvm.org/doxygen/____stddef__max__align__t_8h_source.html. + // Size checks seems to be fine on all the targets but `wasm32-unknown-emscripten`, disallowing web builds. + // We don't use `max_align_t` anywhere, so blacklisting it until upstream fixes the problem seems to be the most sane solution. + // See: https://github.com/rust-lang/rust-bindgen/issues/3295. + .blocklist_type("max_align_t"); std::fs::create_dir_all( out_rs_path