gccrs: Add execution test cases
[official-gcc.git] / gcc / testsuite / rust / execute / torture / builtin_macro_cfg.rs
blobfad2daef6bc0ccdb91e6643949a1424d427da63f
1 // { dg-additional-options "-w -frust-cfg=A" }
2 // { dg-output "A\n" }
3 #[rustc_builtin_macro]
4 macro_rules! cfg {
5     () => {{}};
8 extern "C" {
9     fn printf(fmt: *const i8, ...);
12 fn print(s: &str) {
13     unsafe {
14         printf(
15             "%s\n" as *const str as *const i8,
16             s as *const str as *const i8,
17         );
18     }
21 fn main() -> i32 {
22     let cfg = cfg!(A);
23     if cfg {
24         print("A");
25     }
26     let cfg = cfg!(B);
27     if cfg {
28         print("B");
29     }
31     0