diff --git a/src/bindgen/ir/constant.rs b/src/bindgen/ir/constant.rs index 79d328c4d..4022a09e2 100644 --- a/src/bindgen/ir/constant.rs +++ b/src/bindgen/ir/constant.rs @@ -548,7 +548,7 @@ impl Literal { Language::C => write!(out, "({})", export_name), Language::Cxx => write!(out, "{}", export_name), Language::Cython => write!(out, "<{}>", export_name), - Language::Zig => write!(out, ":{} = ", export_name), + Language::Zig => write!(out, ":{} = .", export_name), } write!(out, "{{ "); @@ -811,7 +811,11 @@ impl Constant { Language::Zig => { out.write(config.style.zig_def()); self.ty.write(config, out); - write!(out, "{} = ", name); + if let Literal::Struct { .. } = &self.value { + write!(out, "{} ", name); + } else { + write!(out, "{} = ", name); + } value.write(config, out); write!(out, ";"); } diff --git a/src/bindgen/ir/field.rs b/src/bindgen/ir/field.rs index d7a8826f0..3af9a3348 100644 --- a/src/bindgen/ir/field.rs +++ b/src/bindgen/ir/field.rs @@ -71,13 +71,13 @@ impl Source for Field { cdecl::write_field(out, &self.ty, &self.name, config); // Cython extern declarations don't manage layouts, layouts are defined entierly by the // corresponding C code. So we can omit bitfield sizes which are not supported by Cython. - if config.language != Language::Cython || config.language != Language::Zig { + if config.language != Language::Cython && config.language != Language::Zig { if let Some(bitfield) = self.annotations.atom("bitfield") { write!(out, ": {}", bitfield.unwrap_or_default()); } } - if config.language != Language::Cython || config.language != Language::Zig { + if config.language != Language::Cython && config.language != Language::Zig { condition.write_after(config, out); // FIXME(#634): `write_vertical_source_list` should support // configuring list elements natively. For now we print a newline