1 /* Another test case for over-eager multiple include optimization,
2    where the leading "#if !defined" expression is obtained partially,
3    or wholly, from macros.  Neil Booth, 30 Sep 2001.  */
4 
5 /* { dg-do compile } */
6 /* { dg-options "" } */
7 
8 /* Each include file should not be subject to MI optimisation, since
9    macro definitions can change.  Each header increments the variable
10    VAR if it is defined.
11 
12    The first set of inclusions gets the headers into CPP's cache, but
13    does nothing since VAR is not defined.  The second set should each
14    increment VAR, since none of the initial set should have been
15    flagged as optimizable.  */
16 
17 #define EMPTYL
18 #define EMPTYR
19 #define NOT !
20 #define DEFINED defined (guard)
21 #define NOT_DEFINED ! defined (guard)
22 
23 #include "mi6a.h"
24 #include "mi6b.h"
25 #include "mi6c.h"
26 #include "mi6d.h"
27 #include "mi6e.h"
28 
29 /* Define the macro guard, and redefine the macros to something that
30    forces compilation of the conditional blocks.  */
31 #define guard
32 #undef EMPTYL
33 #define EMPTYL 1 ||
34 #undef EMPTYR
35 #define EMPTYR || 1
36 #undef NOT
37 #define NOT
38 #undef DEFINED
39 #define DEFINED 0
40 #undef NOT_DEFINED
41 #define NOT_DEFINED 1
42 
43 #define VAR five
44 
45 int
main(void)46 main(void)
47 {
48   unsigned int five = 0;
49 
50 #include "mi6a.h"
51 #include "mi6b.h"
52 #include "mi6c.h"
53 #include "mi6d.h"
54 #include "mi6e.h"
55 
56   if (five != 5)
57     abort ();
58   return 0;
59 }
60