Debian Codegraph @

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

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