| 1 |
// { dg-output "invok\r*\ninvok\r*\ninvok\r*\ninvok\r*\ninvok\r*\n" } |
| 2 |
extern "C" { |
| 3 |
fn printf(s: *const i8, ...); |
| 4 |
} |
| 5 |
|
| 6 |
fn f() { |
| 7 |
unsafe { |
| 8 |
let r_s = "invok\n\0"; |
| 9 |
let s_p = r_s as *const str; |
| 10 |
let c_p = s_p as *const i8; |
| 11 |
|
| 12 |
printf(c_p); |
| 13 |
} |
| 14 |
} |
| 15 |
|
| 16 |
macro_rules! invocation0 { |
| 17 |
(valid) => { |
| 18 |
f(); |
| 19 |
}; |
| 20 |
() => {}; |
| 21 |
} |
| 22 |
|
| 23 |
macro_rules! invocation1 { |
| 24 |
(valid) => {}; |
| 25 |
() => { |
| 26 |
f(); |
| 27 |
}; |
| 28 |
} |
| 29 |
|
| 30 |
macro_rules! invocation2 { |
| 31 |
(valid) => { |
| 32 |
f(); |
| 33 |
}; |
| 34 |
(invalid) => {}; |
| 35 |
} |
| 36 |
|
| 37 |
macro_rules! invocation3 { |
| 38 |
(this is a valid invocation) => { |
| 39 |
f(); |
| 40 |
}; |
| 41 |
(not this one) => {}; |
| 42 |
} |
| 43 |
|
| 44 |
macro_rules! invocation4 { |
| 45 |
(fn f() {}) => { |
| 46 |
f(); |
| 47 |
}; |
| 48 |
(not a keyword) => {}; |
| 49 |
} |
| 50 |
|
| 51 |
fn main() -> i32 { |
| 52 |
invocation0!(valid); |
| 53 |
invocation1!(); |
| 54 |
invocation2!(valid); |
| 55 |
invocation3!(this is a valid invocation); |
| 56 |
invocation4!( |
| 57 |
fn f() {} |
| 58 |
); |
| 59 |
|
| 60 |
0 |
| 61 |
} |