aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/execute/torture/macros2.rs
blob: aca528a08aa97ac7760ece1d8839e0be0f252208 (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
// { dg-output "arg\r*\narg\r*\narg\r*\n" }
extern "C" {
    fn printf(s: *const i8, ...);
}

fn f() {
    unsafe {
        let r_s = "arg\n\0";
        let s_p = r_s as *const str;
        let c_p = s_p as *const i8;

        printf(c_p);
    }
}

macro_rules! kw0 {
    (keyword) => {
        f();
    };
}

macro_rules! kw1 {
    (fn) => {
        f();
    };
}

macro_rules! kw2 {
    (kw0 kw1 kw3) => {
        f();
    };
}

fn main() -> i32 {
    kw0!(keyword);
    kw1!(fn);
    kw2!(kw0 kw1 kw3);

    0
}