about summary refs log tree commit diff
path: root/src/tools/clippy/tests/ui/asm_syntax_x86.rs
blob: 4e91f27cd31894bc5ad42f2c05fbdf193826bcfe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//@only-target: i686 x86_64

#[warn(clippy::inline_asm_x86_intel_syntax)]
mod warn_intel {
    use std::arch::{asm, global_asm};

    pub(super) unsafe fn use_asm() {
        asm!("");
        //~^ inline_asm_x86_intel_syntax

        asm!("", options());
        //~^ inline_asm_x86_intel_syntax

        asm!("", options(nostack));
        //~^ inline_asm_x86_intel_syntax

        asm!("", options(att_syntax));
        asm!("", options(nostack, att_syntax));
    }

    global_asm!("");
    //~^ inline_asm_x86_intel_syntax

    global_asm!("", options());
    //~^ inline_asm_x86_intel_syntax

    global_asm!("", options(att_syntax));
}

#[warn(clippy::inline_asm_x86_att_syntax)]
mod warn_att {
    use std::arch::{asm, global_asm};

    pub(super) unsafe fn use_asm() {
        asm!("");
        asm!("", options());
        asm!("", options(nostack));
        asm!("", options(att_syntax));
        //~^ inline_asm_x86_att_syntax

        asm!("", options(nostack, att_syntax));
        //~^ inline_asm_x86_att_syntax
    }

    global_asm!("");
    global_asm!("", options());
    global_asm!("", options(att_syntax));
    //~^ inline_asm_x86_att_syntax
}

fn main() {
    unsafe {
        warn_att::use_asm();
        warn_intel::use_asm();
    }
}