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