Skip to content

Commit 8916470

Browse files
committed
Fix tests
1 parent 64fcfd1 commit 8916470

49 files changed

Lines changed: 12474 additions & 12345 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

test/test64bit.cpp

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class Test64BitPortability : public TestFixture {
5858
check("using CharArray = char[16];\n"
5959
"void f() {\n"
6060
" CharArray foo = \"\";\n"
61-
"}");
61+
"}\n");
6262
ASSERT_EQUALS("", errout_str());
6363

6464
check("struct T { std::vector<int>*a[2][2]; };\n" // #11560
@@ -79,7 +79,7 @@ class Test64BitPortability : public TestFixture {
7979
check("void foo()\n"
8080
"{\n"
8181
" a = p;\n"
82-
"}");
82+
"}\n");
8383
ASSERT_EQUALS("", errout_str());
8484
}
8585

@@ -88,65 +88,65 @@ class Test64BitPortability : public TestFixture {
8888
"{\n"
8989
" int a = p;\n"
9090
" return a + 4;\n"
91-
"}");
91+
"}\n");
9292
ASSERT_EQUALS("[test.cpp:3:11]: (portability) Assigning a pointer to an integer is not portable. [AssignmentAddressToInteger]\n", errout_str());
9393

9494
check("int foo(int p[])\n"
9595
"{\n"
9696
" int a = p;\n"
9797
" return a + 4;\n"
98-
"}");
98+
"}\n");
9999
ASSERT_EQUALS("[test.cpp:3:11]: (portability) Assigning a pointer to an integer is not portable. [AssignmentAddressToInteger]\n", errout_str());
100100

101101
check("int foo(int p[])\n"
102102
"{\n"
103103
" int *a = p;\n"
104104
" return a;\n"
105-
"}");
105+
"}\n");
106106
ASSERT_EQUALS("[test.cpp:4:5]: (portability) Returning an address value in a function with integer return type is not portable. [CastAddressToIntegerAtReturn]\n", errout_str());
107107

108108
check("void foo(int x)\n"
109109
"{\n"
110110
" int *p = x;\n"
111111
" *p = 0;\n"
112-
"}");
112+
"}\n");
113113
ASSERT_EQUALS("[test.cpp:3:12]: (portability) Assigning an integer to a pointer is not portable. [AssignmentIntegerToAddress]\n", errout_str());
114114

115115
check("int f(const char *p) {\n" // #4659
116116
" return 6 + p[2] * 256;\n"
117-
"}");
117+
"}\n");
118118
ASSERT_EQUALS("", errout_str());
119119

120120
check("int foo(int *p) {\n" // #6096
121121
" bool a = p;\n"
122122
" return a;\n"
123-
"}");
123+
"}\n");
124124
ASSERT_EQUALS("", errout_str());
125125

126126
check("std::array<int,2> f();\n"
127127
"void g() {\n"
128128
" std::array<int, 2> a = f();\n"
129-
"}");
129+
"}\n");
130130
ASSERT_EQUALS("", errout_str());
131131

132132
check("std::array<int,2> f(int x);\n"
133133
"void g(int i) {\n"
134134
" std::array<int, 2> a = f(i);\n"
135-
"}");
135+
"}\n");
136136
ASSERT_EQUALS("", errout_str());
137137

138138
check("typedef std::array<int, 2> Array;\n"
139139
"Array f(int x);\n"
140140
"void g(int i) {\n"
141141
" Array a = f(i);\n"
142-
"}");
142+
"}\n");
143143
ASSERT_EQUALS("", errout_str());
144144

145145
check("typedef std::array<int, 2> Array;\n"
146146
"Array f();\n"
147147
"void g(int i) {\n"
148148
" Array a = f();\n"
149-
"}");
149+
"}\n");
150150
ASSERT_EQUALS("", errout_str());
151151

152152
check("struct S {\n" // #9951
@@ -174,7 +174,7 @@ class Test64BitPortability : public TestFixture {
174174
check("struct Foo { int *p; };\n"
175175
"void f(struct Foo *foo) {\n"
176176
" int i = foo->p;\n"
177-
"}");
177+
"}\n");
178178
ASSERT_EQUALS("[test.cpp:3:11]: (portability) Assigning a pointer to an integer is not portable. [AssignmentAddressToInteger]\n", errout_str());
179179

180180
check("struct S {\n" // #10145
@@ -192,7 +192,7 @@ class Test64BitPortability : public TestFixture {
192192
// Ticket #2892
193193
check("void foo(int *p) {\n"
194194
" int a = (p != NULL);\n"
195-
"}");
195+
"}\n");
196196
ASSERT_EQUALS("", errout_str());
197197
}
198198

@@ -201,104 +201,104 @@ class Test64BitPortability : public TestFixture {
201201
check("void foo(int *p) {\n"
202202
" int x = 10;\n"
203203
" int *a = p + x;\n"
204-
"}");
204+
"}\n");
205205
ASSERT_EQUALS("", errout_str());
206206

207207
check("void foo(int *p) {\n"
208208
" int x = 10;\n"
209209
" int *a = x + p;\n"
210-
"}");
210+
"}\n");
211211
ASSERT_EQUALS("", errout_str());
212212

213213
check("void foo(int *p) {\n"
214214
" int x = 10;\n"
215215
" int *a = x * x;\n"
216-
"}");
216+
"}\n");
217217
ASSERT_EQUALS("[test.cpp:3:12]: (portability) Assigning an integer to a pointer is not portable. [AssignmentIntegerToAddress]\n", errout_str());
218218

219219
check("void foo(int *start, int *end) {\n"
220220
" int len;\n"
221221
" int len = end + 10 - start;\n"
222-
"}");
222+
"}\n");
223223
ASSERT_EQUALS("", errout_str());
224224
}
225225

226226
void returnIssues() {
227227
check("void* foo(int i) {\n"
228228
" return i;\n"
229-
"}");
229+
"}\n");
230230
ASSERT_EQUALS("[test.cpp:2:5]: (portability) Returning an integer in a function with pointer return type is not portable. [CastIntegerToAddressAtReturn]\n", errout_str());
231231

232232
check("void* foo(int* i) {\n"
233233
" return i;\n"
234-
"}");
234+
"}\n");
235235
ASSERT_EQUALS("", errout_str());
236236

237237
check("void* foo() {\n"
238238
" return 0;\n"
239-
"}");
239+
"}\n");
240240
ASSERT_EQUALS("", errout_str());
241241

242242
check("int foo(int i) {\n"
243243
" return i;\n"
244-
"}");
244+
"}\n");
245245
ASSERT_EQUALS("", errout_str());
246246

247247
check("struct Foo {};\n"
248248
"\n"
249249
"int* dostuff(Foo foo) {\n"
250250
" return foo;\n"
251-
"}");
251+
"}\n");
252252
ASSERT_EQUALS("", errout_str());
253253

254254
check("int foo(char* c) {\n"
255255
" return c;\n"
256-
"}");
256+
"}\n");
257257
ASSERT_EQUALS("[test.cpp:2:5]: (portability) Returning an address value in a function with integer return type is not portable. [CastAddressToIntegerAtReturn]\n", errout_str());
258258

259259
check("int foo(char* c) {\n"
260260
" return 1+c;\n"
261-
"}");
261+
"}\n");
262262
ASSERT_EQUALS("[test.cpp:2:5]: (portability) Returning an address value in a function with integer return type is not portable. [CastAddressToIntegerAtReturn]\n", errout_str());
263263

264264
check("std::string foo(char* c) {\n"
265265
" return c;\n"
266-
"}");
266+
"}\n");
267267
ASSERT_EQUALS("", errout_str());
268268

269269
check("int foo(char *a, char *b) {\n" // #4486
270270
" return a + 1 - b;\n"
271-
"}");
271+
"}\n");
272272
ASSERT_EQUALS("", errout_str());
273273

274274
check("struct s {\n" // 4642
275275
" int i;\n"
276276
"};\n"
277277
"int func(struct s *p) {\n"
278278
" return 1 + p->i;\n"
279-
"}");
279+
"}\n");
280280
ASSERT_EQUALS("", errout_str());
281281

282282
check("static void __iomem *f(unsigned int port_no) {\n"
283283
" void __iomem *mmio = hpriv->mmio;\n"
284284
" return mmio + (port_no * 0x80);\n"
285-
"}");
285+
"}\n");
286286
ASSERT_EQUALS("", errout_str());
287287

288288
// #7247: don't check return statements in nested functions..
289289
check("int foo() {\n"
290290
" struct {\n"
291291
" const char * name() { return \"abc\"; }\n"
292292
" } table;\n"
293-
"}");
293+
"}\n");
294294
ASSERT_EQUALS("", errout_str());
295295

296296
// #7451: Lambdas
297297
check("const int* test(std::vector<int> outputs, const std::string& text) {\n"
298298
" auto it = std::find_if(outputs.begin(), outputs.end(),\n"
299299
" [&](int ele) { return \"test\" == text; });\n"
300300
" return nullptr;\n"
301-
"}");
301+
"}\n");
302302
ASSERT_EQUALS("", errout_str());
303303

304304
check("struct S {\n" // #12159

0 commit comments

Comments
 (0)