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