xref: /freebsd/contrib/unifdef/tests/if4-kDU.c (revision e043f37205ffbde5627ff299ad25cd532f2956f0)
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) || defined(FOOB)
21 int foo1() { return 0; }
22 #else
23 #error FOO or FOOB not defined
24 #endif
25 
26 #if defined(FOOB) || defined(FOO)
27 int foo2() { return 0; }
28 #else
29 #error FOO or FOOB not defined
30 #endif
31 
32 #if defined(FOO) && defined(FOOB)
33 int foo3() { return 0; }
34 #else
35 #error FOO and FOOB not defined
36 #endif
37 
38 #if defined(FOOB) && defined(FOO)
39 int foo4() { return 0; }
40 #else
41 #error FOO and FOOB not defined
42 #endif
43 
44 int main()
45 {
46   foo1();
47   foo2();
48   foo3();
49   foo4();
50 }
51