]> git.lizzy.rs Git - rust.git/blob - src/test/ui/asm/inline-syntax.rs
Rollup merge of #87910 - iago-lito:mark_unsafe_nonzero_arithmetics_as_const, r=joshtr...
[rust.git] / src / test / ui / asm / inline-syntax.rs
1 // revisions: x86_64 arm
2 //[x86_64] compile-flags: --target x86_64-unknown-linux-gnu
3 //[x86_64] check-pass
4 //[x86_64] needs-llvm-components: x86
5 //[x86_64_allowed] compile-flags: --target x86_64-unknown-linux-gnu
6 //[x86_64_allowed] check-pass
7 //[x86_64_allowed] needs-llvm-components: x86
8 //[arm] compile-flags: --target armv7-unknown-linux-gnueabihf
9 //[arm] build-fail
10 //[arm] needs-llvm-components: arm
11
12 #![feature(no_core, lang_items, rustc_attrs)]
13 #![crate_type = "rlib"]
14 #![no_core]
15 #![cfg_attr(x86_64_allowed, allow(bad_asm_style))]
16
17 #[rustc_builtin_macro]
18 macro_rules! asm {
19     () => {};
20 }
21 #[rustc_builtin_macro]
22 macro_rules! global_asm {
23     () => {};
24 }
25
26 #[lang = "sized"]
27 trait Sized {}
28
29 pub fn main() {
30     unsafe {
31         asm!(".intel_syntax noprefix", "nop");
32         //[x86_64]~^ WARN avoid using `.intel_syntax`
33         //[arm]~^^ ERROR unknown directive
34         asm!(".intel_syntax aaa noprefix", "nop");
35         //[x86_64]~^ WARN avoid using `.intel_syntax`
36         //[arm]~^^ ERROR unknown directive
37         asm!(".att_syntax noprefix", "nop");
38         //[x86_64]~^ WARN avoid using `.att_syntax`
39         //[arm]~^^ ERROR unknown directive
40         asm!(".att_syntax bbb noprefix", "nop");
41         //[x86_64]~^ WARN avoid using `.att_syntax`
42         //[arm]~^^ ERROR unknown directive
43         asm!(".intel_syntax noprefix; nop");
44         //[x86_64]~^ WARN avoid using `.intel_syntax`
45         //[arm]~^^ ERROR unknown directive
46
47         asm!(
48             r"
49             .intel_syntax noprefix
50             nop"
51         );
52         //[x86_64]~^^^ WARN avoid using `.intel_syntax`
53         //[arm]~^^^^ ERROR unknown directive
54     }
55 }
56
57 global_asm!(".intel_syntax noprefix", "nop");
58 //[x86_64]~^ WARN avoid using `.intel_syntax`
59 // Assembler errors don't have line numbers, so no error on ARM