Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly generate cfg condition for ABI tests #1546

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading