Refactor #82270 as lint instead of an error
This commit is contained in:
parent
2bd94f4aa9
commit
5dabc80796
6 changed files with 179 additions and 118 deletions
|
|
@ -1,14 +1,74 @@
|
|||
error: att syntax is the default syntax on this target, and trying to use this directive may cause issues
|
||||
--> $DIR/inline-syntax.rs:23:15
|
||||
error: unknown directive
|
||||
--> $DIR/inline-syntax.rs:22:15
|
||||
|
|
||||
LL | asm!(".intel_syntax noprefix", "nop");
|
||||
| ^
|
||||
|
|
||||
note: instantiated into assembly here
|
||||
--> <inline asm>:1:2
|
||||
|
|
||||
LL | .intel_syntax noprefix
|
||||
| ^
|
||||
|
||||
error: unknown directive
|
||||
--> $DIR/inline-syntax.rs:25:15
|
||||
|
|
||||
LL | asm!(".intel_syntax aaa noprefix", "nop");
|
||||
| ^
|
||||
|
|
||||
note: instantiated into assembly here
|
||||
--> <inline asm>:1:2
|
||||
|
|
||||
LL | .intel_syntax aaa noprefix
|
||||
| ^
|
||||
|
||||
error: unknown directive
|
||||
--> $DIR/inline-syntax.rs:28:15
|
||||
|
|
||||
LL | asm!(".att_syntax noprefix", "nop");
|
||||
| ^^^^^^^^^^^^^^^^^^^^ help: remove this assembler directive
|
||||
| ^
|
||||
|
|
||||
note: instantiated into assembly here
|
||||
--> <inline asm>:1:2
|
||||
|
|
||||
LL | .att_syntax noprefix
|
||||
| ^
|
||||
|
||||
error: att syntax is the default syntax on this target, and trying to use this directive may cause issues
|
||||
--> $DIR/inline-syntax.rs:26:15
|
||||
error: unknown directive
|
||||
--> $DIR/inline-syntax.rs:31:15
|
||||
|
|
||||
LL | asm!(".att_syntax bbb noprefix", "nop");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this assembler directive
|
||||
| ^
|
||||
|
|
||||
note: instantiated into assembly here
|
||||
--> <inline asm>:1:2
|
||||
|
|
||||
LL | .att_syntax bbb noprefix
|
||||
| ^
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: unknown directive
|
||||
--> $DIR/inline-syntax.rs:34:15
|
||||
|
|
||||
LL | asm!(".intel_syntax noprefix; nop");
|
||||
| ^
|
||||
|
|
||||
note: instantiated into assembly here
|
||||
--> <inline asm>:1:2
|
||||
|
|
||||
LL | .intel_syntax noprefix; nop
|
||||
| ^
|
||||
|
||||
error: unknown directive
|
||||
--> $DIR/inline-syntax.rs:40:13
|
||||
|
|
||||
LL | .intel_syntax noprefix
|
||||
| ^
|
||||
|
|
||||
note: instantiated into assembly here
|
||||
--> <inline asm>:2:13
|
||||
|
|
||||
LL | .intel_syntax noprefix
|
||||
| ^
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
// needs-llvm-components: arm
|
||||
// revisions: x86_64 arm
|
||||
//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu
|
||||
//[x86_64] check-pass
|
||||
//[arm] compile-flags: --target armv7-unknown-linux-gnueabihf
|
||||
//[arm] build-fail
|
||||
|
||||
#![feature(no_core, lang_items, rustc_attrs)]
|
||||
#![crate_type = "rlib"]
|
||||
#![no_core]
|
||||
|
||||
#[rustc_builtin_macro]
|
||||
|
|
@ -14,26 +17,30 @@ macro_rules! asm {
|
|||
#[lang = "sized"]
|
||||
trait Sized {}
|
||||
|
||||
fn main() {
|
||||
pub fn main() {
|
||||
unsafe {
|
||||
asm!(".intel_syntax noprefix", "nop");
|
||||
//[x86_64]~^ ERROR intel syntax is the default syntax on this target
|
||||
//[x86_64]~^ WARN avoid using `.intel_syntax`
|
||||
//[arm]~^^ ERROR unknown directive
|
||||
asm!(".intel_syntax aaa noprefix", "nop");
|
||||
//[x86_64]~^ ERROR intel syntax is the default syntax on this target
|
||||
//[x86_64]~^ WARN avoid using `.intel_syntax`
|
||||
//[arm]~^^ ERROR unknown directive
|
||||
asm!(".att_syntax noprefix", "nop");
|
||||
//[x86_64]~^ ERROR using the .att_syntax directive may cause issues
|
||||
//[arm]~^^ att syntax is the default syntax on this target
|
||||
//[x86_64]~^ WARN avoid using `.att_syntax`
|
||||
//[arm]~^^ ERROR unknown directive
|
||||
asm!(".att_syntax bbb noprefix", "nop");
|
||||
//[x86_64]~^ ERROR using the .att_syntax directive may cause issues
|
||||
//[arm]~^^ att syntax is the default syntax on this target
|
||||
//[x86_64]~^ WARN avoid using `.att_syntax`
|
||||
//[arm]~^^ ERROR unknown directive
|
||||
asm!(".intel_syntax noprefix; nop");
|
||||
//[x86_64]~^ ERROR intel syntax is the default syntax on this target
|
||||
//[x86_64]~^ WARN avoid using `.intel_syntax`
|
||||
//[arm]~^^ ERROR unknown directive
|
||||
|
||||
asm!(
|
||||
r"
|
||||
.intel_syntax noprefix
|
||||
nop"
|
||||
);
|
||||
//[x86_64]~^^^ ERROR intel syntax is the default syntax on this target
|
||||
//[x86_64]~^^^ WARN avoid using `.intel_syntax`
|
||||
//[arm]~^^^^ ERROR unknown directive
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,50 +1,40 @@
|
|||
error: intel syntax is the default syntax on this target, and trying to use this directive may cause issues
|
||||
--> $DIR/inline-syntax.rs:19:15
|
||||
warning: avoid using `.intel_syntax`, Intel syntax is the default
|
||||
--> $DIR/inline-syntax.rs:22:15
|
||||
|
|
||||
LL | asm!(".intel_syntax noprefix", "nop");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: remove this assembler directive
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(bad_asm_style)]` on by default
|
||||
|
||||
error: intel syntax is the default syntax on this target, and trying to use this directive may cause issues
|
||||
--> $DIR/inline-syntax.rs:21:15
|
||||
warning: avoid using `.intel_syntax`, Intel syntax is the default
|
||||
--> $DIR/inline-syntax.rs:25:15
|
||||
|
|
||||
LL | asm!(".intel_syntax aaa noprefix", "nop");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove this assembler directive
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: using the .att_syntax directive may cause issues, use the att_syntax option instead
|
||||
--> $DIR/inline-syntax.rs:23:15
|
||||
warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead
|
||||
--> $DIR/inline-syntax.rs:28:15
|
||||
|
|
||||
LL | asm!(".att_syntax noprefix", "nop");
|
||||
| ^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: remove the assembler directive and replace it with options(att_syntax)
|
||||
|
|
||||
LL | asm!("", "nop", options(att_syntax));
|
||||
| -- ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: using the .att_syntax directive may cause issues, use the att_syntax option instead
|
||||
--> $DIR/inline-syntax.rs:26:15
|
||||
warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead
|
||||
--> $DIR/inline-syntax.rs:31:15
|
||||
|
|
||||
LL | asm!(".att_syntax bbb noprefix", "nop");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
help: remove the assembler directive and replace it with options(att_syntax)
|
||||
|
|
||||
LL | asm!("", "nop", options(att_syntax));
|
||||
| -- ^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: intel syntax is the default syntax on this target, and trying to use this directive may cause issues
|
||||
--> $DIR/inline-syntax.rs:29:15
|
||||
warning: avoid using `.intel_syntax`, Intel syntax is the default
|
||||
--> $DIR/inline-syntax.rs:34:15
|
||||
|
|
||||
LL | asm!(".intel_syntax noprefix; nop");
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ help: remove this assembler directive
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: intel syntax is the default syntax on this target, and trying to use this directive may cause issues
|
||||
--> $DIR/inline-syntax.rs:34:14
|
||||
warning: avoid using `.intel_syntax`, Intel syntax is the default
|
||||
--> $DIR/inline-syntax.rs:40:13
|
||||
|
|
||||
LL | .intel_syntax noprefix
|
||||
| ______________^
|
||||
LL | | nop"
|
||||
| |_ help: remove this assembler directive
|
||||
LL | .intel_syntax noprefix
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
error: aborting due to 6 previous errors
|
||||
warning: 6 warnings emitted
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue