Skip to content

Commit 7edcddd

Browse files
committed
added additional unsupported targets on clang and refactored a func name and replace portion
1 parent 1b49dbf commit 7edcddd

File tree

2 files changed

+39
-18
lines changed

2 files changed

+39
-18
lines changed

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

Lines changed: 38 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ const SKIPPED_TARGETS: &[&str] = &[
1717
"xtensa-esp32s2-none-elf",
1818
"xtensa-esp32s3-espidf",
1919
"xtensa-esp32s3-none-elf",
20+
"csky-unknown-linux-gnuabiv2",
21+
"csky-unknown-linux-gnuabiv2hf",
2022
];
2123

2224
/// Map from a Rust target to the Clang target if they are not the same.
@@ -26,14 +28,40 @@ const MAPPED_TARGETS: &[(&str, &str)] = &[
2628
("aarch64-apple-visionos-sim", "aarch64-apple-visionos"),
2729
("aarch64-apple-watchos-sim", "aarch64-apple-watchos"),
2830
("x86_64-apple-watchos-sim", "x86_64-apple-watchos"),
31+
("aarch64-pc-windows-gnullvm", "aarch64-pc-windows-gnu"),
32+
("aarch64-unknown-linux-gnu_ilp32", "aarch64-unknown-linux-gnu"),
33+
("aarch64-unknown-none-softfloat", "aarch64-unknown-none"),
34+
("aarch64-unknown-nto-qnx700", "aarch64-unknown-nto-700"),
35+
("aarch64-unknown-nto-qnx710", "aarch64-unknown-nto-710"),
36+
("aarch64-unknown-uefi", "aarch64-unknown"),
37+
("aarch64_be-unknown-linux-gnu_ilp32", "aarch64_be-unknown-linux-gnu"),
38+
("armv5te-unknown-linux-uclibceabi", "armv5te-unknown-linux"),
39+
("armv7-sony-vita-newlibeabihf", "armv7-sony-vita"),
40+
("armv7-unknown-linux-uclibceabi", "armv7-unknown-linux"),
41+
("armv7-unknown-linux-uclibceabihf", "armv7-unknown-linux"),
42+
("avr-unknown-gnu-atmega328", "avr-unknown-gnu"),
43+
("csky-unknown-linux-gnuabiv2", "csky-unknown-linux-gnu"),
44+
("i586-pc-nto-qnx700", "i586-pc-nto-700"),
45+
("i686-pc-windows-gnullvm", "i686-pc-windows-gnu"),
46+
("i686-unknown-uefi", "i686-unknown"),
47+
("loongarch64-unknown-none-softfloat", "loongarch64-unknown-none"),
48+
("mips-unknown-linux-uclibc", "mips-unknown-linux"),
49+
("mipsel-unknown-linux-uclibc", "mipsel-unknown-linux"),
50+
("powerpc-unknown-linux-gnuspe", "powerpc-unknown-linux-gnu"),
51+
("powerpc-unknown-linux-muslspe", "powerpc-unknown-linux-musl"),
52+
("powerpc-wrs-vxworks-spe", "powerpc-wrs-vxworks"),
53+
("x86_64-fortanix-unknown-sgx", "x86_64-fortanix-unknown"),
54+
("x86_64-pc-nto-qnx710", "x86_64-pc-nto-710"),
55+
("x86_64-pc-windows-gnullvm", "x86_64-pc-windows-gnu"),
56+
("x86_64-unknown-l4re-uclibc", "x86_64-unknown-l4re"),
2957
];
3058

3159
fn main() {
3260
let targets = get_target_list();
3361

3462
let minicore_path = run_make_support::source_root().join("tests/auxiliary/minicore.rs");
3563

36-
regex_mod();
64+
preprocess_core_ffi();
3765

3866
for target in targets.lines() {
3967
if SKIPPED_TARGETS.iter().any(|&to_skip_target| target == to_skip_target) {
@@ -50,14 +78,14 @@ fn main() {
5078
.unwrap_or_else(|| {
5179
if target.starts_with("riscv") {
5280
target
53-
.replace("imac", "")
54-
.replace("gc", "")
55-
.replace("imafc", "")
56-
.replace("imc", "")
57-
.replace("ima", "")
58-
.replace("im", "")
59-
.replace("emc", "")
60-
.replace("em", "")
81+
.replace("imac-", "-")
82+
.replace("gc-", "-")
83+
.replace("imafc-", "-")
84+
.replace("imc-", "-")
85+
.replace("ima-", "-")
86+
.replace("im-", "-")
87+
.replace("emc-", "-")
88+
.replace("em-", "-")
6189
.replace("e-", "-")
6290
.replace("i-", "-")
6391
} else {
@@ -172,7 +200,7 @@ fn char_is_signed(defines: &str) -> bool {
172200
}
173201

174202
/// Parse core/ffi/mod.rs to retrieve only necessary macros and type defines
175-
fn regex_mod() {
203+
fn preprocess_core_ffi() {
176204
let mod_path = run_make_support::source_root().join("library/core/src/ffi/mod.rs");
177205
let mut content = rfs::read_to_string(&mod_path);
178206

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,7 @@ cfg_if! {
2626

2727
// Verify Rust's 'c_char' has correct sign.
2828
cfg_if! {
29-
if #[cfg(target_arch = "csky")] {
30-
// FIXME: c_char signedness misallignment on csky, should be signed on CLANG
31-
const XFAIL_C_CHAR_SIGNED: bool = false;
32-
pub const TEST_C_CHAR_UNSIGNED: () = if ffi::c_char::SIGNED != XFAIL_C_CHAR_SIGNED {
33-
panic!("mismatched c_char signed, target_arch: csky");
34-
};
35-
}
36-
else if #[cfg(target_arch = "msp430")] {
29+
if #[cfg(target_arch = "msp430")] {
3730
// FIXME: c_char signedness misallignment on msp430, should be signed on CLANG
3831
const XFAIL_C_CHAR_SIGNED: bool = false;
3932
pub const TEST_C_CHAR_UNSIGNED: () = if ffi::c_char::SIGNED != XFAIL_C_CHAR_SIGNED {

0 commit comments

Comments
 (0)