1 // RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -verify %s -Wabsolute-value -Wno-int-conversion
2 // RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only %s -Wabsolute-value -Wno-int-conversion -fdiagnostics-parseable-fixits 2>&1 | FileCheck %s
3 
4 int abs(int);
5 long int labs(long int);
6 long long int llabs(long long int);
7 
8 float fabsf(float);
9 double fabs(double);
10 long double fabsl(long double);
11 
12 float cabsf(float _Complex);
13 double cabs(double _Complex);
14 long double cabsl(long double _Complex);
15 
test_int(int x)16 void test_int(int x) {
17   (void)abs(x);
18   (void)labs(x);
19   (void)llabs(x);
20 
21   (void)fabsf(x);
22   // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of integer type}}
23   // expected-note@-2 {{use function 'abs' instead}}
24   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"abs"
25   (void)fabs(x);
26   // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of integer type}}
27   // expected-note@-2 {{use function 'abs' instead}}
28   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"abs"
29   (void)fabsl(x);
30   // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of integer type}}
31   // expected-note@-2 {{use function 'abs' instead}}
32   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"abs"
33 
34   (void)cabsf(x);
35   // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of integer type}}
36   // expected-note@-2 {{use function 'abs' instead}}
37   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"abs"
38   (void)cabs(x);
39   // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of integer type}}
40   // expected-note@-2 {{use function 'abs' instead}}
41   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"abs"
42   (void)cabsl(x);
43   // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of integer type}}
44   // expected-note@-2 {{use function 'abs' instead}}
45   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"abs"
46 
47   (void)__builtin_abs(x);
48   (void)__builtin_labs(x);
49   (void)__builtin_llabs(x);
50 
51   (void)__builtin_fabsf(x);
52   // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of integer type}}
53   // expected-note@-2 {{use function '__builtin_abs' instead}}
54   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_abs"
55   (void)__builtin_fabs(x);
56   // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of integer type}}
57   // expected-note@-2 {{use function '__builtin_abs' instead}}
58   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_abs"
59   (void)__builtin_fabsl(x);
60   // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of integer type}}
61   // expected-note@-2 {{use function '__builtin_abs' instead}}
62   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_abs"
63 
64   (void)__builtin_cabsf(x);
65   // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of integer type}}
66   // expected-note@-2 {{use function '__builtin_abs' instead}}
67   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_abs"
68   (void)__builtin_cabs(x);
69   // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of integer type}}
70   // expected-note@-2 {{use function '__builtin_abs' instead}}
71   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_abs"
72   (void)__builtin_cabsl(x);
73   // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of integer type}}
74   // expected-note@-2 {{use function '__builtin_abs' instead}}
75   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_abs"
76 }
77 
test_long(long x)78 void test_long(long x) {
79   (void)abs(x);  // no warning - int and long are same length for this target
80   (void)labs(x);
81   (void)llabs(x);
82 
83   (void)fabsf(x);
84   // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of integer type}}
85   // expected-note@-2 {{use function 'labs' instead}}
86   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"labs"
87   (void)fabs(x);
88   // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of integer type}}
89   // expected-note@-2 {{use function 'labs' instead}}
90   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"labs"
91   (void)fabsl(x);
92   // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of integer type}}
93   // expected-note@-2 {{use function 'labs' instead}}
94   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"labs"
95 
96   (void)cabsf(x);
97   // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of integer type}}
98   // expected-note@-2 {{use function 'labs' instead}}
99   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"labs"
100   (void)cabs(x);
101   // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of integer type}}
102   // expected-note@-2 {{use function 'labs' instead}}
103   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"labs"
104   (void)cabsl(x);
105   // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of integer type}}
106   // expected-note@-2 {{use function 'labs' instead}}
107   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"labs"
108 
109   (void)__builtin_abs(x);  // no warning - int and long are same length for
110                            // this target
111   (void)__builtin_labs(x);
112   (void)__builtin_llabs(x);
113 
114   (void)__builtin_fabsf(x);
115   // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of integer type}}
116   // expected-note@-2 {{use function '__builtin_labs' instead}}
117   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_labs"
118   (void)__builtin_fabs(x);
119   // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of integer type}}
120   // expected-note@-2 {{use function '__builtin_labs' instead}}
121   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_labs"
122   (void)__builtin_fabsl(x);
123   // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of integer type}}
124   // expected-note@-2 {{use function '__builtin_labs' instead}}
125   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_labs"
126 
127   (void)__builtin_cabsf(x);
128   // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of integer type}}
129   // expected-note@-2 {{use function '__builtin_labs' instead}}
130   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_labs"
131   (void)__builtin_cabs(x);
132   // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of integer type}}
133   // expected-note@-2 {{use function '__builtin_labs' instead}}
134   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_labs"
135   (void)__builtin_cabsl(x);
136   // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of integer type}}
137   // expected-note@-2 {{use function '__builtin_labs' instead}}
138   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_labs"
139 }
140 
test_long_long(long long x)141 void test_long_long(long long x) {
142   (void)abs(x);
143   // 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}}
144   // expected-note@-2{{use function 'llabs' instead}}
145   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"llabs"
146   (void)labs(x);
147   // 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}}
148   // expected-note@-2{{use function 'llabs' instead}}
149   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"llabs"
150   (void)llabs(x);
151 
152   (void)fabsf(x);
153   // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of integer type}}
154   // expected-note@-2 {{use function 'llabs' instead}}
155   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"llabs"
156   (void)fabs(x);
157   // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of integer type}}
158   // expected-note@-2 {{use function 'llabs' instead}}
159   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"llabs"
160   (void)fabsl(x);
161   // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of integer type}}
162   // expected-note@-2 {{use function 'llabs' instead}}
163   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"llabs"
164 
165   (void)cabsf(x);
166   // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of integer type}}
167   // expected-note@-2 {{use function 'llabs' instead}}
168   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"llabs"
169   (void)cabs(x);
170   // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of integer type}}
171   // expected-note@-2 {{use function 'llabs' instead}}
172   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"llabs"
173   (void)cabsl(x);
174   // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of integer type}}
175   // expected-note@-2 {{use function 'llabs' instead}}
176   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"llabs"
177 
178   (void)__builtin_abs(x);
179   // 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}}
180   // expected-note@-2{{use function '__builtin_llabs' instead}}
181   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"__builtin_llabs"
182   (void)__builtin_labs(x);
183   // 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}}
184   // expected-note@-2{{use function '__builtin_llabs' instead}}
185   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_llabs"
186   (void)__builtin_llabs(x);
187 
188   (void)__builtin_fabsf(x);
189   // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of integer type}}
190   // expected-note@-2 {{use function '__builtin_llabs' instead}}
191   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_llabs"
192   (void)__builtin_fabs(x);
193   // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of integer type}}
194   // expected-note@-2 {{use function '__builtin_llabs' instead}}
195   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_llabs"
196   (void)__builtin_fabsl(x);
197   // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of integer type}}
198   // expected-note@-2 {{use function '__builtin_llabs' instead}}
199   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_llabs"
200 
201   (void)__builtin_cabsf(x);
202   // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of integer type}}
203   // expected-note@-2 {{use function '__builtin_llabs' instead}}
204   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_llabs"
205   (void)__builtin_cabs(x);
206   // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of integer type}}
207   // expected-note@-2 {{use function '__builtin_llabs' instead}}
208   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_llabs"
209   (void)__builtin_cabsl(x);
210   // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of integer type}}
211   // expected-note@-2 {{use function '__builtin_llabs' instead}}
212   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_llabs"
213 }
214 
test_float(float x)215 void test_float(float x) {
216   (void)abs(x);
217   // expected-warning@-1 {{using integer absolute value function 'abs' when argument is of floating point type}}
218   // expected-note@-2 {{use function 'fabsf' instead}}
219   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"fabsf"
220   (void)labs(x);
221   // expected-warning@-1 {{using integer absolute value function 'labs' when argument is of floating point type}}
222   // expected-note@-2 {{use function 'fabsf' instead}}
223   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"fabsf"
224   (void)llabs(x);
225   // expected-warning@-1 {{using integer absolute value function 'llabs' when argument is of floating point type}}
226   // expected-note@-2 {{use function 'fabsf' instead}}
227   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"fabsf"
228 
229   (void)fabsf(x);
230   (void)fabs(x);
231   (void)fabsl(x);
232 
233   (void)cabsf(x);
234   // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of floating point type}}
235   // expected-note@-2 {{use function 'fabsf' instead}}
236   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"fabsf"
237   (void)cabs(x);
238   // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of floating point type}}
239   // expected-note@-2 {{use function 'fabsf' instead}}
240   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"fabsf"
241   (void)cabsl(x);
242   // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of floating point type}}
243   // expected-note@-2 {{use function 'fabsf' instead}}
244   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"fabsf"
245 
246   (void)__builtin_abs(x);
247   // expected-warning@-1 {{using integer absolute value function '__builtin_abs' when argument is of floating point type}}
248   // expected-note@-2 {{use function '__builtin_fabsf' instead}}
249   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"__builtin_fabsf"
250   (void)__builtin_labs(x);
251   // expected-warning@-1 {{using integer absolute value function '__builtin_labs' when argument is of floating point type}}
252   // expected-note@-2 {{use function '__builtin_fabsf' instead}}
253   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_fabsf"
254   (void)__builtin_llabs(x);
255   // expected-warning@-1 {{using integer absolute value function '__builtin_llabs' when argument is of floating point type}}
256   // expected-note@-2 {{use function '__builtin_fabsf' instead}}
257   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_fabsf"
258 
259   (void)__builtin_fabsf(x);
260   (void)__builtin_fabs(x);
261   (void)__builtin_fabsl(x);
262 
263   (void)__builtin_cabsf(x);
264   // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of floating point type}}
265   // expected-note@-2 {{use function '__builtin_fabsf' instead}}
266   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_fabsf"
267   (void)__builtin_cabs(x);
268   // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of floating point type}}
269   // expected-note@-2 {{use function '__builtin_fabsf' instead}}
270   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_fabsf"
271   (void)__builtin_cabsl(x);
272   // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of floating point type}}
273   // expected-note@-2 {{use function '__builtin_fabsf' instead}}
274   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_fabsf"
275 }
276 
test_double(double x)277 void test_double(double x) {
278   (void)abs(x);
279   // expected-warning@-1 {{using integer absolute value function 'abs' when argument is of floating point type}}
280   // expected-note@-2 {{use function 'fabs' instead}}
281   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"fabs"
282   (void)labs(x);
283   // expected-warning@-1 {{using integer absolute value function 'labs' when argument is of floating point type}}
284   // expected-note@-2 {{use function 'fabs' instead}}
285   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"fabs"
286   (void)llabs(x);
287   // expected-warning@-1 {{using integer absolute value function 'llabs' when argument is of floating point type}}
288   // expected-note@-2 {{use function 'fabs' instead}}
289   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"fabs"
290 
291   (void)fabsf(x);
292   // 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}}
293   // expected-note@-2{{use function 'fabs' instead}}
294   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"fabs"
295   (void)fabs(x);
296   (void)fabsl(x);
297 
298   (void)cabsf(x);
299   // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of floating point type}}
300   // expected-note@-2 {{use function 'fabs' instead}}
301   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"fabs"
302   (void)cabs(x);
303   // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of floating point type}}
304   // expected-note@-2 {{use function 'fabs' instead}}
305   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"fabs"
306   (void)cabsl(x);
307   // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of floating point type}}
308   // expected-note@-2 {{use function 'fabs' instead}}
309   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"fabs"
310 
311   (void)__builtin_abs(x);
312   // expected-warning@-1 {{using integer absolute value function '__builtin_abs' when argument is of floating point type}}
313   // expected-note@-2 {{use function '__builtin_fabs' instead}}
314   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"__builtin_fabs"
315   (void)__builtin_labs(x);
316   // expected-warning@-1 {{using integer absolute value function '__builtin_labs' when argument is of floating point type}}
317   // expected-note@-2 {{use function '__builtin_fabs' instead}}
318   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_fabs"
319   (void)__builtin_llabs(x);
320   // expected-warning@-1 {{using integer absolute value function '__builtin_llabs' when argument is of floating point type}}
321   // expected-note@-2 {{use function '__builtin_fabs' instead}}
322   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_fabs"
323 
324   (void)__builtin_fabsf(x);
325   // 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}}
326   // expected-note@-2{{use function '__builtin_fabs' instead}}
327   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_fabs"
328   (void)__builtin_fabs(x);
329   (void)__builtin_fabsl(x);
330 
331   (void)__builtin_cabsf(x);
332   // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of floating point type}}
333   // expected-note@-2 {{use function '__builtin_fabs' instead}}
334   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_fabs"
335   (void)__builtin_cabs(x);
336   // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of floating point type}}
337   // expected-note@-2 {{use function '__builtin_fabs' instead}}
338   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_fabs"
339   (void)__builtin_cabsl(x);
340   // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of floating point type}}
341   // expected-note@-2 {{use function '__builtin_fabs' instead}}
342   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_fabs"
343 }
344 
test_long_double(long double x)345 void test_long_double(long double x) {
346   (void)abs(x);
347   // expected-warning@-1 {{using integer absolute value function 'abs' when argument is of floating point type}}
348   // expected-note@-2 {{use function 'fabsl' instead}}
349   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"fabsl"
350   (void)labs(x);
351   // expected-warning@-1 {{using integer absolute value function 'labs' when argument is of floating point type}}
352   // expected-note@-2 {{use function 'fabsl' instead}}
353   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"fabsl"
354   (void)llabs(x);
355   // expected-warning@-1 {{using integer absolute value function 'llabs' when argument is of floating point type}}
356   // expected-note@-2 {{use function 'fabsl' instead}}
357   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"fabsl"
358 
359   (void)fabsf(x);
360   // 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}}
361   // expected-note@-2{{use function 'fabsl' instead}}
362   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"fabsl"
363   (void)fabs(x);
364   // 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}}
365   // expected-note@-2{{use function 'fabsl' instead}}
366   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"fabsl"
367   (void)fabsl(x);
368 
369   (void)cabsf(x);
370   // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of floating point type}}
371   // expected-note@-2 {{use function 'fabsl' instead}}
372   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"fabsl"
373   (void)cabs(x);
374   // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of floating point type}}
375   // expected-note@-2 {{use function 'fabsl' instead}}
376   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"fabsl"
377   (void)cabsl(x);
378   // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of floating point type}}
379   // expected-note@-2 {{use function 'fabsl' instead}}
380   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"fabsl"
381 
382   (void)__builtin_abs(x);
383   // expected-warning@-1 {{using integer absolute value function '__builtin_abs' when argument is of floating point type}}
384   // expected-note@-2 {{use function '__builtin_fabsl' instead}}
385   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"__builtin_fabsl"
386   (void)__builtin_labs(x);
387   // expected-warning@-1 {{using integer absolute value function '__builtin_labs' when argument is of floating point type}}
388   // expected-note@-2 {{use function '__builtin_fabsl' instead}}
389   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_fabsl"
390   (void)__builtin_llabs(x);
391   // expected-warning@-1 {{using integer absolute value function '__builtin_llabs' when argument is of floating point type}}
392   // expected-note@-2 {{use function '__builtin_fabsl' instead}}
393   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_fabsl"
394 
395   (void)__builtin_fabsf(x);
396   // 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}}
397   // expected-note@-2{{use function '__builtin_fabsl' instead}}
398   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_fabsl"
399   (void)__builtin_fabs(x);
400   // 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}}
401   // expected-note@-2{{use function '__builtin_fabsl' instead}}
402   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_fabsl"
403   (void)__builtin_fabsl(x);
404 
405   (void)__builtin_cabsf(x);
406   // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of floating point type}}
407   // expected-note@-2 {{use function '__builtin_fabsl' instead}}
408   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_fabsl"
409   (void)__builtin_cabs(x);
410   // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of floating point type}}
411   // expected-note@-2 {{use function '__builtin_fabsl' instead}}
412   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_fabsl"
413   (void)__builtin_cabsl(x);
414   // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of floating point type}}
415   // expected-note@-2 {{use function '__builtin_fabsl' instead}}
416   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_fabsl"
417 }
418 
test_complex_float(_Complex float x)419 void test_complex_float(_Complex float x) {
420   (void)abs(x);
421   // expected-warning@-1 {{using integer absolute value function 'abs' when argument is of complex type}}
422   // expected-note@-2 {{use function 'cabsf' instead}}
423   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"cabsf"
424   (void)labs(x);
425   // expected-warning@-1 {{using integer absolute value function 'labs' when argument is of complex type}}
426   // expected-note@-2 {{use function 'cabsf' instead}}
427   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"cabsf"
428   (void)llabs(x);
429   // expected-warning@-1 {{using integer absolute value function 'llabs' when argument is of complex type}}
430   // expected-note@-2 {{use function 'cabsf' instead}}
431   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsf"
432 
433   (void)fabsf(x);
434   // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of complex type}}
435   // expected-note@-2 {{use function 'cabsf' instead}}
436   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsf"
437   (void)fabs(x);
438   // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of complex type}}
439   // expected-note@-2 {{use function 'cabsf' instead}}
440   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"cabsf"
441   (void)fabsl(x);
442   // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of complex type}}
443   // expected-note@-2 {{use function 'cabsf' instead}}
444   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsf"
445 
446   (void)cabsf(x);
447   (void)cabs(x);
448   (void)cabsl(x);
449 
450   (void)__builtin_abs(x);
451   // expected-warning@-1 {{using integer absolute value function '__builtin_abs' when argument is of complex type}}
452   // expected-note@-2 {{use function '__builtin_cabsf' instead}}
453   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"__builtin_cabsf"
454   (void)__builtin_labs(x);
455   // expected-warning@-1 {{using integer absolute value function '__builtin_labs' when argument is of complex type}}
456   // expected-note@-2 {{use function '__builtin_cabsf' instead}}
457   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_cabsf"
458   (void)__builtin_llabs(x);
459   // expected-warning@-1 {{using integer absolute value function '__builtin_llabs' when argument is of complex type}}
460   // expected-note@-2 {{use function '__builtin_cabsf' instead}}
461   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsf"
462 
463   (void)__builtin_fabsf(x);
464   // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of complex type}}
465   // expected-note@-2 {{use function '__builtin_cabsf' instead}}
466   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsf"
467   (void)__builtin_fabs(x);
468   // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of complex type}}
469   // expected-note@-2 {{use function '__builtin_cabsf' instead}}
470   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_cabsf"
471   (void)__builtin_fabsl(x);
472   // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of complex type}}
473   // expected-note@-2 {{use function '__builtin_cabsf' instead}}
474   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsf"
475 
476   (void)__builtin_cabsf(x);
477   (void)__builtin_cabs(x);
478   (void)__builtin_cabsl(x);
479 }
480 
test_complex_double(_Complex double x)481 void test_complex_double(_Complex double x) {
482   (void)abs(x);
483   // expected-warning@-1 {{using integer absolute value function 'abs' when argument is of complex type}}
484   // expected-note@-2 {{use function 'cabs' instead}}
485   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"cabs"
486   (void)labs(x);
487   // expected-warning@-1 {{using integer absolute value function 'labs' when argument is of complex type}}
488   // expected-note@-2 {{use function 'cabs' instead}}
489   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"cabs"
490   (void)llabs(x);
491   // expected-warning@-1 {{using integer absolute value function 'llabs' when argument is of complex type}}
492   // expected-note@-2 {{use function 'cabs' instead}}
493   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabs"
494 
495   (void)fabsf(x);
496   // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of complex type}}
497   // expected-note@-2 {{use function 'cabs' instead}}
498   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabs"
499   (void)fabs(x);
500   // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of complex type}}
501   // expected-note@-2 {{use function 'cabs' instead}}
502   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"cabs"
503   (void)fabsl(x);
504   // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of complex type}}
505   // expected-note@-2 {{use function 'cabs' instead}}
506   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabs"
507 
508   (void)cabsf(x);
509   // 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}}
510   // expected-note@-2 {{use function 'cabs' instead}}
511   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabs"
512   (void)cabs(x);
513   (void)cabsl(x);
514 
515   (void)__builtin_abs(x);
516   // expected-warning@-1 {{using integer absolute value function '__builtin_abs' when argument is of complex type}}
517   // expected-note@-2 {{use function '__builtin_cabs' instead}}
518   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"__builtin_cabs"
519   (void)__builtin_labs(x);
520   // expected-warning@-1 {{using integer absolute value function '__builtin_labs' when argument is of complex type}}
521   // expected-note@-2 {{use function '__builtin_cabs' instead}}
522   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_cabs"
523   (void)__builtin_llabs(x);
524   // expected-warning@-1 {{using integer absolute value function '__builtin_llabs' when argument is of complex type}}
525   // expected-note@-2 {{use function '__builtin_cabs' instead}}
526   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabs"
527 
528   (void)__builtin_fabsf(x);
529   // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of complex type}}
530   // expected-note@-2 {{use function '__builtin_cabs' instead}}
531   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabs"
532   (void)__builtin_fabs(x);
533   // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of complex type}}
534   // expected-note@-2 {{use function '__builtin_cabs' instead}}
535   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_cabs"
536   (void)__builtin_fabsl(x);
537   // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of complex type}}
538   // expected-note@-2 {{use function '__builtin_cabs' instead}}
539   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabs"
540 
541   (void)__builtin_cabsf(x);
542   // 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}}
543   // expected-note@-2 {{use function '__builtin_cabs' instead}}
544   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabs"
545   (void)__builtin_cabs(x);
546   (void)__builtin_cabsl(x);
547 }
548 
test_complex_long_double(_Complex long double x)549 void test_complex_long_double(_Complex long double x) {
550   (void)abs(x);
551   // expected-warning@-1 {{using integer absolute value function 'abs' when argument is of complex type}}
552   // expected-note@-2 {{use function 'cabsl' instead}}
553   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"cabsl"
554   (void)labs(x);
555   // expected-warning@-1 {{using integer absolute value function 'labs' when argument is of complex type}}
556   // expected-note@-2 {{use function 'cabsl' instead}}
557   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"cabsl"
558   (void)llabs(x);
559   // expected-warning@-1 {{using integer absolute value function 'llabs' when argument is of complex type}}
560   // expected-note@-2 {{use function 'cabsl' instead}}
561   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsl"
562 
563   (void)fabsf(x);
564   // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of complex type}}
565   // expected-note@-2 {{use function 'cabsl' instead}}
566   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsl"
567   (void)fabs(x);
568   // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of complex type}}
569   // expected-note@-2 {{use function 'cabsl' instead}}
570   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"cabsl"
571   (void)fabsl(x);
572   // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of complex type}}
573   // expected-note@-2 {{use function 'cabsl' instead}}
574   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsl"
575 
576   (void)cabsf(x);
577   // 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}}
578   // expected-note@-2 {{use function 'cabsl' instead}}
579   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsl"
580   (void)cabs(x);
581   // 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}}
582   // expected-note@-2 {{use function 'cabsl' instead}}
583   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"cabsl"
584   (void)cabsl(x);
585 
586   (void)__builtin_abs(x);
587   // expected-warning@-1 {{using integer absolute value function '__builtin_abs' when argument is of complex type}}
588   // expected-note@-2 {{use function '__builtin_cabsl' instead}}
589   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"__builtin_cabsl"
590   (void)__builtin_labs(x);
591   // expected-warning@-1 {{using integer absolute value function '__builtin_labs' when argument is of complex type}}
592   // expected-note@-2 {{use function '__builtin_cabsl' instead}}
593   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_cabsl"
594   (void)__builtin_llabs(x);
595   // expected-warning@-1 {{using integer absolute value function '__builtin_llabs' when argument is of complex type}}
596   // expected-note@-2 {{use function '__builtin_cabsl' instead}}
597   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsl"
598 
599   (void)__builtin_fabsf(x);
600   // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of complex type}}
601   // expected-note@-2 {{use function '__builtin_cabsl' instead}}
602   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsl"
603   (void)__builtin_fabs(x);
604   // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of complex type}}
605   // expected-note@-2 {{use function '__builtin_cabsl' instead}}
606   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_cabsl"
607   (void)__builtin_fabsl(x);
608   // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of complex type}}
609   // expected-note@-2 {{use function '__builtin_cabsl' instead}}
610   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsl"
611 
612   (void)__builtin_cabsf(x);
613   // 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}}
614   // expected-note@-2 {{use function '__builtin_cabsl' instead}}
615   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsl"
616   (void)__builtin_cabs(x);
617   // 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}}
618   // expected-note@-2 {{use function '__builtin_cabsl' instead}}
619   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_cabsl"
620   (void)__builtin_cabsl(x);
621 }
622 
test_unsigned_int(unsigned int x)623 void test_unsigned_int(unsigned int x) {
624   (void)abs(x);
625   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
626   // expected-note@-2 {{remove the call to 'abs' since unsigned values cannot be negative}}
627   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:""
628   (void)labs(x);
629   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
630   // expected-note@-2 {{remove the call to 'labs' since unsigned values cannot be negative}}
631   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
632   (void)llabs(x);
633   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
634   // expected-note@-2 {{remove the call to 'llabs' since unsigned values cannot be negative}}
635   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
636 
637   (void)fabsf(x);
638   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
639   // expected-note@-2 {{remove the call to 'fabsf' since unsigned values cannot be negative}}
640   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
641   (void)fabs(x);
642   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
643   // expected-note@-2 {{remove the call to 'fabs' since unsigned values cannot be negative}}
644   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
645   (void)fabsl(x);
646   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
647   // expected-note@-2 {{remove the call to 'fabsl' since unsigned values cannot be negative}}
648   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
649 
650   (void)cabsf(x);
651   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
652   // expected-note@-2 {{remove the call to 'cabsf' since unsigned values cannot be negative}}
653   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
654   (void)cabs(x);
655   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
656   // expected-note@-2 {{remove the call to 'cabs' since unsigned values cannot be negative}}
657   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
658   (void)cabsl(x);
659   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
660   // expected-note@-2 {{remove the call to 'cabsl' since unsigned values cannot be negative}}
661   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
662 
663   (void)__builtin_abs(x);
664   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
665   // expected-note@-2 {{remove the call to '__builtin_abs' since unsigned values cannot be negative}}
666   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:""
667   (void)__builtin_labs(x);
668   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
669   // expected-note@-2 {{remove the call to '__builtin_labs' since unsigned values cannot be negative}}
670   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
671   (void)__builtin_llabs(x);
672   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
673   // expected-note@-2 {{remove the call to '__builtin_llabs' since unsigned values cannot be negative}}
674   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
675 
676   (void)__builtin_fabsf(x);
677   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
678   // expected-note@-2 {{remove the call to '__builtin_fabsf' since unsigned values cannot be negative}}
679   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
680   (void)__builtin_fabs(x);
681   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
682   // expected-note@-2 {{remove the call to '__builtin_fabs' since unsigned values cannot be negative}}
683   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
684   (void)__builtin_fabsl(x);
685   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
686   // expected-note@-2 {{remove the call to '__builtin_fabsl' since unsigned values cannot be negative}}
687   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
688 
689   (void)__builtin_cabsf(x);
690   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
691   // expected-note@-2 {{remove the call to '__builtin_cabsf' since unsigned values cannot be negative}}
692   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
693   (void)__builtin_cabs(x);
694   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
695   // expected-note@-2 {{remove the call to '__builtin_cabs' since unsigned values cannot be negative}}
696   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
697   (void)__builtin_cabsl(x);
698   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
699   // expected-note@-2 {{remove the call to '__builtin_cabsl' since unsigned values cannot be negative}}
700   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
701 }
702 
test_unsigned_long(unsigned long x)703 void test_unsigned_long(unsigned long x) {
704   (void)abs(x);
705   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
706   // expected-note@-2 {{remove the call to 'abs' since unsigned values cannot be negative}}
707   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:""
708   (void)labs(x);
709   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
710   // expected-note@-2 {{remove the call to 'labs' since unsigned values cannot be negative}}
711   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
712   (void)llabs(x);
713   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
714   // expected-note@-2 {{remove the call to 'llabs' since unsigned values cannot be negative}}
715   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
716 
717   (void)fabsf(x);
718   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
719   // expected-note@-2 {{remove the call to 'fabsf' since unsigned values cannot be negative}}
720   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
721   (void)fabs(x);
722   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
723   // expected-note@-2 {{remove the call to 'fabs' since unsigned values cannot be negative}}
724   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
725   (void)fabsl(x);
726   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
727   // expected-note@-2 {{remove the call to 'fabsl' since unsigned values cannot be negative}}
728   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
729 
730   (void)cabsf(x);
731   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
732   // expected-note@-2 {{remove the call to 'cabsf' since unsigned values cannot be negative}}
733   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
734   (void)cabs(x);
735   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
736   // expected-note@-2 {{remove the call to 'cabs' since unsigned values cannot be negative}}
737   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
738   (void)cabsl(x);
739   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
740   // expected-note@-2 {{remove the call to 'cabsl' since unsigned values cannot be negative}}
741   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
742 
743   (void)__builtin_abs(x);
744   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
745   // expected-note@-2 {{remove the call to '__builtin_abs' since unsigned values cannot be negative}}
746   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:""
747   (void)__builtin_labs(x);
748   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
749   // expected-note@-2 {{remove the call to '__builtin_labs' since unsigned values cannot be negative}}
750   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
751   (void)__builtin_llabs(x);
752   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
753   // expected-note@-2 {{remove the call to '__builtin_llabs' since unsigned values cannot be negative}}
754   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
755 
756   (void)__builtin_fabsf(x);
757   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
758   // expected-note@-2 {{remove the call to '__builtin_fabsf' since unsigned values cannot be negative}}
759   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
760   (void)__builtin_fabs(x);
761   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
762   // expected-note@-2 {{remove the call to '__builtin_fabs' since unsigned values cannot be negative}}
763   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
764   (void)__builtin_fabsl(x);
765   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
766   // expected-note@-2 {{remove the call to '__builtin_fabsl' since unsigned values cannot be negative}}
767   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
768 
769   (void)__builtin_cabsf(x);
770   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
771   // expected-note@-2 {{remove the call to '__builtin_cabsf' since unsigned values cannot be negative}}
772   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
773   (void)__builtin_cabs(x);
774   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
775   // expected-note@-2 {{remove the call to '__builtin_cabs' since unsigned values cannot be negative}}
776   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
777   (void)__builtin_cabsl(x);
778   // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
779   // expected-note@-2 {{remove the call to '__builtin_cabsl' since unsigned values cannot be negative}}
780   // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
781 }
782 
test_array()783 long long test_array() {
784   return llabs((long long[]){1});
785   // expected-warning@-1 {{absolute value of array type}}
786 }
test_function_pointer()787 long long test_function_pointer() {
788   return llabs(&test_function_pointer);
789   // expected-warning@-1 {{absolute value of pointer type}}
790 }
test_void_pointer(void * x)791 long long test_void_pointer(void *x) {
792   return llabs(x);
793   // expected-warning@-1 {{absolute value of pointer type}}
794 }
test_function()795 long long test_function() {
796   return llabs(test_function);
797   // expected-warning@-1 {{absolute value of function type}}
798 }
799