rewrite-includes-conditions.c
3.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
// RUN: %clang_cc1 -E -frewrite-includes -I %S/Inputs %s -o - | FileCheck -strict-whitespace %s
// RUN: %clang_cc1 -E -frewrite-includes -I %S/Inputs %s -o - | %clang_cc1 -Wall -Wextra -Wconversion -x c -fsyntax-only 2>&1 | FileCheck -check-prefix=COMPILE --implicit-check-not warning: %s
#define value1 1
#if value1
int line1;
#else
int line2;
#endif
#define value2 2
#if value1 == value2
int line3;
#elif value1 > value2
int line4;
#elif value1 < value2
int line5;
#else
int line6;
#endif
#if __has_include(<rewrite-includes3.h>)
#include <rewrite-includes3.h>
#endif
#define HAS_INCLUDE(x) __has_include(x)
#if HAS_INCLUDE(<rewrite-includes1.h>)
#endif
/*
#if value1
commented out
*/
#if value1 < value2 \
|| value1 != value2
int line7;
#endif
#if value1 /*
*/
#endif
static int unused;
// ENDCOMPARE
// CHECK: #if 0 /* disabled by -frewrite-includes */
// CHECK-NEXT: #if value1
// CHECK-NEXT: #endif
// CHECK-NEXT: #endif /* disabled by -frewrite-includes */
// CHECK-NEXT: #if 1 /* evaluated by -frewrite-includes */
// CHECK-NEXT: # 6 "{{.*}}rewrite-includes-conditions.c"
// CHECK: #if 0 /* disabled by -frewrite-includes */
// CHECK-NEXT: #if value1 == value2
// CHECK-NEXT: #endif
// CHECK-NEXT: #endif /* disabled by -frewrite-includes */
// CHECK-NEXT: #if 0 /* evaluated by -frewrite-includes */
// CHECK-NEXT: # 14 "{{.*}}rewrite-includes-conditions.c"
// CHECK: #if 0 /* disabled by -frewrite-includes */
// CHECK-NEXT: #if 0
// CHECK-NEXT: #elif value1 > value2
// CHECK-NEXT: #endif
// CHECK-NEXT: #endif /* disabled by -frewrite-includes */
// CHECK-NEXT: #elif 0 /* evaluated by -frewrite-includes */
// CHECK-NEXT: # 16 "{{.*}}rewrite-includes-conditions.c"
// CHECK: #if 0 /* disabled by -frewrite-includes */
// CHECK-NEXT: #if 0
// CHECK-NEXT: #elif value1 < value2
// CHECK-NEXT: #endif
// CHECK-NEXT: #endif /* disabled by -frewrite-includes */
// CHECK-NEXT: #elif 1 /* evaluated by -frewrite-includes */
// CHECK-NEXT: # 18 "{{.*}}rewrite-includes-conditions.c"
// CHECK: #if 0 /* disabled by -frewrite-includes */
// CHECK-NEXT: #if __has_include(<rewrite-includes3.h>)
// CHECK-NEXT: #endif
// CHECK-NEXT: #endif /* disabled by -frewrite-includes */
// CHECK-NEXT: #if 1 /* evaluated by -frewrite-includes */
// CHECK-NEXT: # 24 "{{.*}}rewrite-includes-conditions.c"
// CHECK: #if 0 /* disabled by -frewrite-includes */
// CHECK-NEXT: #if HAS_INCLUDE(<rewrite-includes1.h>)
// CHECK-NEXT: #endif
// CHECK-NEXT: #endif /* disabled by -frewrite-includes */
// CHECK-NEXT: #if 1 /* evaluated by -frewrite-includes */
// CHECK-NEXT: # 30 "{{.*}}rewrite-includes-conditions.c"
// CHECK: #if 0 /* disabled by -frewrite-includes */
// CHECK-NEXT: #if value1 < value2 \
// CHECK-NEXT: || value1 != value2
// CHECK-NEXT: #endif
// CHECK-NEXT: #endif /* disabled by -frewrite-includes */
// CHECK-NEXT: #if 1 /* evaluated by -frewrite-includes */
// CHECK-NEXT: # 39 "{{.*}}rewrite-includes-conditions.c"
// CHECK: #if 0 /* disabled by -frewrite-includes */
// CHECK-NEXT: #if value1 /*
// CHECK-NEXT: */
// CHECK-NEXT: #endif
// CHECK-NEXT: #endif /* disabled by -frewrite-includes */
// CHECK-NEXT: #if 1 /* evaluated by -frewrite-includes */
// CHECK-NEXT: # 44 "{{.*}}rewrite-includes-conditions.c"
// CHECK: {{^}}// ENDCOMPARE{{$}}
// COMPILE: Inputs{{[/\\]}}rewrite-includes3.h:1:31: warning: implicit conversion changes signedness:
// COMPILE: rewrite-includes-conditions.c:46:12: warning: unused variable 'unused'