aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/execute/torture/macros14.rs
blob: 189fadd9861adee107328ccd44a3bf6c1b7dc8de (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// { dg-output "15\r*\n" }
extern "C" {
    fn printf(s: *const i8, ...);
}

fn print_int(value: i32) {
    let s = "%d\n\0" as *const str as *const i8;
    unsafe {
        printf(s, value);
    }
}

macro_rules! add_exprs {
    ($($e:expr)*) => (15 $(+ $e)*)
}

fn main() -> i32 {
    // 15
    print_int(add_exprs!());

    0
}