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

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

    unsafe {
        printf(c_p);
    }
}

macro_rules! one_or_more {
    ($($a:expr)+) => {
        f();
    };
}

fn main() -> i32 {
    one_or_more!(f());
    one_or_more!(f() f());
    one_or_more!(f() f() 15 + 12);

    0
}