annotate gcc/testsuite/gcc.dg/cpp/trad/mi6.c @ 145:1830386684a0

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