gcc/testsuite/rust/execute/torture/macros9.rs
raw| 1 | // { dg-output "oom\r*\noom\r*\noom\r*\n" } |
| 2 | extern "C" { |
| 3 | fn printf(s: *const i8, ...); |
| 4 | } |
| 5 | |
| 6 | fn f() { |
| 7 | let r_s = "oom\n\0"; |
| 8 | let s_p = r_s as *const str; |
| 9 | let c_p = s_p as *const i8; |
| 10 | |
| 11 | unsafe { |
| 12 | printf(c_p); |
| 13 | } |
| 14 | } |
| 15 | |
| 16 | macro_rules! one_or_more { |
| 17 | ($($a:expr)+) => { |
| 18 | f(); |
| 19 | }; |
| 20 | } |
| 21 | |
| 22 | fn main() -> i32 { |
| 23 | one_or_more!(f()); |
| 24 | one_or_more!(f() f()); |
| 25 | one_or_more!(f() f() 15 + 12); |
| 26 | |
| 27 | 0 |
| 28 | } |