FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / gcc.dg / cpp / trad / mi6.c
blobaa1c8ed2ec5974d3b9463b8ca5cd8d58c17cd237
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. */
5 /* { dg-do compile } */
6 /* { dg-options "" } */
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.
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. */
17 #define EMPTYL
18 #define EMPTYR
19 #define NOT !
20 #define DEFINED defined (guard)
21 #define NOT_DEFINED ! defined (guard)
23 #include "mi6a.h"
24 #include "mi6b.h"
25 #include "mi6c.h"
26 #include "mi6d.h"
27 #include "mi6e.h"
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
43 #define VAR five
45 int
46 main(void)
48 unsigned int five = 0;
50 #include "mi6a.h"
51 #include "mi6b.h"
52 #include "mi6c.h"
53 #include "mi6d.h"
54 #include "mi6e.h"
56 if (five != 5)
57 abort ();
58 return 0;