forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#83437 - Amanieu:asm_syntax, r=petrochenkov
Refactor rust-lang#82270 as lint instead of an error This PR fixes several issues with rust-lang#82270 which generated an error when `.intel_syntax` or `.att_syntax` was used in inline assembly: - It is now a warn-by-default lint instead of an error. - The lint only triggers on x86. `.intel_syntax` and `.att_syntax` are only valid on x86. - The lint no longer provides machine-applicable suggestions for two reasons: - These changes should not be made automatically since changes to assembly code can be very subtle. - The template string is not always just a string: it can contain macro invocation (`concat!`), raw strings, escape characters, etc. cc `@asquared31415`
- Loading branch information
Showing
6 changed files
with
179 additions
and
118 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 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
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 |
---|---|---|
@@ -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: 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 2 previous errors | ||
error: aborting due to 6 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 |
---|---|---|
@@ -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 | ||
|