Debian Codegraph @

gcc/testsuite/rust/execute/torture/macros11.rs

raw
1 // { dg-output "2\r*" }
2 extern "C" {
3 fn printf(s: *const i8, ...);
4 }
5
6 fn print_int(value: i32) {
7 let s = "%d\n\0";
8 let s_p = s as *const str;
9 let c_p = s_p as *const i8;
10 unsafe {
11 printf(c_p, value);
12 }
13 }
14
15 macro_rules! add_exprs {
16 ($($e:expr)?) => (0 $(+ $e)?)
17 }
18
19 fn main() -> i32 {
20 // 2
21 let a = add_exprs!(2);
22 print_int(a);
23
24 0
25 }