Skip to content

Add bad_asm_style to HardwiredLints #84068

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions compiler/rustc_lint_defs/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2944,6 +2944,7 @@ declare_lint_pass! {
NONTRIVIAL_STRUCTURAL_MATCH,
SOFT_UNSTABLE,
INLINE_NO_SANITIZE,
BAD_ASM_STYLE,
ASM_SUB_REGISTER,
UNSAFE_OP_IN_UNSAFE_FN,
INCOMPLETE_INCLUDE,
Expand Down
12 changes: 6 additions & 6 deletions src/test/ui/asm/inline-syntax.arm.stderr
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
error: unknown directive
--> $DIR/inline-syntax.rs:22:15
--> $DIR/inline-syntax.rs:25:15
|
LL | asm!(".intel_syntax noprefix", "nop");
| ^
Expand All @@ -11,7 +11,7 @@ LL | .intel_syntax noprefix
| ^

error: unknown directive
--> $DIR/inline-syntax.rs:25:15
--> $DIR/inline-syntax.rs:28:15
|
LL | asm!(".intel_syntax aaa noprefix", "nop");
| ^
Expand All @@ -23,7 +23,7 @@ LL | .intel_syntax aaa noprefix
| ^

error: unknown directive
--> $DIR/inline-syntax.rs:28:15
--> $DIR/inline-syntax.rs:31:15
|
LL | asm!(".att_syntax noprefix", "nop");
| ^
Expand All @@ -35,7 +35,7 @@ LL | .att_syntax noprefix
| ^

error: unknown directive
--> $DIR/inline-syntax.rs:31:15
--> $DIR/inline-syntax.rs:34:15
|
LL | asm!(".att_syntax bbb noprefix", "nop");
| ^
Expand All @@ -47,7 +47,7 @@ LL | .att_syntax bbb noprefix
| ^

error: unknown directive
--> $DIR/inline-syntax.rs:34:15
--> $DIR/inline-syntax.rs:37:15
|
LL | asm!(".intel_syntax noprefix; nop");
| ^
Expand All @@ -59,7 +59,7 @@ LL | .intel_syntax noprefix; nop
| ^

error: unknown directive
--> $DIR/inline-syntax.rs:40:13
--> $DIR/inline-syntax.rs:43:13
|
LL | .intel_syntax noprefix
| ^
Expand Down
3 changes: 3 additions & 0 deletions src/test/ui/asm/inline-syntax.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@
// revisions: x86_64 arm
//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu
//[x86_64] check-pass
//[x86_64_allowed] compile-flags: --target x86_64-unknown-linux-gnu
//[x86_64_allowed] 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]
#![cfg_attr(x86_64_allowed, allow(bad_asm_style))]

#[rustc_builtin_macro]
macro_rules! asm {
Expand Down
12 changes: 6 additions & 6 deletions src/test/ui/asm/inline-syntax.x86_64.stderr
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
warning: avoid using `.intel_syntax`, Intel syntax is the default
--> $DIR/inline-syntax.rs:22:15
--> $DIR/inline-syntax.rs:25:15
|
LL | asm!(".intel_syntax noprefix", "nop");
| ^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(bad_asm_style)]` on by default

warning: avoid using `.intel_syntax`, Intel syntax is the default
--> $DIR/inline-syntax.rs:25:15
--> $DIR/inline-syntax.rs:28:15
|
LL | asm!(".intel_syntax aaa noprefix", "nop");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead
--> $DIR/inline-syntax.rs:28:15
--> $DIR/inline-syntax.rs:31:15
|
LL | asm!(".att_syntax noprefix", "nop");
| ^^^^^^^^^^^^^^^^^^^^

warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead
--> $DIR/inline-syntax.rs:31:15
--> $DIR/inline-syntax.rs:34:15
|
LL | asm!(".att_syntax bbb noprefix", "nop");
| ^^^^^^^^^^^^^^^^^^^^^^^^

warning: avoid using `.intel_syntax`, Intel syntax is the default
--> $DIR/inline-syntax.rs:34:15
--> $DIR/inline-syntax.rs:37:15
|
LL | asm!(".intel_syntax noprefix; nop");
| ^^^^^^^^^^^^^^^^^^^^^^

warning: avoid using `.intel_syntax`, Intel syntax is the default
--> $DIR/inline-syntax.rs:40:13
--> $DIR/inline-syntax.rs:43:13
|
LL | .intel_syntax noprefix
| ^^^^^^^^^^^^^^^^^^^^^^
Expand Down