[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Frontend / rewrite-includes-conditions.c
blob37a55f31de9ecaff72b05ec5159f08f295d8b79c
1 // RUN: %clang_cc1 -E -frewrite-includes -I %S/Inputs %s -o - | FileCheck -strict-whitespace %s
2 // 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
4 #define value1 1
5 #if value1
6 int line1;
7 #else
8 int line2;
9 #endif
11 #define value2 2
13 #if value1 == value2
14 int line3;
15 #elif value1 > value2
16 int line4;
17 #elif value1 < value2
18 int line5;
19 #else
20 int line6;
21 #endif
23 #if __has_include(<rewrite-includes3.h>)
24 #include <rewrite-includes3.h>
25 #endif
27 #define HAS_INCLUDE(x) __has_include(x)
29 #if HAS_INCLUDE(<rewrite-includes1.h>)
30 #endif
33 #if value1
34 commented out
37 #if value1 < value2 \
38 || value1 != value2
39 int line7;
40 #endif
42 #if value1 /*
44 #endif
46 static int unused;
48 // ENDCOMPARE
50 // CHECK: #if 0 /* disabled by -frewrite-includes */
51 // CHECK-NEXT: #if value1
52 // CHECK-NEXT: #endif
53 // CHECK-NEXT: #endif /* disabled by -frewrite-includes */
54 // CHECK-NEXT: #if 1 /* evaluated by -frewrite-includes */
55 // CHECK-NEXT: # 6 "{{.*}}rewrite-includes-conditions.c"
57 // CHECK: #if 0 /* disabled by -frewrite-includes */
58 // CHECK-NEXT: #if value1 == value2
59 // CHECK-NEXT: #endif
60 // CHECK-NEXT: #endif /* disabled by -frewrite-includes */
61 // CHECK-NEXT: #if 0 /* evaluated by -frewrite-includes */
62 // CHECK-NEXT: # 14 "{{.*}}rewrite-includes-conditions.c"
64 // CHECK: #if 0 /* disabled by -frewrite-includes */
65 // CHECK-NEXT: #if 0
66 // CHECK-NEXT: #elif value1 > value2
67 // CHECK-NEXT: #endif
68 // CHECK-NEXT: #endif /* disabled by -frewrite-includes */
69 // CHECK-NEXT: #elif 0 /* evaluated by -frewrite-includes */
70 // CHECK-NEXT: # 16 "{{.*}}rewrite-includes-conditions.c"
72 // CHECK: #if 0 /* disabled by -frewrite-includes */
73 // CHECK-NEXT: #if 0
74 // CHECK-NEXT: #elif value1 < value2
75 // CHECK-NEXT: #endif
76 // CHECK-NEXT: #endif /* disabled by -frewrite-includes */
77 // CHECK-NEXT: #elif 1 /* evaluated by -frewrite-includes */
78 // CHECK-NEXT: # 18 "{{.*}}rewrite-includes-conditions.c"
80 // CHECK: #if 0 /* disabled by -frewrite-includes */
81 // CHECK-NEXT: #if __has_include(<rewrite-includes3.h>)
82 // CHECK-NEXT: #endif
83 // CHECK-NEXT: #endif /* disabled by -frewrite-includes */
84 // CHECK-NEXT: #if 1 /* evaluated by -frewrite-includes */
85 // CHECK-NEXT: # 24 "{{.*}}rewrite-includes-conditions.c"
87 // CHECK: #if 0 /* disabled by -frewrite-includes */
88 // CHECK-NEXT: #if HAS_INCLUDE(<rewrite-includes1.h>)
89 // CHECK-NEXT: #endif
90 // CHECK-NEXT: #endif /* disabled by -frewrite-includes */
91 // CHECK-NEXT: #if 1 /* evaluated by -frewrite-includes */
92 // CHECK-NEXT: # 30 "{{.*}}rewrite-includes-conditions.c"
94 // CHECK: #if 0 /* disabled by -frewrite-includes */
95 // CHECK-NEXT: #if value1 < value2 \
96 // CHECK-NEXT: || value1 != value2
97 // CHECK-NEXT: #endif
98 // CHECK-NEXT: #endif /* disabled by -frewrite-includes */
99 // CHECK-NEXT: #if 1 /* evaluated by -frewrite-includes */
100 // CHECK-NEXT: # 39 "{{.*}}rewrite-includes-conditions.c"
102 // CHECK: #if 0 /* disabled by -frewrite-includes */
103 // CHECK-NEXT: #if value1 /*
104 // CHECK-NEXT: */
105 // CHECK-NEXT: #endif
106 // CHECK-NEXT: #endif /* disabled by -frewrite-includes */
107 // CHECK-NEXT: #if 1 /* evaluated by -frewrite-includes */
108 // CHECK-NEXT: # 44 "{{.*}}rewrite-includes-conditions.c"
110 // CHECK: {{^}}// ENDCOMPARE{{$}}
112 // COMPILE: Inputs{{[/\\]}}rewrite-includes3.h:1:31: warning: implicit conversion changes signedness:
113 // COMPILE: rewrite-includes-conditions.c:46:12: warning: unused variable 'unused'