Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/cpp/trad/mi6.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
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 extern void abort (void); | |
9 | |
10 /* Each include file should not be subject to MI optimisation, since | |
11 macro definitions can change. Each header increments the variable | |
12 VAR if it is defined. | |
13 | |
14 The first set of inclusions gets the headers into CPP's cache, but | |
15 does nothing since VAR is not defined. The second set should each | |
16 increment VAR, since none of the initial set should have been | |
17 flagged as optimizable. */ | |
18 | |
19 #define EMPTYL | |
20 #define EMPTYR | |
21 #define NOT ! | |
22 #define DEFINED defined (guard) | |
23 #define NOT_DEFINED ! defined (guard) | |
24 | |
25 #include "mi6a.h" | |
26 #include "mi6b.h" | |
27 #include "mi6c.h" | |
28 #include "mi6d.h" | |
29 #include "mi6e.h" | |
30 | |
31 /* Define the macro guard, and redefine the macros to something that | |
32 forces compilation of the conditional blocks. */ | |
33 #define guard | |
34 #undef EMPTYL | |
35 #define EMPTYL 1 || | |
36 #undef EMPTYR | |
37 #define EMPTYR || 1 | |
38 #undef NOT | |
39 #define NOT | |
40 #undef DEFINED | |
41 #define DEFINED 0 | |
42 #undef NOT_DEFINED | |
43 #define NOT_DEFINED 1 | |
44 | |
45 #define VAR five | |
46 | |
47 int | |
48 main(void) | |
49 { | |
50 unsigned int five = 0; | |
51 | |
52 #include "mi6a.h" | |
53 #include "mi6b.h" | |
54 #include "mi6c.h" | |
55 #include "mi6d.h" | |
56 #include "mi6e.h" | |
57 | |
58 if (five != 5) | |
59 abort (); | |
60 return 0; | |
61 } |