repo.or.cz
/
official-gcc.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
gccrs: Add execution test cases
[official-gcc.git]
/
gcc
/
testsuite
/
rust
/
execute
/
torture
/
builtin_macro_cfg.rs
blob
fad2daef6bc0ccdb91e6643949a1424d427da63f
1
// { dg-additional-options "-w -frust-cfg=A" }
2
// { dg-output "A\n" }
3
#[rustc_builtin_macro]
4
macro_rules! cfg {
5
() => {{}};
6
}
7
8
extern "C" {
9
fn printf(fmt: *const i8, ...);
10
}
11
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
}
19
}
20
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
}
30
31
0
32
}