xref: /freebsd/contrib/unifdef/tests/if2-k.c (revision 2008043f386721d58158e37e0d7e50df8095942d)
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 passed through. "#if 1 else" */
18 #endif
19 
20 #if defined(FOO)
21 int foo() { return 0; }
22 #else
23 #error FOO not defined
24 #endif
25 
26 int main()
27 {
28   foo();
29 }
30