annotate clang/test/Frontend/verify.c @ 222:81f6424ef0e3 llvm-original

LLVM original branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:10:01 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -DTEST1 -verify %s
anatofuz
parents:
diff changeset
2 // RUN: not %clang_cc1 -DTEST2 -verify %s 2>&1 | FileCheck -check-prefix=CHECK2 %s
anatofuz
parents:
diff changeset
3 // RUN: not %clang_cc1 -DTEST3 -verify %s 2>&1 | FileCheck -check-prefix=CHECK3 %s
anatofuz
parents:
diff changeset
4 // RUN: not %clang_cc1 -DTEST4 -verify %s 2>&1 | FileCheck -check-prefix=CHECK4 %s
anatofuz
parents:
diff changeset
5 // RUN: not %clang_cc1 -DTEST5 -verify %s 2>&1 | FileCheck -check-prefix=CHECK5 %s
anatofuz
parents:
diff changeset
6
anatofuz
parents:
diff changeset
7 // expected-warning@ malformed
anatofuz
parents:
diff changeset
8 // expected-error@7 1 {{missing or invalid line number}}
anatofuz
parents:
diff changeset
9
anatofuz
parents:
diff changeset
10 // expected-warning@0 malformed
anatofuz
parents:
diff changeset
11 // expected-error@10 {{missing or invalid line number}}
anatofuz
parents:
diff changeset
12
anatofuz
parents:
diff changeset
13 // expected-warning@-50 malformed
anatofuz
parents:
diff changeset
14 // expected-error@13 {{missing or invalid line number}}
anatofuz
parents:
diff changeset
15
anatofuz
parents:
diff changeset
16 // expected-warning malformed
anatofuz
parents:
diff changeset
17 // expected-error@16 {{cannot find start}}
anatofuz
parents:
diff changeset
18
anatofuz
parents:
diff changeset
19 // expected-error 0+ {{should also be ignored}}
anatofuz
parents:
diff changeset
20
anatofuz
parents:
diff changeset
21 #ifdef TEST1
anatofuz
parents:
diff changeset
22 #if 0
anatofuz
parents:
diff changeset
23 // expected-error {{should be ignored}}
anatofuz
parents:
diff changeset
24 #endif
anatofuz
parents:
diff changeset
25 // eexpected-error {{should also be ignored: unrecognised directive}}
anatofuz
parents:
diff changeset
26 #error should not be ignored
anatofuz
parents:
diff changeset
27 // expected-error@-1 1+ {{should not be ignored}}
anatofuz
parents:
diff changeset
28
anatofuz
parents:
diff changeset
29 #line 90
anatofuz
parents:
diff changeset
30 unexpected a; // expected-error@+0 + {{unknown type}}
anatofuz
parents:
diff changeset
31
anatofuz
parents:
diff changeset
32 #line 60
anatofuz
parents:
diff changeset
33 unexpected b; // expected-error@33 1-1 {{unknown type}}
anatofuz
parents:
diff changeset
34
anatofuz
parents:
diff changeset
35 // expected-error@+2 {{file not found}} check that multi-line handled correctly: \
anatofuz
parents:
diff changeset
36
anatofuz
parents:
diff changeset
37 #include "missing_header_file.include"
anatofuz
parents:
diff changeset
38 #endif
anatofuz
parents:
diff changeset
39
anatofuz
parents:
diff changeset
40 #ifdef TEST2
anatofuz
parents:
diff changeset
41 #define MACRO some_value // expected-error {{define_error}}
anatofuz
parents:
diff changeset
42 #undef MACRO extra_token // expected-warning {{undef_error}}
anatofuz
parents:
diff changeset
43 #line -2 // expected-error {{line_error}}
anatofuz
parents:
diff changeset
44 #error AAA // expected-error {{BBB}} <- this shall be part of diagnostic
anatofuz
parents:
diff changeset
45 #warning CCC // expected-warning {{DDD}} <- this shall be part of diagnostic
anatofuz
parents:
diff changeset
46
anatofuz
parents:
diff changeset
47 #if 0
anatofuz
parents:
diff changeset
48 // This is encapsulated in "#if 0" so that the expected-* checks below
anatofuz
parents:
diff changeset
49 // are not inadvertently included in the diagnostic checking!
anatofuz
parents:
diff changeset
50
anatofuz
parents:
diff changeset
51 // CHECK2: error: 'error' diagnostics expected but not seen:
anatofuz
parents:
diff changeset
52 // CHECK2-NEXT: Line 41: define_error
anatofuz
parents:
diff changeset
53 // CHECK2-NEXT: Line 43: line_error
anatofuz
parents:
diff changeset
54 // CHECK2-NEXT: error: 'error' diagnostics seen but not expected:
anatofuz
parents:
diff changeset
55 // CHECK2-NEXT: Line 43: #line directive requires a positive integer argument
anatofuz
parents:
diff changeset
56 // CHECK2-NEXT: Line 44: AAA // expected-error {{[{][{]BBB[}][}]}} <- this shall be part of diagnostic
anatofuz
parents:
diff changeset
57 // CHECK2-NEXT: error: 'warning' diagnostics expected but not seen:
anatofuz
parents:
diff changeset
58 // CHECK2-NEXT: Line 42: undef_error
anatofuz
parents:
diff changeset
59 // CHECK2-NEXT: error: 'warning' diagnostics seen but not expected:
anatofuz
parents:
diff changeset
60 // CHECK2-NEXT: Line 42: extra tokens at end of #undef directive
anatofuz
parents:
diff changeset
61 // CHECK2-NEXT: Line 45: CCC // expected-warning {{[{][{]DDD[}][}]}} <- this shall be part of diagnostic
anatofuz
parents:
diff changeset
62 // CHECK2-NEXT: 7 errors generated.
anatofuz
parents:
diff changeset
63 #endif
anatofuz
parents:
diff changeset
64 #endif
anatofuz
parents:
diff changeset
65
anatofuz
parents:
diff changeset
66 #ifdef TEST3
anatofuz
parents:
diff changeset
67 #ifndef TEST3 // expected-note {{line_67}}
anatofuz
parents:
diff changeset
68 // expected-note {{line_68_ignored}}
anatofuz
parents:
diff changeset
69 # ifdef UNDEFINED // expected-note {{line_69_ignored}}
anatofuz
parents:
diff changeset
70 # endif // expected-note {{line_70_ignored}}
anatofuz
parents:
diff changeset
71 #elif defined(TEST3) // expected-note {{line_71}}
anatofuz
parents:
diff changeset
72 # if 1 // expected-note {{line_72}}
anatofuz
parents:
diff changeset
73 // expected-note {{line_73}}
anatofuz
parents:
diff changeset
74 # else // expected-note {{line_74}}
anatofuz
parents:
diff changeset
75 // expected-note {{line_75_ignored}}
anatofuz
parents:
diff changeset
76 # ifndef TEST3 // expected-note {{line_76_ignored}}
anatofuz
parents:
diff changeset
77 # endif // expected-note {{line_77_ignored}}
anatofuz
parents:
diff changeset
78 # endif // expected-note {{line_78}}
anatofuz
parents:
diff changeset
79 #endif
anatofuz
parents:
diff changeset
80
anatofuz
parents:
diff changeset
81 // CHECK3: error: 'note' diagnostics expected but not seen:
anatofuz
parents:
diff changeset
82 // CHECK3-NEXT: Line 67: line_67
anatofuz
parents:
diff changeset
83 // CHECK3-NEXT: Line 71: line_71
anatofuz
parents:
diff changeset
84 // CHECK3-NEXT: Line 72: line_72
anatofuz
parents:
diff changeset
85 // CHECK3-NEXT: Line 73: line_73
anatofuz
parents:
diff changeset
86 // CHECK3-NEXT: Line 74: line_74
anatofuz
parents:
diff changeset
87 // CHECK3-NEXT: Line 78: line_78
anatofuz
parents:
diff changeset
88 // CHECK3-NEXT: 6 errors generated.
anatofuz
parents:
diff changeset
89 #endif
anatofuz
parents:
diff changeset
90
anatofuz
parents:
diff changeset
91 #ifdef TEST4
anatofuz
parents:
diff changeset
92 #include "missing_header_file.include" // expected-error {{include_error}}
anatofuz
parents:
diff changeset
93
anatofuz
parents:
diff changeset
94 // CHECK4: error: 'error' diagnostics expected but not seen:
anatofuz
parents:
diff changeset
95 // CHECK4-NEXT: Line 92: include_error
anatofuz
parents:
diff changeset
96 // CHECK4-NEXT: error: 'error' diagnostics seen but not expected:
anatofuz
parents:
diff changeset
97 // CHECK4-NEXT: Line 92: 'missing_header_file.include' file not found
anatofuz
parents:
diff changeset
98 // CHECK4-NEXT: 2 errors generated.
anatofuz
parents:
diff changeset
99 #endif
anatofuz
parents:
diff changeset
100
anatofuz
parents:
diff changeset
101 #ifdef TEST5
anatofuz
parents:
diff changeset
102 #include "verify-directive.h"
anatofuz
parents:
diff changeset
103 // expected-error@50 {{source file test}}
anatofuz
parents:
diff changeset
104
anatofuz
parents:
diff changeset
105 // CHECK5: error: 'error' diagnostics expected but not seen:
anatofuz
parents:
diff changeset
106 // CHECK5-NEXT: Line 1 (directive at {{.*}}verify-directive.h:2): include file test
anatofuz
parents:
diff changeset
107 // CHECK5-NEXT: Line 50 (directive at {{.*}}verify.c:103): source file test
anatofuz
parents:
diff changeset
108 // CHECK5-NEXT: 2 errors generated.
anatofuz
parents:
diff changeset
109 #endif
anatofuz
parents:
diff changeset
110
anatofuz
parents:
diff changeset
111 #if 0
anatofuz
parents:
diff changeset
112 // RUN: not %clang_cc1 -verify %t.invalid 2>&1 | FileCheck -check-prefix=CHECK6 %s
anatofuz
parents:
diff changeset
113
anatofuz
parents:
diff changeset
114 // CHECK6: error: no expected directives found: consider use of 'expected-no-diagnostics'
anatofuz
parents:
diff changeset
115 // CHECK6-NEXT: error: 'error' diagnostics seen but not expected:
anatofuz
parents:
diff changeset
116 // CHECK6-NEXT: (frontend): error reading '{{.*}}verify.c.tmp.invalid'
anatofuz
parents:
diff changeset
117 // CHECK6-NEXT: 2 errors generated.
anatofuz
parents:
diff changeset
118
anatofuz
parents:
diff changeset
119 // RUN: printf '//expected-error@2{{1}}\n#error 2\n' | not %clang_cc1 -verify 2>&1 | FileCheck -check-prefix=CHECK7 %s
anatofuz
parents:
diff changeset
120
anatofuz
parents:
diff changeset
121 // CHECK7: error: 'error' diagnostics expected but not seen:
anatofuz
parents:
diff changeset
122 // CHECK7-NEXT: Line 2 (directive at <stdin>:1): 1
anatofuz
parents:
diff changeset
123 // CHECK7-NEXT: error: 'error' diagnostics seen but not expected:
anatofuz
parents:
diff changeset
124 // CHECK7-NEXT: Line 2: 2
anatofuz
parents:
diff changeset
125 // CHECK7-NEXT: 2 errors generated.
anatofuz
parents:
diff changeset
126 #endif
anatofuz
parents:
diff changeset
127
anatofuz
parents:
diff changeset
128 #ifdef TEST8
anatofuz
parents:
diff changeset
129 // RUN: not %clang_cc1 -DTEST8 -verify %s 2>&1 | FileCheck -check-prefix=CHECK8 %s
anatofuz
parents:
diff changeset
130
anatofuz
parents:
diff changeset
131 // expected-warning@nonexistent-file:1 {{ }}
anatofuz
parents:
diff changeset
132 // expected-error@-1 {{file 'nonexistent-file' could not be located}}
anatofuz
parents:
diff changeset
133
anatofuz
parents:
diff changeset
134 // expected-warning@verify-directive.h: {{ }}
anatofuz
parents:
diff changeset
135 // expected-error@-1 {{missing or invalid line number}}
anatofuz
parents:
diff changeset
136
anatofuz
parents:
diff changeset
137 // expected-warning@verify-directive.h:0 {{ }}
anatofuz
parents:
diff changeset
138 // expected-error@-1 {{missing or invalid line number}}
anatofuz
parents:
diff changeset
139
anatofuz
parents:
diff changeset
140 // expected-warning@verify-directive.h:0*{{ }}
anatofuz
parents:
diff changeset
141 // expected-error@-1 {{missing or invalid line number}}
anatofuz
parents:
diff changeset
142
anatofuz
parents:
diff changeset
143 // expected-warning@verify-directive.h:*0{{ }}
anatofuz
parents:
diff changeset
144 // syntactically ok -- means match in any line for 0 occurrences.
anatofuz
parents:
diff changeset
145
anatofuz
parents:
diff changeset
146 // expected-warning@verify-directive.h:1 {{diagnostic}}
anatofuz
parents:
diff changeset
147
anatofuz
parents:
diff changeset
148 // CHECK8: error: 'warning' diagnostics expected but not seen:
anatofuz
parents:
diff changeset
149 // CHECK8-NEXT: File {{.*}}verify-directive.h Line 1 (directive at {{.*}}verify.c:146): diagnostic
anatofuz
parents:
diff changeset
150 // CHECK8-NEXT: 1 error generated.
anatofuz
parents:
diff changeset
151 #endif