xref: /freebsd/contrib/unifdef/tests/if1-k.c (revision 257e70f1d5ee61037c8c59b116538d3b6b1427a2)
1 /* Copyright 2004, 2008 Bob Proulx <bob@proulx.com>
2 Distributed under the two-clause BSD licence;
3 see the COPYING file for details. */
4 
5 #include <stdio.h>
6 #include <stdlib.h>
7 
8 #if 0
9 /* This code is commented out. "#if 0 then" */
10 #else
11 /* This code is passed through. "#if 0 else" */
12 #endif
13 
14 #if 1
15 /* This code is passed through. "#if 1 then" */
16 #else
17 /* This code is commented out. "#if 1 else" */
18 #endif
19 
20 #if FOO
21 int foo() { return 0; }
22 #else
23 #error FOO not defined
24 #endif
25 
26 #if BAR
27 int foo() { return 0; }
28 #elif FOO
29 int bar() { return 0; }
30 #else
31 #error FOO not defined
32 #endif
33 
34 int main()
35 {
36   foo();
37   bar();
38 }
39