From fec874523a28d14c301cd9573584c381191433aa Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 7 Feb 2024 13:54:12 +0100 Subject: [PATCH] Correctly generate cfg condition for ABI tests --- src/codegen/sys/tests.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/codegen/sys/tests.rs b/src/codegen/sys/tests.rs index 886f07990..2b5e6bbe0 100644 --- a/src/codegen/sys/tests.rs +++ b/src/codegen/sys/tests.rs @@ -11,6 +11,7 @@ use crate::{ env::Env, file_saver::save_to_file, library::{self, Bitfield, Enumeration, Namespace, Type, MAIN_NAMESPACE}, + update_cfgs, }; #[derive(Debug, PartialEq, Eq, PartialOrd, Ord)] @@ -518,7 +519,13 @@ fn get_c_output(name: &str) -> Result> { const RUST_LAYOUTS: &[(&str, Layout)] = &["# )?; for ctype in ctypes { - general::cfg_condition(w, ctype.cfg_condition.as_ref(), false, 1)?; + let ns = env.namespaces.main(); + let cfg_condition = update_cfgs::get_object_cfg_condition( + &ctype.name, + &ctype.cfg_condition, + &ns.identifier_prefixes, + ); + general::cfg_condition(w, cfg_condition.as_ref(), false, 1)?; writeln!(w, " (\"{ctype}\", Layout {{size: size_of::<{ctype}>(), alignment: align_of::<{ctype}>()}}),", ctype=ctype.name)?; }