Skip to content

Commit

Permalink
Merge pull request #1546 from GuillaumeGomez/cfg-abi
Browse files Browse the repository at this point in the history
Correctly generate cfg condition for ABI tests
  • Loading branch information
sdroege committed Feb 7, 2024
2 parents ba6727d + fec8745 commit 689d9ff
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/codegen/sys/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -518,7 +519,13 @@ fn get_c_output(name: &str) -> Result<String, Box<dyn Error>> {
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)?;
}
Expand Down

0 comments on commit 689d9ff

Please sign in to comment.