1 // RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -verify %s -Wabsolute-value -std=c++11
2 // RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only %s -Wabsolute-value -fdiagnostics-parseable-fixits -std=c++11 2>&1 | FileCheck %s
6 long int labs(long int);
7 long long int llabs(long long int);
11 long double fabsl(long double);
13 float cabsf(float _Complex
);
14 double cabs(double _Complex
);
15 long double cabsl(long double _Complex
);
20 inline namespace __1
{
22 long int abs(long int);
23 long long int abs(long long int);
28 long double abs(long double);
35 void test_int(int x
) {
43 // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of integer type}}
44 // expected-note@-2 {{use function 'std::abs' instead}}
45 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
47 // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of integer type}}
48 // expected-note@-2 {{use function 'std::abs' instead}}
49 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
51 // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of integer type}}
52 // expected-note@-2 {{use function 'std::abs' instead}}
53 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
56 // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of integer type}}
57 // expected-note@-2 {{use function 'std::abs' instead}}
58 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
60 // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of integer type}}
61 // expected-note@-2 {{use function 'std::abs' instead}}
62 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
64 // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of integer type}}
65 // expected-note@-2 {{use function 'std::abs' instead}}
66 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
68 (void)__builtin_abs(x
);
69 (void)__builtin_labs(x
);
70 (void)__builtin_llabs(x
);
72 (void)__builtin_fabsf(x
);
73 // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of integer type}}
74 // expected-note@-2 {{use function 'std::abs' instead}}
75 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
76 (void)__builtin_fabs(x
);
77 // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of integer type}}
78 // expected-note@-2 {{use function 'std::abs' instead}}
79 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
80 (void)__builtin_fabsl(x
);
81 // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of integer type}}
82 // expected-note@-2 {{use function 'std::abs' instead}}
83 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
85 (void)__builtin_cabsf(x
);
86 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of integer type}}
87 // expected-note@-2 {{use function 'std::abs' instead}}
88 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
89 (void)__builtin_cabs(x
);
90 // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of integer type}}
91 // expected-note@-2 {{use function 'std::abs' instead}}
92 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
93 (void)__builtin_cabsl(x
);
94 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of integer type}}
95 // expected-note@-2 {{use function 'std::abs' instead}}
96 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
99 void test_long(long x
) {
102 (void)abs(x
); // no warning - int and long are same length for this target
107 // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of integer type}}
108 // expected-note@-2 {{use function 'std::abs' instead}}
109 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
111 // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of integer type}}
112 // expected-note@-2 {{use function 'std::abs' instead}}
113 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
115 // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of integer type}}
116 // expected-note@-2 {{use function 'std::abs' instead}}
117 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
120 // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of integer type}}
121 // expected-note@-2 {{use function 'std::abs' instead}}
122 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
124 // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of integer type}}
125 // expected-note@-2 {{use function 'std::abs' instead}}
126 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
128 // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of integer type}}
129 // expected-note@-2 {{use function 'std::abs' instead}}
130 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
132 (void)__builtin_abs(x
); // no warning - int and long are same length for
134 (void)__builtin_labs(x
);
135 (void)__builtin_llabs(x
);
137 (void)__builtin_fabsf(x
);
138 // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of integer type}}
139 // expected-note@-2 {{use function 'std::abs' instead}}
140 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
141 (void)__builtin_fabs(x
);
142 // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of integer type}}
143 // expected-note@-2 {{use function 'std::abs' instead}}
144 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
145 (void)__builtin_fabsl(x
);
146 // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of integer type}}
147 // expected-note@-2 {{use function 'std::abs' instead}}
148 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
150 (void)__builtin_cabsf(x
);
151 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of integer type}}
152 // expected-note@-2 {{use function 'std::abs' instead}}
153 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
154 (void)__builtin_cabs(x
);
155 // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of integer type}}
156 // expected-note@-2 {{use function 'std::abs' instead}}
157 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
158 (void)__builtin_cabsl(x
);
159 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of integer type}}
160 // expected-note@-2 {{use function 'std::abs' instead}}
161 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
164 void test_long_long(long long x
) {
168 // expected-warning@-1{{absolute value function 'abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value}}
169 // expected-note@-2{{use function 'std::abs' instead}}
170 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"std::abs"
172 // expected-warning@-1{{absolute value function 'labs' given an argument of type 'long long' but has parameter of type 'long' which may cause truncation of value}}
173 // expected-note@-2{{use function 'std::abs' instead}}
174 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
178 // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of integer type}}
179 // expected-note@-2 {{use function 'std::abs' instead}}
180 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
182 // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of integer type}}
183 // expected-note@-2 {{use function 'std::abs' instead}}
184 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
186 // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of integer type}}
187 // expected-note@-2 {{use function 'std::abs' instead}}
188 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
191 // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of integer type}}
192 // expected-note@-2 {{use function 'std::abs' instead}}
193 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
195 // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of integer type}}
196 // expected-note@-2 {{use function 'std::abs' instead}}
197 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
199 // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of integer type}}
200 // expected-note@-2 {{use function 'std::abs' instead}}
201 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
203 (void)__builtin_abs(x
);
204 // expected-warning@-1{{absolute value function '__builtin_abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value}}
205 // expected-note@-2{{use function 'std::abs' instead}}
206 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"std::abs"
207 (void)__builtin_labs(x
);
208 // expected-warning@-1{{absolute value function '__builtin_labs' given an argument of type 'long long' but has parameter of type 'long' which may cause truncation of value}}
209 // expected-note@-2{{use function 'std::abs' instead}}
210 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
211 (void)__builtin_llabs(x
);
213 (void)__builtin_fabsf(x
);
214 // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of integer type}}
215 // expected-note@-2 {{use function 'std::abs' instead}}
216 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
217 (void)__builtin_fabs(x
);
218 // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of integer type}}
219 // expected-note@-2 {{use function 'std::abs' instead}}
220 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
221 (void)__builtin_fabsl(x
);
222 // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of integer type}}
223 // expected-note@-2 {{use function 'std::abs' instead}}
224 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
226 (void)__builtin_cabsf(x
);
227 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of integer type}}
228 // expected-note@-2 {{use function 'std::abs' instead}}
229 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
230 (void)__builtin_cabs(x
);
231 // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of integer type}}
232 // expected-note@-2 {{use function 'std::abs' instead}}
233 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
234 (void)__builtin_cabsl(x
);
235 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of integer type}}
236 // expected-note@-2 {{use function 'std::abs' instead}}
237 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
240 void test_float(float x
) {
244 // expected-warning@-1 {{using integer absolute value function 'abs' when argument is of floating point type}}
245 // expected-note@-2 {{use function 'std::abs' instead}}
246 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"std::abs"
248 // expected-warning@-1 {{using integer absolute value function 'labs' when argument is of floating point type}}
249 // expected-note@-2 {{use function 'std::abs' instead}}
250 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
252 // expected-warning@-1 {{using integer absolute value function 'llabs' when argument is of floating point type}}
253 // expected-note@-2 {{use function 'std::abs' instead}}
254 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
261 // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of floating point type}}
262 // expected-note@-2 {{use function 'std::abs' instead}}
263 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
265 // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of floating point type}}
266 // expected-note@-2 {{use function 'std::abs' instead}}
267 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
269 // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of floating point type}}
270 // expected-note@-2 {{use function 'std::abs' instead}}
271 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
273 (void)__builtin_abs(x
);
274 // expected-warning@-1 {{using integer absolute value function '__builtin_abs' when argument is of floating point type}}
275 // expected-note@-2 {{use function 'std::abs' instead}}
276 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"std::abs"
277 (void)__builtin_labs(x
);
278 // expected-warning@-1 {{using integer absolute value function '__builtin_labs' when argument is of floating point type}}
279 // expected-note@-2 {{use function 'std::abs' instead}}
280 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
281 (void)__builtin_llabs(x
);
282 // expected-warning@-1 {{using integer absolute value function '__builtin_llabs' when argument is of floating point type}}
283 // expected-note@-2 {{use function 'std::abs' instead}}
284 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
286 (void)__builtin_fabsf(x
);
287 (void)__builtin_fabs(x
);
288 (void)__builtin_fabsl(x
);
290 (void)__builtin_cabsf(x
);
291 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of floating point type}}
292 // expected-note@-2 {{use function 'std::abs' instead}}
293 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
294 (void)__builtin_cabs(x
);
295 // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of floating point type}}
296 // expected-note@-2 {{use function 'std::abs' instead}}
297 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
298 (void)__builtin_cabsl(x
);
299 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of floating point type}}
300 // expected-note@-2 {{use function 'std::abs' instead}}
301 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
304 void test_double(double x
) {
308 // expected-warning@-1 {{using integer absolute value function 'abs' when argument is of floating point type}}
309 // expected-note@-2 {{use function 'std::abs' instead}}
310 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"std::abs"
312 // expected-warning@-1 {{using integer absolute value function 'labs' when argument is of floating point type}}
313 // expected-note@-2 {{use function 'std::abs' instead}}
314 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
316 // expected-warning@-1 {{using integer absolute value function 'llabs' when argument is of floating point type}}
317 // expected-note@-2 {{use function 'std::abs' instead}}
318 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
321 // expected-warning@-1{{absolute value function 'fabsf' given an argument of type 'double' but has parameter of type 'float' which may cause truncation of value}}
322 // expected-note@-2{{use function 'std::abs' instead}}
323 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
328 // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of floating point type}}
329 // expected-note@-2 {{use function 'std::abs' instead}}
330 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
332 // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of floating point type}}
333 // expected-note@-2 {{use function 'std::abs' instead}}
334 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
336 // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of floating point type}}
337 // expected-note@-2 {{use function 'std::abs' instead}}
338 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
340 (void)__builtin_abs(x
);
341 // expected-warning@-1 {{using integer absolute value function '__builtin_abs' when argument is of floating point type}}
342 // expected-note@-2 {{use function 'std::abs' instead}}
343 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"std::abs"
344 (void)__builtin_labs(x
);
345 // expected-warning@-1 {{using integer absolute value function '__builtin_labs' when argument is of floating point type}}
346 // expected-note@-2 {{use function 'std::abs' instead}}
347 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
348 (void)__builtin_llabs(x
);
349 // expected-warning@-1 {{using integer absolute value function '__builtin_llabs' when argument is of floating point type}}
350 // expected-note@-2 {{use function 'std::abs' instead}}
351 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
353 (void)__builtin_fabsf(x
);
354 // expected-warning@-1{{absolute value function '__builtin_fabsf' given an argument of type 'double' but has parameter of type 'float' which may cause truncation of value}}
355 // expected-note@-2{{use function 'std::abs' instead}}
356 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
357 (void)__builtin_fabs(x
);
358 (void)__builtin_fabsl(x
);
360 (void)__builtin_cabsf(x
);
361 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of floating point type}}
362 // expected-note@-2 {{use function 'std::abs' instead}}
363 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
364 (void)__builtin_cabs(x
);
365 // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of floating point type}}
366 // expected-note@-2 {{use function 'std::abs' instead}}
367 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
368 (void)__builtin_cabsl(x
);
369 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of floating point type}}
370 // expected-note@-2 {{use function 'std::abs' instead}}
371 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
374 void test_long_double(long double x
) {
378 // expected-warning@-1 {{using integer absolute value function 'abs' when argument is of floating point type}}
379 // expected-note@-2 {{use function 'std::abs' instead}}
380 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"std::abs"
382 // expected-warning@-1 {{using integer absolute value function 'labs' when argument is of floating point type}}
383 // expected-note@-2 {{use function 'std::abs' instead}}
384 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
386 // expected-warning@-1 {{using integer absolute value function 'llabs' when argument is of floating point type}}
387 // expected-note@-2 {{use function 'std::abs' instead}}
388 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
391 // expected-warning@-1{{absolute value function 'fabsf' given an argument of type 'long double' but has parameter of type 'float' which may cause truncation of value}}
392 // expected-note@-2{{use function 'std::abs' instead}}
393 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
395 // expected-warning@-1{{absolute value function 'fabs' given an argument of type 'long double' but has parameter of type 'double' which may cause truncation of value}}
396 // expected-note@-2{{use function 'std::abs' instead}}
397 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
401 // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of floating point type}}
402 // expected-note@-2 {{use function 'std::abs' instead}}
403 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
405 // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of floating point type}}
406 // expected-note@-2 {{use function 'std::abs' instead}}
407 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
409 // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of floating point type}}
410 // expected-note@-2 {{use function 'std::abs' instead}}
411 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
413 (void)__builtin_abs(x
);
414 // expected-warning@-1 {{using integer absolute value function '__builtin_abs' when argument is of floating point type}}
415 // expected-note@-2 {{use function 'std::abs' instead}}
416 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"std::abs"
417 (void)__builtin_labs(x
);
418 // expected-warning@-1 {{using integer absolute value function '__builtin_labs' when argument is of floating point type}}
419 // expected-note@-2 {{use function 'std::abs' instead}}
420 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
421 (void)__builtin_llabs(x
);
422 // expected-warning@-1 {{using integer absolute value function '__builtin_llabs' when argument is of floating point type}}
423 // expected-note@-2 {{use function 'std::abs' instead}}
424 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
426 (void)__builtin_fabsf(x
);
427 // expected-warning@-1{{absolute value function '__builtin_fabsf' given an argument of type 'long double' but has parameter of type 'float' which may cause truncation of value}}
428 // expected-note@-2{{use function 'std::abs' instead}}
429 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
430 (void)__builtin_fabs(x
);
431 // expected-warning@-1{{absolute value function '__builtin_fabs' given an argument of type 'long double' but has parameter of type 'double' which may cause truncation of value}}
432 // expected-note@-2{{use function 'std::abs' instead}}
433 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
434 (void)__builtin_fabsl(x
);
436 (void)__builtin_cabsf(x
);
437 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of floating point type}}
438 // expected-note@-2 {{use function 'std::abs' instead}}
439 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
440 (void)__builtin_cabs(x
);
441 // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of floating point type}}
442 // expected-note@-2 {{use function 'std::abs' instead}}
443 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
444 (void)__builtin_cabsl(x
);
445 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of floating point type}}
446 // expected-note@-2 {{use function 'std::abs' instead}}
447 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
450 void test_complex_float(_Complex
float x
) {
455 (void)__builtin_cabsf(x
);
456 (void)__builtin_cabs(x
);
457 (void)__builtin_cabsl(x
);
460 void test_complex_double(_Complex
double x
) {
462 // expected-warning@-1 {{absolute value function 'cabsf' given an argument of type '_Complex double' but has parameter of type '_Complex float' which may cause truncation of value}}
463 // expected-note@-2 {{use function 'cabs' instead}}
464 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabs"
469 (void)__builtin_cabsf(x
);
470 // expected-warning@-1 {{absolute value function '__builtin_cabsf' given an argument of type '_Complex double' but has parameter of type '_Complex float' which may cause truncation of value}}
471 // expected-note@-2 {{use function '__builtin_cabs' instead}}
472 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabs"
473 (void)__builtin_cabs(x
);
474 (void)__builtin_cabsl(x
);
477 void test_complex_long_double(_Complex
long double x
) {
479 // expected-warning@-1 {{absolute value function 'cabsf' given an argument of type '_Complex long double' but has parameter of type '_Complex float' which may cause truncation of value}}
480 // expected-note@-2 {{use function 'cabsl' instead}}
481 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsl"
483 // expected-warning@-1 {{absolute value function 'cabs' given an argument of type '_Complex long double' but has parameter of type '_Complex double' which may cause truncation of value}}
484 // expected-note@-2 {{use function 'cabsl' instead}}
485 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"cabsl"
488 (void)__builtin_cabsf(x
);
489 // expected-warning@-1 {{absolute value function '__builtin_cabsf' given an argument of type '_Complex long double' but has parameter of type '_Complex float' which may cause truncation of value}}
490 // expected-note@-2 {{use function '__builtin_cabsl' instead}}
491 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsl"
492 (void)__builtin_cabs(x
);
493 // expected-warning@-1 {{absolute value function '__builtin_cabs' given an argument of type '_Complex long double' but has parameter of type '_Complex double' which may cause truncation of value}}
494 // expected-note@-2 {{use function '__builtin_cabsl' instead}}
495 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_cabsl"
496 (void)__builtin_cabsl(x
);
499 void test_unsigned_int(unsigned int x
) {
501 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
502 // expected-note@-2 {{remove the call to 'std::abs' since unsigned values cannot be negative}}
503 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:17}:""
506 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
507 // expected-note@-2 {{remove the call to 'abs' since unsigned values cannot be negative}}
508 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:""
510 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
511 // expected-note@-2 {{remove the call to 'labs' since unsigned values cannot be negative}}
512 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
514 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
515 // expected-note@-2 {{remove the call to 'llabs' since unsigned values cannot be negative}}
516 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
519 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
520 // expected-note@-2 {{remove the call to 'fabsf' since unsigned values cannot be negative}}
521 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
523 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
524 // expected-note@-2 {{remove the call to 'fabs' since unsigned values cannot be negative}}
525 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
527 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
528 // expected-note@-2 {{remove the call to 'fabsl' since unsigned values cannot be negative}}
529 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
532 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
533 // expected-note@-2 {{remove the call to 'cabsf' since unsigned values cannot be negative}}
534 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
536 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
537 // expected-note@-2 {{remove the call to 'cabs' since unsigned values cannot be negative}}
538 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
540 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
541 // expected-note@-2 {{remove the call to 'cabsl' since unsigned values cannot be negative}}
542 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
544 (void)__builtin_abs(x
);
545 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
546 // expected-note@-2 {{remove the call to '__builtin_abs' since unsigned values cannot be negative}}
547 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:""
548 (void)__builtin_labs(x
);
549 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
550 // expected-note@-2 {{remove the call to '__builtin_labs' since unsigned values cannot be negative}}
551 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
552 (void)__builtin_llabs(x
);
553 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
554 // expected-note@-2 {{remove the call to '__builtin_llabs' since unsigned values cannot be negative}}
555 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
557 (void)__builtin_fabsf(x
);
558 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
559 // expected-note@-2 {{remove the call to '__builtin_fabsf' since unsigned values cannot be negative}}
560 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
561 (void)__builtin_fabs(x
);
562 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
563 // expected-note@-2 {{remove the call to '__builtin_fabs' since unsigned values cannot be negative}}
564 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
565 (void)__builtin_fabsl(x
);
566 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
567 // expected-note@-2 {{remove the call to '__builtin_fabsl' since unsigned values cannot be negative}}
568 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
570 (void)__builtin_cabsf(x
);
571 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
572 // expected-note@-2 {{remove the call to '__builtin_cabsf' since unsigned values cannot be negative}}
573 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
574 (void)__builtin_cabs(x
);
575 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
576 // expected-note@-2 {{remove the call to '__builtin_cabs' since unsigned values cannot be negative}}
577 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
578 (void)__builtin_cabsl(x
);
579 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
580 // expected-note@-2 {{remove the call to '__builtin_cabsl' since unsigned values cannot be negative}}
581 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
584 void test_unsigned_long(unsigned long x
) {
586 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
587 // expected-note@-2 {{remove the call to 'std::abs' since unsigned values cannot be negative}}
588 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:17}:""
591 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
592 // expected-note@-2 {{remove the call to 'abs' since unsigned values cannot be negative}}
593 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:""
595 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
596 // expected-note@-2 {{remove the call to 'labs' since unsigned values cannot be negative}}
597 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
599 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
600 // expected-note@-2 {{remove the call to 'llabs' since unsigned values cannot be negative}}
601 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
604 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
605 // expected-note@-2 {{remove the call to 'fabsf' since unsigned values cannot be negative}}
606 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
608 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
609 // expected-note@-2 {{remove the call to 'fabs' since unsigned values cannot be negative}}
610 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
612 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
613 // expected-note@-2 {{remove the call to 'fabsl' since unsigned values cannot be negative}}
614 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
617 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
618 // expected-note@-2 {{remove the call to 'cabsf' since unsigned values cannot be negative}}
619 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
621 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
622 // expected-note@-2 {{remove the call to 'cabs' since unsigned values cannot be negative}}
623 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
625 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
626 // expected-note@-2 {{remove the call to 'cabsl' since unsigned values cannot be negative}}
627 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
629 (void)__builtin_abs(x
);
630 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
631 // expected-note@-2 {{remove the call to '__builtin_abs' since unsigned values cannot be negative}}
632 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:""
633 (void)__builtin_labs(x
);
634 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
635 // expected-note@-2 {{remove the call to '__builtin_labs' since unsigned values cannot be negative}}
636 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
637 (void)__builtin_llabs(x
);
638 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
639 // expected-note@-2 {{remove the call to '__builtin_llabs' since unsigned values cannot be negative}}
640 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
642 (void)__builtin_fabsf(x
);
643 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
644 // expected-note@-2 {{remove the call to '__builtin_fabsf' since unsigned values cannot be negative}}
645 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
646 (void)__builtin_fabs(x
);
647 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
648 // expected-note@-2 {{remove the call to '__builtin_fabs' since unsigned values cannot be negative}}
649 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
650 (void)__builtin_fabsl(x
);
651 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
652 // expected-note@-2 {{remove the call to '__builtin_fabsl' since unsigned values cannot be negative}}
653 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
655 (void)__builtin_cabsf(x
);
656 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
657 // expected-note@-2 {{remove the call to '__builtin_cabsf' since unsigned values cannot be negative}}
658 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
659 (void)__builtin_cabs(x
);
660 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
661 // expected-note@-2 {{remove the call to '__builtin_cabs' since unsigned values cannot be negative}}
662 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
663 (void)__builtin_cabsl(x
);
664 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
665 // expected-note@-2 {{remove the call to '__builtin_cabsl' since unsigned values cannot be negative}}
666 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""