Static rustc_lint_defs::builtin::BAD_ASM_STYLE [−][src]
pub static BAD_ASM_STYLE: &Lint
Expand description
The bad_asm_style lint detects the use of the .intel_syntax and
.att_syntax directives.
Example
ⓘ
#![feature(asm)] fn main() { #[cfg(target_arch="x86_64")] unsafe { asm!( ".att_syntax", "movl {0}, {0}", in(reg) 0usize ); } }
This will produce:
warning: avoid using `.att_syntax`, prefer using `options(att_syntax)` instead
--> test.rs:7:14
|
7 | ".att_syntax",
| ^^^^^^^^^^^
8 | "movq {0}, {0}", out(reg) _,
9 | );
| - help: add option: `, options(att_syntax)`
|
= note: `#[warn(bad_asm_style)]` on by default
Explanation
On x86, asm! uses the intel assembly syntax by default. While this
can be switched using assembler directives like .att_syntax, using the
att_syntax option is recommended instead because it will also properly
prefix register placeholders with % as required by AT&T syntax.