Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit ea35da9

Browse files
committed
map rust target to clang target if not the same
1 parent 16cc9a0 commit ea35da9

File tree

1 file changed

+16
-5
lines changed
  • tests/run-make/core-ffi-typecheck-clang

1 file changed

+16
-5
lines changed

tests/run-make/core-ffi-typecheck-clang/rmake.rs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,15 @@ const SKIPPED_TARGETS: &[&str] = &[
4949
"xtensa-esp32s3-none-elf",
5050
];
5151

52+
/// Map from a Rust target to the Clang target if they are not the same.
53+
const MAPPED_TARGETS: &[(&str, &str)] = &[
54+
("aarch64-apple-ios-sim", "aarch64-apple-ios"),
55+
("aarch64-apple-tvos-sim", "aarch64-apple-tvos"),
56+
("aarch64-apple-visionos-sim", "aarch64-apple-visionos"),
57+
("aarch64-apple-watchos-sim", "aarch64-apple-watchos"),
58+
("x86_64-apple-watchos-sim", "x86_64-apple-watchos"),
59+
];
60+
5261
fn main() {
5362
let targets = get_target_list();
5463

@@ -61,13 +70,15 @@ fn main() {
6170
continue;
6271
}
6372

73+
// Map the Rust target string to a Clang target string if needed.
74+
let ctarget = match MAPPED_TARGETS.iter().find(|(rtarget, _ctarget)| rtarget == &target) {
75+
Some((_rtarget, ctarget)) => ctarget,
76+
None => target,
77+
};
78+
6479
// Run Clang's preprocessor for the relevant target, printing default macro definitions.
6580
let clang_output =
66-
clang().args(&["-E", "-dM", "-x", "c", "/dev/null", "-target", target]).run();
67-
68-
if !clang_output.status().success() {
69-
continue;
70-
}
81+
clang().args(&["-E", "-dM", "-x", "c", "/dev/null", "-target", ctarget]).run();
7182

7283
let defines = String::from_utf8(clang_output.stdout()).expect("Invalid UTF-8");
7384

0 commit comments

Comments
 (0)