aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/execute/torture/macros12.rs
blob: deb424ffdbc1bdd938bda9426624b4ad4f317e05 (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 "0\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)?) => (0 $(+ $e)?)
}

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

    0
}