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
Daily bump.
[official-gcc.git]
/
gcc
/
testsuite
/
rust
/
execute
/
torture
/
builtin_macro_cfg.rs
blob
92343e566123658af89fd72b7a789e4d20649814
1
// { dg-additional-options "-w -frust-cfg=A" }
2
// { dg-output "A\r*\n" }
3
#![feature(rustc_attrs)]
4
5
#[rustc_builtin_macro]
6
macro_rules! cfg {
7
() => {{}};
8
}
9
10
extern "C" {
11
fn printf(fmt: *const i8, ...);
12
}
13
14
fn print(s: &str) {
15
unsafe {
16
printf(
17
"%s\n\0" as *const str as *const i8,
18
s as *const str as *const i8,
19
);
20
}
21
}
22
23
fn main() -> i32 {
24
let cfg = cfg!(A);
25
if cfg {
26
print("A\0");
27
}
28
let cfg = cfg!(B);
29
if cfg {
30
print("B\0");
31
}
32
33
0
34
}