Skip to content

Commit

Permalink
Fix sparcv8plus test on LLVM 20
Browse files Browse the repository at this point in the history
Split this into two tests, one for LLVM 19 and one for LLVM 20.
  • Loading branch information
nikic committed Jan 22, 2025
1 parent ecda83b commit f7c01d3
Show file tree
Hide file tree
Showing 11 changed files with 92 additions and 9 deletions.
43 changes: 43 additions & 0 deletions tests/ui/abi/sparcv8plus-llvm19.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//@ revisions: sparc sparcv8plus sparc_cpu_v9 sparc_feature_v8plus sparc_cpu_v9_feature_v8plus
//@[sparc] compile-flags: --target sparc-unknown-none-elf
//@[sparc] needs-llvm-components: sparc
//@[sparcv8plus] compile-flags: --target sparc-unknown-linux-gnu
//@[sparcv8plus] needs-llvm-components: sparc
//@[sparc_cpu_v9] compile-flags: --target sparc-unknown-none-elf -C target-cpu=v9
//@[sparc_cpu_v9] needs-llvm-components: sparc
//@[sparc_feature_v8plus] compile-flags: --target sparc-unknown-none-elf -C target-feature=+v8plus
//@[sparc_feature_v8plus] needs-llvm-components: sparc
//@[sparc_cpu_v9_feature_v8plus] compile-flags: --target sparc-unknown-none-elf -C target-cpu=v9 -C target-feature=+v8plus
//@[sparc_cpu_v9_feature_v8plus] needs-llvm-components: sparc
//@ exact-llvm-major-version: 19

#![crate_type = "rlib"]
#![feature(no_core, rustc_attrs, lang_items)]
#![no_core]

#[lang = "sized"]
trait Sized {}
#[lang = "copy"]
trait Copy {}

#[rustc_builtin_macro]
macro_rules! compile_error {
() => {};
}

#[cfg(all(not(target_feature = "v8plus"), not(target_feature = "v9")))]
compile_error!("-v8plus,-v9");
//[sparc]~^ ERROR -v8plus,-v9

// FIXME: sparc_cpu_v9 should be in "-v8plus,+v9" group (fixed in LLVM 20)
#[cfg(all(target_feature = "v8plus", target_feature = "v9"))]
compile_error!("+v8plus,+v9");
//[sparcv8plus,sparc_cpu_v9_feature_v8plus,sparc_cpu_v9]~^ ERROR +v8plus,+v9

// FIXME: should be rejected
#[cfg(all(target_feature = "v8plus", not(target_feature = "v9")))]
compile_error!("+v8plus,-v9 (FIXME)");
//[sparc_feature_v8plus]~^ ERROR +v8plus,-v9 (FIXME)

#[cfg(all(not(target_feature = "v8plus"), target_feature = "v9"))]
compile_error!("-v8plus,+v9");
8 changes: 8 additions & 0 deletions tests/ui/abi/sparcv8plus-llvm19.sparc.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: -v8plus,-v9
--> $DIR/sparcv8plus.rs:29:1
|
LL | compile_error!("-v8plus,-v9");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 1 previous error

8 changes: 8 additions & 0 deletions tests/ui/abi/sparcv8plus-llvm19.sparc_cpu_v9.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: +v8plus,+v9
--> $DIR/sparcv8plus.rs:34:1
|
LL | compile_error!("+v8plus,+v9");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 1 previous error

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: +v8plus,+v9
--> $DIR/sparcv8plus.rs:34:1
|
LL | compile_error!("+v8plus,+v9");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 1 previous error

8 changes: 8 additions & 0 deletions tests/ui/abi/sparcv8plus-llvm19.sparc_feature_v8plus.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: +v8plus,-v9 (FIXME)
--> $DIR/sparcv8plus.rs:39:1
|
LL | compile_error!("+v8plus,-v9 (FIXME)");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 1 previous error

8 changes: 8 additions & 0 deletions tests/ui/abi/sparcv8plus-llvm19.sparcv8plus.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: +v8plus,+v9
--> $DIR/sparcv8plus.rs:34:1
|
LL | compile_error!("+v8plus,+v9");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 1 previous error

6 changes: 3 additions & 3 deletions tests/ui/abi/sparcv8plus.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
//@[sparc_feature_v8plus] needs-llvm-components: sparc
//@[sparc_cpu_v9_feature_v8plus] compile-flags: --target sparc-unknown-none-elf -C target-cpu=v9 -C target-feature=+v8plus
//@[sparc_cpu_v9_feature_v8plus] needs-llvm-components: sparc
//@ min-llvm-version: 19
//@ min-llvm-version: 20

#![crate_type = "rlib"]
#![feature(no_core, rustc_attrs, lang_items)]
Expand All @@ -29,10 +29,9 @@ macro_rules! compile_error {
compile_error!("-v8plus,-v9");
//[sparc]~^ ERROR -v8plus,-v9

// FIXME: sparc_cpu_v9 should be in "-v8plus,+v9" group (fixed in LLVM 20)
#[cfg(all(target_feature = "v8plus", target_feature = "v9"))]
compile_error!("+v8plus,+v9");
//[sparcv8plus,sparc_cpu_v9_feature_v8plus,sparc_cpu_v9]~^ ERROR +v8plus,+v9
//[sparcv8plus,sparc_cpu_v9_feature_v8plus]~^ ERROR +v8plus,+v9

// FIXME: should be rejected
#[cfg(all(target_feature = "v8plus", not(target_feature = "v9")))]
Expand All @@ -41,3 +40,4 @@ compile_error!("+v8plus,-v9 (FIXME)");

#[cfg(all(not(target_feature = "v8plus"), target_feature = "v9"))]
compile_error!("-v8plus,+v9");
//[sparc_cpu_v9]~^ ERROR -v8plus,+v9
6 changes: 3 additions & 3 deletions tests/ui/abi/sparcv8plus.sparc_cpu_v9.stderr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error: +v8plus,+v9
--> $DIR/sparcv8plus.rs:34:1
error: -v8plus,+v9
--> $DIR/sparcv8plus.rs:42:1
|
LL | compile_error!("+v8plus,+v9");
LL | compile_error!("-v8plus,+v9");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

error: aborting due to 1 previous error
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: +v8plus,+v9
--> $DIR/sparcv8plus.rs:34:1
--> $DIR/sparcv8plus.rs:33:1
|
LL | compile_error!("+v8plus,+v9");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/abi/sparcv8plus.sparc_feature_v8plus.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: +v8plus,-v9 (FIXME)
--> $DIR/sparcv8plus.rs:39:1
--> $DIR/sparcv8plus.rs:38:1
|
LL | compile_error!("+v8plus,-v9 (FIXME)");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/abi/sparcv8plus.sparcv8plus.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: +v8plus,+v9
--> $DIR/sparcv8plus.rs:34:1
--> $DIR/sparcv8plus.rs:33:1
|
LL | compile_error!("+v8plus,+v9");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Expand Down

0 comments on commit f7c01d3

Please sign in to comment.