-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure ASM syntax detect
global_asm!
and asm!
only on x86 archite…
…ctures
- Loading branch information
Showing
6 changed files
with
219 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
//@ignore-target-i686 | ||
//@ignore-target-x86 | ||
//@needs-asm-support | ||
|
||
#[warn(clippy::inline_asm_x86_intel_syntax)] | ||
#[warn(clippy::inline_asm_x86_att_syntax)] | ||
mod dont_warn { | ||
use std::arch::{asm, global_asm}; | ||
|
||
pub(super) unsafe fn use_asm() { | ||
asm!(""); | ||
asm!("", options()); | ||
asm!("", options(nostack)); | ||
} | ||
|
||
global_asm!(""); | ||
global_asm!("", options()); | ||
} | ||
|
||
fn main() { | ||
unsafe { | ||
dont_warn::use_asm(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
error: Intel x86 assembly syntax used | ||
--> $DIR/asm_syntax_x86.rs:10:9 | ||
| | ||
LL | asm!(""); | ||
| ^^^^^^^^ | ||
| | ||
= help: use AT&T x86 assembly syntax | ||
= note: `-D clippy::inline-asm-x86-intel-syntax` implied by `-D warnings` | ||
= help: to override `-D warnings` add `#[allow(clippy::inline_asm_x86_intel_syntax)]` | ||
|
||
error: Intel x86 assembly syntax used | ||
--> $DIR/asm_syntax_x86.rs:12:9 | ||
| | ||
LL | asm!("", options()); | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: use AT&T x86 assembly syntax | ||
|
||
error: Intel x86 assembly syntax used | ||
--> $DIR/asm_syntax_x86.rs:14:9 | ||
| | ||
LL | asm!("", options(nostack)); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: use AT&T x86 assembly syntax | ||
|
||
error: Intel x86 assembly syntax used | ||
--> $DIR/asm_syntax_x86.rs:20:5 | ||
| | ||
LL | global_asm!(""); | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
= help: use AT&T x86 assembly syntax | ||
= note: this error originates in the macro `global_asm` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: Intel x86 assembly syntax used | ||
--> $DIR/asm_syntax_x86.rs:22:5 | ||
| | ||
LL | global_asm!("", options()); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: use AT&T x86 assembly syntax | ||
= note: this error originates in the macro `global_asm` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: AT&T x86 assembly syntax used | ||
--> $DIR/asm_syntax_x86.rs:35:9 | ||
| | ||
LL | asm!("", options(att_syntax)); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: use Intel x86 assembly syntax | ||
= note: `-D clippy::inline-asm-x86-att-syntax` implied by `-D warnings` | ||
= help: to override `-D warnings` add `#[allow(clippy::inline_asm_x86_att_syntax)]` | ||
|
||
error: AT&T x86 assembly syntax used | ||
--> $DIR/asm_syntax_x86.rs:37:9 | ||
| | ||
LL | asm!("", options(nostack, att_syntax)); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: use Intel x86 assembly syntax | ||
|
||
error: AT&T x86 assembly syntax used | ||
--> $DIR/asm_syntax_x86.rs:43:5 | ||
| | ||
LL | global_asm!("", options(att_syntax)); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: use Intel x86 assembly syntax | ||
= note: this error originates in the macro `global_asm` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to 8 previous errors | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
error: Intel x86 assembly syntax used | ||
--> $DIR/asm_syntax_x86.rs:10:9 | ||
| | ||
LL | asm!(""); | ||
| ^^^^^^^^ | ||
| | ||
= help: use AT&T x86 assembly syntax | ||
= note: `-D clippy::inline-asm-x86-intel-syntax` implied by `-D warnings` | ||
= help: to override `-D warnings` add `#[allow(clippy::inline_asm_x86_intel_syntax)]` | ||
|
||
error: Intel x86 assembly syntax used | ||
--> $DIR/asm_syntax_x86.rs:12:9 | ||
| | ||
LL | asm!("", options()); | ||
| ^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: use AT&T x86 assembly syntax | ||
|
||
error: Intel x86 assembly syntax used | ||
--> $DIR/asm_syntax_x86.rs:14:9 | ||
| | ||
LL | asm!("", options(nostack)); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: use AT&T x86 assembly syntax | ||
|
||
error: Intel x86 assembly syntax used | ||
--> $DIR/asm_syntax_x86.rs:20:5 | ||
| | ||
LL | global_asm!(""); | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
= help: use AT&T x86 assembly syntax | ||
= note: this error originates in the macro `global_asm` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: Intel x86 assembly syntax used | ||
--> $DIR/asm_syntax_x86.rs:22:5 | ||
| | ||
LL | global_asm!("", options()); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: use AT&T x86 assembly syntax | ||
= note: this error originates in the macro `global_asm` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: AT&T x86 assembly syntax used | ||
--> $DIR/asm_syntax_x86.rs:35:9 | ||
| | ||
LL | asm!("", options(att_syntax)); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: use Intel x86 assembly syntax | ||
= note: `-D clippy::inline-asm-x86-att-syntax` implied by `-D warnings` | ||
= help: to override `-D warnings` add `#[allow(clippy::inline_asm_x86_att_syntax)]` | ||
|
||
error: AT&T x86 assembly syntax used | ||
--> $DIR/asm_syntax_x86.rs:37:9 | ||
| | ||
LL | asm!("", options(nostack, att_syntax)); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: use Intel x86 assembly syntax | ||
|
||
error: AT&T x86 assembly syntax used | ||
--> $DIR/asm_syntax_x86.rs:43:5 | ||
| | ||
LL | global_asm!("", options(att_syntax)); | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: use Intel x86 assembly syntax | ||
= note: this error originates in the macro `global_asm` (in Nightly builds, run with -Z macro-backtrace for more info) | ||
|
||
error: aborting due to 8 previous errors | ||
|