aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/rust/execute/torture/macros7.rs
blob: b8af009aed4c59b2bc8bd4f13209290e80b6ae35 (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 "any\r*\nany\r*\nany\r*\n" }
extern "C" {
    fn printf(s: *const i8, ...);
}

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

    unsafe {
        printf(c_p);
    }
}

macro_rules! any {
    ($($a:expr)*) => {
        f();
    };
}

fn main() -> i32 {
    any!();
    any!(a + b);
    any!(a + b    14 "gcc");

    0
}