Debian Codegraph @

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

raw
1 // { dg-additional-options "-w -frust-cfg=A" }
2 // { dg-output "test1\r*\n" }
3 extern "C" {
4 fn printf(s: *const i8, ...);
5 }
6
7 #[cfg(A)]
8 fn test() {
9 unsafe {
10 let a = "test1\n\0";
11 let b = a as *const str;
12 let c = b as *const i8;
13
14 printf(c);
15 }
16 }
17
18 #[cfg(B)]
19 fn test() {
20 unsafe {
21 let a = "test2\n\0";
22 let b = a as *const str;
23 let c = b as *const i8;
24
25 printf(c);
26 }
27 }
28
29 fn main() -> i32 {
30 test();
31 0
32 }