annotate clang/test/SemaCXX/warn-absolute-value.cpp @ 222:81f6424ef0e3 llvm-original

LLVM original branch
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Sun, 18 Jul 2021 22:10:01 +0900
parents 1d019706d866
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
150
anatofuz
parents:
diff changeset
1 // RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only -verify %s -Wabsolute-value -std=c++11
anatofuz
parents:
diff changeset
2 // RUN: %clang_cc1 -triple i686-pc-linux-gnu -fsyntax-only %s -Wabsolute-value -fdiagnostics-parseable-fixits -std=c++11 2>&1 | FileCheck %s
anatofuz
parents:
diff changeset
3
anatofuz
parents:
diff changeset
4 extern "C" {
anatofuz
parents:
diff changeset
5 int abs(int);
anatofuz
parents:
diff changeset
6 long int labs(long int);
anatofuz
parents:
diff changeset
7 long long int llabs(long long int);
anatofuz
parents:
diff changeset
8
anatofuz
parents:
diff changeset
9 float fabsf(float);
anatofuz
parents:
diff changeset
10 double fabs(double);
anatofuz
parents:
diff changeset
11 long double fabsl(long double);
anatofuz
parents:
diff changeset
12
anatofuz
parents:
diff changeset
13 float cabsf(float _Complex);
anatofuz
parents:
diff changeset
14 double cabs(double _Complex);
anatofuz
parents:
diff changeset
15 long double cabsl(long double _Complex);
anatofuz
parents:
diff changeset
16 }
anatofuz
parents:
diff changeset
17
anatofuz
parents:
diff changeset
18 namespace std {
anatofuz
parents:
diff changeset
19
anatofuz
parents:
diff changeset
20 inline namespace __1 {
anatofuz
parents:
diff changeset
21 int abs(int);
anatofuz
parents:
diff changeset
22 long int abs(long int);
anatofuz
parents:
diff changeset
23 long long int abs(long long int);
anatofuz
parents:
diff changeset
24 }
anatofuz
parents:
diff changeset
25
anatofuz
parents:
diff changeset
26 float abs(float);
anatofuz
parents:
diff changeset
27 double abs(double);
anatofuz
parents:
diff changeset
28 long double abs(long double);
anatofuz
parents:
diff changeset
29
anatofuz
parents:
diff changeset
30 template <typename T>
anatofuz
parents:
diff changeset
31 double abs(T);
anatofuz
parents:
diff changeset
32
anatofuz
parents:
diff changeset
33 }
anatofuz
parents:
diff changeset
34
anatofuz
parents:
diff changeset
35 void test_int(int x) {
anatofuz
parents:
diff changeset
36 (void)std::abs(x);
anatofuz
parents:
diff changeset
37
anatofuz
parents:
diff changeset
38 (void)abs(x);
anatofuz
parents:
diff changeset
39 (void)labs(x);
anatofuz
parents:
diff changeset
40 (void)llabs(x);
anatofuz
parents:
diff changeset
41
anatofuz
parents:
diff changeset
42 (void)fabsf(x);
anatofuz
parents:
diff changeset
43 // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of integer type}}
anatofuz
parents:
diff changeset
44 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
45 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
46 (void)fabs(x);
anatofuz
parents:
diff changeset
47 // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of integer type}}
anatofuz
parents:
diff changeset
48 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
49 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
anatofuz
parents:
diff changeset
50 (void)fabsl(x);
anatofuz
parents:
diff changeset
51 // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of integer type}}
anatofuz
parents:
diff changeset
52 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
53 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
54
anatofuz
parents:
diff changeset
55 (void)cabsf(x);
anatofuz
parents:
diff changeset
56 // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of integer type}}
anatofuz
parents:
diff changeset
57 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
58 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
59 (void)cabs(x);
anatofuz
parents:
diff changeset
60 // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of integer type}}
anatofuz
parents:
diff changeset
61 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
62 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
anatofuz
parents:
diff changeset
63 (void)cabsl(x);
anatofuz
parents:
diff changeset
64 // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of integer type}}
anatofuz
parents:
diff changeset
65 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
66 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
67
anatofuz
parents:
diff changeset
68 (void)__builtin_abs(x);
anatofuz
parents:
diff changeset
69 (void)__builtin_labs(x);
anatofuz
parents:
diff changeset
70 (void)__builtin_llabs(x);
anatofuz
parents:
diff changeset
71
anatofuz
parents:
diff changeset
72 (void)__builtin_fabsf(x);
anatofuz
parents:
diff changeset
73 // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of integer type}}
anatofuz
parents:
diff changeset
74 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
75 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
76 (void)__builtin_fabs(x);
anatofuz
parents:
diff changeset
77 // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of integer type}}
anatofuz
parents:
diff changeset
78 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
79 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
anatofuz
parents:
diff changeset
80 (void)__builtin_fabsl(x);
anatofuz
parents:
diff changeset
81 // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of integer type}}
anatofuz
parents:
diff changeset
82 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
83 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
84
anatofuz
parents:
diff changeset
85 (void)__builtin_cabsf(x);
anatofuz
parents:
diff changeset
86 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of integer type}}
anatofuz
parents:
diff changeset
87 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
88 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
89 (void)__builtin_cabs(x);
anatofuz
parents:
diff changeset
90 // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of integer type}}
anatofuz
parents:
diff changeset
91 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
92 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
anatofuz
parents:
diff changeset
93 (void)__builtin_cabsl(x);
anatofuz
parents:
diff changeset
94 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of integer type}}
anatofuz
parents:
diff changeset
95 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
96 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
97 }
anatofuz
parents:
diff changeset
98
anatofuz
parents:
diff changeset
99 void test_long(long x) {
anatofuz
parents:
diff changeset
100 (void)std::abs(x);
anatofuz
parents:
diff changeset
101
anatofuz
parents:
diff changeset
102 (void)abs(x); // no warning - int and long are same length for this target
anatofuz
parents:
diff changeset
103 (void)labs(x);
anatofuz
parents:
diff changeset
104 (void)llabs(x);
anatofuz
parents:
diff changeset
105
anatofuz
parents:
diff changeset
106 (void)fabsf(x);
anatofuz
parents:
diff changeset
107 // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of integer type}}
anatofuz
parents:
diff changeset
108 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
109 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
110 (void)fabs(x);
anatofuz
parents:
diff changeset
111 // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of integer type}}
anatofuz
parents:
diff changeset
112 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
113 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
anatofuz
parents:
diff changeset
114 (void)fabsl(x);
anatofuz
parents:
diff changeset
115 // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of integer type}}
anatofuz
parents:
diff changeset
116 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
117 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
118
anatofuz
parents:
diff changeset
119 (void)cabsf(x);
anatofuz
parents:
diff changeset
120 // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of integer type}}
anatofuz
parents:
diff changeset
121 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
122 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
123 (void)cabs(x);
anatofuz
parents:
diff changeset
124 // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of integer type}}
anatofuz
parents:
diff changeset
125 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
126 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
anatofuz
parents:
diff changeset
127 (void)cabsl(x);
anatofuz
parents:
diff changeset
128 // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of integer type}}
anatofuz
parents:
diff changeset
129 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
130 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
131
anatofuz
parents:
diff changeset
132 (void)__builtin_abs(x); // no warning - int and long are same length for
anatofuz
parents:
diff changeset
133 // this target
anatofuz
parents:
diff changeset
134 (void)__builtin_labs(x);
anatofuz
parents:
diff changeset
135 (void)__builtin_llabs(x);
anatofuz
parents:
diff changeset
136
anatofuz
parents:
diff changeset
137 (void)__builtin_fabsf(x);
anatofuz
parents:
diff changeset
138 // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of integer type}}
anatofuz
parents:
diff changeset
139 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
140 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
141 (void)__builtin_fabs(x);
anatofuz
parents:
diff changeset
142 // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of integer type}}
anatofuz
parents:
diff changeset
143 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
144 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
anatofuz
parents:
diff changeset
145 (void)__builtin_fabsl(x);
anatofuz
parents:
diff changeset
146 // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of integer type}}
anatofuz
parents:
diff changeset
147 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
148 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
149
anatofuz
parents:
diff changeset
150 (void)__builtin_cabsf(x);
anatofuz
parents:
diff changeset
151 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of integer type}}
anatofuz
parents:
diff changeset
152 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
153 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
154 (void)__builtin_cabs(x);
anatofuz
parents:
diff changeset
155 // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of integer type}}
anatofuz
parents:
diff changeset
156 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
157 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
anatofuz
parents:
diff changeset
158 (void)__builtin_cabsl(x);
anatofuz
parents:
diff changeset
159 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of integer type}}
anatofuz
parents:
diff changeset
160 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
161 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
162 }
anatofuz
parents:
diff changeset
163
anatofuz
parents:
diff changeset
164 void test_long_long(long long x) {
anatofuz
parents:
diff changeset
165 (void)std::abs(x);
anatofuz
parents:
diff changeset
166
anatofuz
parents:
diff changeset
167 (void)abs(x);
anatofuz
parents:
diff changeset
168 // expected-warning@-1{{absolute value function 'abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value}}
anatofuz
parents:
diff changeset
169 // expected-note@-2{{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
170 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"std::abs"
anatofuz
parents:
diff changeset
171 (void)labs(x);
anatofuz
parents:
diff changeset
172 // expected-warning@-1{{absolute value function 'labs' given an argument of type 'long long' but has parameter of type 'long' which may cause truncation of value}}
anatofuz
parents:
diff changeset
173 // expected-note@-2{{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
174 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
anatofuz
parents:
diff changeset
175 (void)llabs(x);
anatofuz
parents:
diff changeset
176
anatofuz
parents:
diff changeset
177 (void)fabsf(x);
anatofuz
parents:
diff changeset
178 // expected-warning@-1 {{using floating point absolute value function 'fabsf' when argument is of integer type}}
anatofuz
parents:
diff changeset
179 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
180 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
181 (void)fabs(x);
anatofuz
parents:
diff changeset
182 // expected-warning@-1 {{using floating point absolute value function 'fabs' when argument is of integer type}}
anatofuz
parents:
diff changeset
183 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
184 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
anatofuz
parents:
diff changeset
185 (void)fabsl(x);
anatofuz
parents:
diff changeset
186 // expected-warning@-1 {{using floating point absolute value function 'fabsl' when argument is of integer type}}
anatofuz
parents:
diff changeset
187 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
188 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
189
anatofuz
parents:
diff changeset
190 (void)cabsf(x);
anatofuz
parents:
diff changeset
191 // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of integer type}}
anatofuz
parents:
diff changeset
192 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
193 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
194 (void)cabs(x);
anatofuz
parents:
diff changeset
195 // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of integer type}}
anatofuz
parents:
diff changeset
196 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
197 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
anatofuz
parents:
diff changeset
198 (void)cabsl(x);
anatofuz
parents:
diff changeset
199 // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of integer type}}
anatofuz
parents:
diff changeset
200 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
201 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
202
anatofuz
parents:
diff changeset
203 (void)__builtin_abs(x);
anatofuz
parents:
diff changeset
204 // expected-warning@-1{{absolute value function '__builtin_abs' given an argument of type 'long long' but has parameter of type 'int' which may cause truncation of value}}
anatofuz
parents:
diff changeset
205 // expected-note@-2{{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
206 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"std::abs"
anatofuz
parents:
diff changeset
207 (void)__builtin_labs(x);
anatofuz
parents:
diff changeset
208 // expected-warning@-1{{absolute value function '__builtin_labs' given an argument of type 'long long' but has parameter of type 'long' which may cause truncation of value}}
anatofuz
parents:
diff changeset
209 // expected-note@-2{{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
210 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
anatofuz
parents:
diff changeset
211 (void)__builtin_llabs(x);
anatofuz
parents:
diff changeset
212
anatofuz
parents:
diff changeset
213 (void)__builtin_fabsf(x);
anatofuz
parents:
diff changeset
214 // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsf' when argument is of integer type}}
anatofuz
parents:
diff changeset
215 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
216 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
217 (void)__builtin_fabs(x);
anatofuz
parents:
diff changeset
218 // expected-warning@-1 {{using floating point absolute value function '__builtin_fabs' when argument is of integer type}}
anatofuz
parents:
diff changeset
219 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
220 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
anatofuz
parents:
diff changeset
221 (void)__builtin_fabsl(x);
anatofuz
parents:
diff changeset
222 // expected-warning@-1 {{using floating point absolute value function '__builtin_fabsl' when argument is of integer type}}
anatofuz
parents:
diff changeset
223 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
224 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
225
anatofuz
parents:
diff changeset
226 (void)__builtin_cabsf(x);
anatofuz
parents:
diff changeset
227 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of integer type}}
anatofuz
parents:
diff changeset
228 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
229 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
230 (void)__builtin_cabs(x);
anatofuz
parents:
diff changeset
231 // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of integer type}}
anatofuz
parents:
diff changeset
232 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
233 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
anatofuz
parents:
diff changeset
234 (void)__builtin_cabsl(x);
anatofuz
parents:
diff changeset
235 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of integer type}}
anatofuz
parents:
diff changeset
236 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
237 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
238 }
anatofuz
parents:
diff changeset
239
anatofuz
parents:
diff changeset
240 void test_float(float x) {
anatofuz
parents:
diff changeset
241 (void)std::abs(x);
anatofuz
parents:
diff changeset
242
anatofuz
parents:
diff changeset
243 (void)abs(x);
anatofuz
parents:
diff changeset
244 // expected-warning@-1 {{using integer absolute value function 'abs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
245 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
246 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"std::abs"
anatofuz
parents:
diff changeset
247 (void)labs(x);
anatofuz
parents:
diff changeset
248 // expected-warning@-1 {{using integer absolute value function 'labs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
249 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
250 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
anatofuz
parents:
diff changeset
251 (void)llabs(x);
anatofuz
parents:
diff changeset
252 // expected-warning@-1 {{using integer absolute value function 'llabs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
253 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
254 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
255
anatofuz
parents:
diff changeset
256 (void)fabsf(x);
anatofuz
parents:
diff changeset
257 (void)fabs(x);
anatofuz
parents:
diff changeset
258 (void)fabsl(x);
anatofuz
parents:
diff changeset
259
anatofuz
parents:
diff changeset
260 (void)cabsf(x);
anatofuz
parents:
diff changeset
261 // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of floating point type}}
anatofuz
parents:
diff changeset
262 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
263 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
264 (void)cabs(x);
anatofuz
parents:
diff changeset
265 // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
266 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
267 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
anatofuz
parents:
diff changeset
268 (void)cabsl(x);
anatofuz
parents:
diff changeset
269 // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of floating point type}}
anatofuz
parents:
diff changeset
270 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
271 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
272
anatofuz
parents:
diff changeset
273 (void)__builtin_abs(x);
anatofuz
parents:
diff changeset
274 // expected-warning@-1 {{using integer absolute value function '__builtin_abs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
275 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
276 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"std::abs"
anatofuz
parents:
diff changeset
277 (void)__builtin_labs(x);
anatofuz
parents:
diff changeset
278 // expected-warning@-1 {{using integer absolute value function '__builtin_labs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
279 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
280 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
anatofuz
parents:
diff changeset
281 (void)__builtin_llabs(x);
anatofuz
parents:
diff changeset
282 // expected-warning@-1 {{using integer absolute value function '__builtin_llabs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
283 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
284 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
285
anatofuz
parents:
diff changeset
286 (void)__builtin_fabsf(x);
anatofuz
parents:
diff changeset
287 (void)__builtin_fabs(x);
anatofuz
parents:
diff changeset
288 (void)__builtin_fabsl(x);
anatofuz
parents:
diff changeset
289
anatofuz
parents:
diff changeset
290 (void)__builtin_cabsf(x);
anatofuz
parents:
diff changeset
291 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of floating point type}}
anatofuz
parents:
diff changeset
292 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
293 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
294 (void)__builtin_cabs(x);
anatofuz
parents:
diff changeset
295 // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
296 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
297 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
anatofuz
parents:
diff changeset
298 (void)__builtin_cabsl(x);
anatofuz
parents:
diff changeset
299 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of floating point type}}
anatofuz
parents:
diff changeset
300 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
301 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
302 }
anatofuz
parents:
diff changeset
303
anatofuz
parents:
diff changeset
304 void test_double(double x) {
anatofuz
parents:
diff changeset
305 (void)std::abs(x);
anatofuz
parents:
diff changeset
306
anatofuz
parents:
diff changeset
307 (void)abs(x);
anatofuz
parents:
diff changeset
308 // expected-warning@-1 {{using integer absolute value function 'abs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
309 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
310 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"std::abs"
anatofuz
parents:
diff changeset
311 (void)labs(x);
anatofuz
parents:
diff changeset
312 // expected-warning@-1 {{using integer absolute value function 'labs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
313 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
314 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
anatofuz
parents:
diff changeset
315 (void)llabs(x);
anatofuz
parents:
diff changeset
316 // expected-warning@-1 {{using integer absolute value function 'llabs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
317 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
318 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
319
anatofuz
parents:
diff changeset
320 (void)fabsf(x);
anatofuz
parents:
diff changeset
321 // expected-warning@-1{{absolute value function 'fabsf' given an argument of type 'double' but has parameter of type 'float' which may cause truncation of value}}
anatofuz
parents:
diff changeset
322 // expected-note@-2{{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
323 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
324 (void)fabs(x);
anatofuz
parents:
diff changeset
325 (void)fabsl(x);
anatofuz
parents:
diff changeset
326
anatofuz
parents:
diff changeset
327 (void)cabsf(x);
anatofuz
parents:
diff changeset
328 // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of floating point type}}
anatofuz
parents:
diff changeset
329 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
330 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
331 (void)cabs(x);
anatofuz
parents:
diff changeset
332 // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
333 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
334 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
anatofuz
parents:
diff changeset
335 (void)cabsl(x);
anatofuz
parents:
diff changeset
336 // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of floating point type}}
anatofuz
parents:
diff changeset
337 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
338 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
339
anatofuz
parents:
diff changeset
340 (void)__builtin_abs(x);
anatofuz
parents:
diff changeset
341 // expected-warning@-1 {{using integer absolute value function '__builtin_abs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
342 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
343 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"std::abs"
anatofuz
parents:
diff changeset
344 (void)__builtin_labs(x);
anatofuz
parents:
diff changeset
345 // expected-warning@-1 {{using integer absolute value function '__builtin_labs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
346 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
347 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
anatofuz
parents:
diff changeset
348 (void)__builtin_llabs(x);
anatofuz
parents:
diff changeset
349 // expected-warning@-1 {{using integer absolute value function '__builtin_llabs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
350 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
351 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
352
anatofuz
parents:
diff changeset
353 (void)__builtin_fabsf(x);
anatofuz
parents:
diff changeset
354 // expected-warning@-1{{absolute value function '__builtin_fabsf' given an argument of type 'double' but has parameter of type 'float' which may cause truncation of value}}
anatofuz
parents:
diff changeset
355 // expected-note@-2{{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
356 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
357 (void)__builtin_fabs(x);
anatofuz
parents:
diff changeset
358 (void)__builtin_fabsl(x);
anatofuz
parents:
diff changeset
359
anatofuz
parents:
diff changeset
360 (void)__builtin_cabsf(x);
anatofuz
parents:
diff changeset
361 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of floating point type}}
anatofuz
parents:
diff changeset
362 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
363 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
364 (void)__builtin_cabs(x);
anatofuz
parents:
diff changeset
365 // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
366 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
367 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
anatofuz
parents:
diff changeset
368 (void)__builtin_cabsl(x);
anatofuz
parents:
diff changeset
369 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of floating point type}}
anatofuz
parents:
diff changeset
370 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
371 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
372 }
anatofuz
parents:
diff changeset
373
anatofuz
parents:
diff changeset
374 void test_long_double(long double x) {
anatofuz
parents:
diff changeset
375 (void)std::abs(x);
anatofuz
parents:
diff changeset
376
anatofuz
parents:
diff changeset
377 (void)abs(x);
anatofuz
parents:
diff changeset
378 // expected-warning@-1 {{using integer absolute value function 'abs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
379 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
380 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:"std::abs"
anatofuz
parents:
diff changeset
381 (void)labs(x);
anatofuz
parents:
diff changeset
382 // expected-warning@-1 {{using integer absolute value function 'labs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
383 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
384 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
anatofuz
parents:
diff changeset
385 (void)llabs(x);
anatofuz
parents:
diff changeset
386 // expected-warning@-1 {{using integer absolute value function 'llabs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
387 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
388 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
389
anatofuz
parents:
diff changeset
390 (void)fabsf(x);
anatofuz
parents:
diff changeset
391 // expected-warning@-1{{absolute value function 'fabsf' given an argument of type 'long double' but has parameter of type 'float' which may cause truncation of value}}
anatofuz
parents:
diff changeset
392 // expected-note@-2{{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
393 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
394 (void)fabs(x);
anatofuz
parents:
diff changeset
395 // expected-warning@-1{{absolute value function 'fabs' given an argument of type 'long double' but has parameter of type 'double' which may cause truncation of value}}
anatofuz
parents:
diff changeset
396 // expected-note@-2{{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
397 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
anatofuz
parents:
diff changeset
398 (void)fabsl(x);
anatofuz
parents:
diff changeset
399
anatofuz
parents:
diff changeset
400 (void)cabsf(x);
anatofuz
parents:
diff changeset
401 // expected-warning@-1 {{using complex absolute value function 'cabsf' when argument is of floating point type}}
anatofuz
parents:
diff changeset
402 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
403 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
404 (void)cabs(x);
anatofuz
parents:
diff changeset
405 // expected-warning@-1 {{using complex absolute value function 'cabs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
406 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
407 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"std::abs"
anatofuz
parents:
diff changeset
408 (void)cabsl(x);
anatofuz
parents:
diff changeset
409 // expected-warning@-1 {{using complex absolute value function 'cabsl' when argument is of floating point type}}
anatofuz
parents:
diff changeset
410 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
411 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"std::abs"
anatofuz
parents:
diff changeset
412
anatofuz
parents:
diff changeset
413 (void)__builtin_abs(x);
anatofuz
parents:
diff changeset
414 // expected-warning@-1 {{using integer absolute value function '__builtin_abs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
415 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
416 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:"std::abs"
anatofuz
parents:
diff changeset
417 (void)__builtin_labs(x);
anatofuz
parents:
diff changeset
418 // expected-warning@-1 {{using integer absolute value function '__builtin_labs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
419 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
420 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
anatofuz
parents:
diff changeset
421 (void)__builtin_llabs(x);
anatofuz
parents:
diff changeset
422 // expected-warning@-1 {{using integer absolute value function '__builtin_llabs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
423 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
424 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
425
anatofuz
parents:
diff changeset
426 (void)__builtin_fabsf(x);
anatofuz
parents:
diff changeset
427 // expected-warning@-1{{absolute value function '__builtin_fabsf' given an argument of type 'long double' but has parameter of type 'float' which may cause truncation of value}}
anatofuz
parents:
diff changeset
428 // expected-note@-2{{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
429 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
430 (void)__builtin_fabs(x);
anatofuz
parents:
diff changeset
431 // expected-warning@-1{{absolute value function '__builtin_fabs' given an argument of type 'long double' but has parameter of type 'double' which may cause truncation of value}}
anatofuz
parents:
diff changeset
432 // expected-note@-2{{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
433 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
anatofuz
parents:
diff changeset
434 (void)__builtin_fabsl(x);
anatofuz
parents:
diff changeset
435
anatofuz
parents:
diff changeset
436 (void)__builtin_cabsf(x);
anatofuz
parents:
diff changeset
437 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsf' when argument is of floating point type}}
anatofuz
parents:
diff changeset
438 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
439 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
440 (void)__builtin_cabs(x);
anatofuz
parents:
diff changeset
441 // expected-warning@-1 {{using complex absolute value function '__builtin_cabs' when argument is of floating point type}}
anatofuz
parents:
diff changeset
442 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
443 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"std::abs"
anatofuz
parents:
diff changeset
444 (void)__builtin_cabsl(x);
anatofuz
parents:
diff changeset
445 // expected-warning@-1 {{using complex absolute value function '__builtin_cabsl' when argument is of floating point type}}
anatofuz
parents:
diff changeset
446 // expected-note@-2 {{use function 'std::abs' instead}}
anatofuz
parents:
diff changeset
447 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"std::abs"
anatofuz
parents:
diff changeset
448 }
anatofuz
parents:
diff changeset
449
anatofuz
parents:
diff changeset
450 void test_complex_float(_Complex float x) {
anatofuz
parents:
diff changeset
451 (void)cabsf(x);
anatofuz
parents:
diff changeset
452 (void)cabs(x);
anatofuz
parents:
diff changeset
453 (void)cabsl(x);
anatofuz
parents:
diff changeset
454
anatofuz
parents:
diff changeset
455 (void)__builtin_cabsf(x);
anatofuz
parents:
diff changeset
456 (void)__builtin_cabs(x);
anatofuz
parents:
diff changeset
457 (void)__builtin_cabsl(x);
anatofuz
parents:
diff changeset
458 }
anatofuz
parents:
diff changeset
459
anatofuz
parents:
diff changeset
460 void test_complex_double(_Complex double x) {
anatofuz
parents:
diff changeset
461 (void)cabsf(x);
anatofuz
parents:
diff changeset
462 // expected-warning@-1 {{absolute value function 'cabsf' given an argument of type '_Complex double' but has parameter of type '_Complex float' which may cause truncation of value}}
anatofuz
parents:
diff changeset
463 // expected-note@-2 {{use function 'cabs' instead}}
anatofuz
parents:
diff changeset
464 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabs"
anatofuz
parents:
diff changeset
465 (void)cabs(x);
anatofuz
parents:
diff changeset
466 (void)cabsl(x);
anatofuz
parents:
diff changeset
467
anatofuz
parents:
diff changeset
468
anatofuz
parents:
diff changeset
469 (void)__builtin_cabsf(x);
anatofuz
parents:
diff changeset
470 // expected-warning@-1 {{absolute value function '__builtin_cabsf' given an argument of type '_Complex double' but has parameter of type '_Complex float' which may cause truncation of value}}
anatofuz
parents:
diff changeset
471 // expected-note@-2 {{use function '__builtin_cabs' instead}}
anatofuz
parents:
diff changeset
472 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabs"
anatofuz
parents:
diff changeset
473 (void)__builtin_cabs(x);
anatofuz
parents:
diff changeset
474 (void)__builtin_cabsl(x);
anatofuz
parents:
diff changeset
475 }
anatofuz
parents:
diff changeset
476
anatofuz
parents:
diff changeset
477 void test_complex_long_double(_Complex long double x) {
anatofuz
parents:
diff changeset
478 (void)cabsf(x);
anatofuz
parents:
diff changeset
479 // expected-warning@-1 {{absolute value function 'cabsf' given an argument of type '_Complex long double' but has parameter of type '_Complex float' which may cause truncation of value}}
anatofuz
parents:
diff changeset
480 // expected-note@-2 {{use function 'cabsl' instead}}
anatofuz
parents:
diff changeset
481 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:"cabsl"
anatofuz
parents:
diff changeset
482 (void)cabs(x);
anatofuz
parents:
diff changeset
483 // expected-warning@-1 {{absolute value function 'cabs' given an argument of type '_Complex long double' but has parameter of type '_Complex double' which may cause truncation of value}}
anatofuz
parents:
diff changeset
484 // expected-note@-2 {{use function 'cabsl' instead}}
anatofuz
parents:
diff changeset
485 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:"cabsl"
anatofuz
parents:
diff changeset
486 (void)cabsl(x);
anatofuz
parents:
diff changeset
487
anatofuz
parents:
diff changeset
488 (void)__builtin_cabsf(x);
anatofuz
parents:
diff changeset
489 // expected-warning@-1 {{absolute value function '__builtin_cabsf' given an argument of type '_Complex long double' but has parameter of type '_Complex float' which may cause truncation of value}}
anatofuz
parents:
diff changeset
490 // expected-note@-2 {{use function '__builtin_cabsl' instead}}
anatofuz
parents:
diff changeset
491 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:"__builtin_cabsl"
anatofuz
parents:
diff changeset
492 (void)__builtin_cabs(x);
anatofuz
parents:
diff changeset
493 // expected-warning@-1 {{absolute value function '__builtin_cabs' given an argument of type '_Complex long double' but has parameter of type '_Complex double' which may cause truncation of value}}
anatofuz
parents:
diff changeset
494 // expected-note@-2 {{use function '__builtin_cabsl' instead}}
anatofuz
parents:
diff changeset
495 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:"__builtin_cabsl"
anatofuz
parents:
diff changeset
496 (void)__builtin_cabsl(x);
anatofuz
parents:
diff changeset
497 }
anatofuz
parents:
diff changeset
498
anatofuz
parents:
diff changeset
499 void test_unsigned_int(unsigned int x) {
anatofuz
parents:
diff changeset
500 (void)std::abs(x);
anatofuz
parents:
diff changeset
501 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
anatofuz
parents:
diff changeset
502 // expected-note@-2 {{remove the call to 'std::abs' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
503 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:17}:""
anatofuz
parents:
diff changeset
504
anatofuz
parents:
diff changeset
505 (void)abs(x);
anatofuz
parents:
diff changeset
506 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
anatofuz
parents:
diff changeset
507 // expected-note@-2 {{remove the call to 'abs' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
508 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:""
anatofuz
parents:
diff changeset
509 (void)labs(x);
anatofuz
parents:
diff changeset
510 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
anatofuz
parents:
diff changeset
511 // expected-note@-2 {{remove the call to 'labs' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
512 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
anatofuz
parents:
diff changeset
513 (void)llabs(x);
anatofuz
parents:
diff changeset
514 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
anatofuz
parents:
diff changeset
515 // expected-note@-2 {{remove the call to 'llabs' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
516 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
anatofuz
parents:
diff changeset
517
anatofuz
parents:
diff changeset
518 (void)fabsf(x);
anatofuz
parents:
diff changeset
519 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
anatofuz
parents:
diff changeset
520 // expected-note@-2 {{remove the call to 'fabsf' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
521 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
anatofuz
parents:
diff changeset
522 (void)fabs(x);
anatofuz
parents:
diff changeset
523 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
anatofuz
parents:
diff changeset
524 // expected-note@-2 {{remove the call to 'fabs' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
525 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
anatofuz
parents:
diff changeset
526 (void)fabsl(x);
anatofuz
parents:
diff changeset
527 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
anatofuz
parents:
diff changeset
528 // expected-note@-2 {{remove the call to 'fabsl' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
529 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
anatofuz
parents:
diff changeset
530
anatofuz
parents:
diff changeset
531 (void)cabsf(x);
anatofuz
parents:
diff changeset
532 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
anatofuz
parents:
diff changeset
533 // expected-note@-2 {{remove the call to 'cabsf' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
534 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
anatofuz
parents:
diff changeset
535 (void)cabs(x);
anatofuz
parents:
diff changeset
536 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
anatofuz
parents:
diff changeset
537 // expected-note@-2 {{remove the call to 'cabs' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
538 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
anatofuz
parents:
diff changeset
539 (void)cabsl(x);
anatofuz
parents:
diff changeset
540 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
anatofuz
parents:
diff changeset
541 // expected-note@-2 {{remove the call to 'cabsl' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
542 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
anatofuz
parents:
diff changeset
543
anatofuz
parents:
diff changeset
544 (void)__builtin_abs(x);
anatofuz
parents:
diff changeset
545 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
anatofuz
parents:
diff changeset
546 // expected-note@-2 {{remove the call to '__builtin_abs' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
547 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:""
anatofuz
parents:
diff changeset
548 (void)__builtin_labs(x);
anatofuz
parents:
diff changeset
549 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
anatofuz
parents:
diff changeset
550 // expected-note@-2 {{remove the call to '__builtin_labs' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
551 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
anatofuz
parents:
diff changeset
552 (void)__builtin_llabs(x);
anatofuz
parents:
diff changeset
553 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
anatofuz
parents:
diff changeset
554 // expected-note@-2 {{remove the call to '__builtin_llabs' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
555 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
anatofuz
parents:
diff changeset
556
anatofuz
parents:
diff changeset
557 (void)__builtin_fabsf(x);
anatofuz
parents:
diff changeset
558 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
anatofuz
parents:
diff changeset
559 // expected-note@-2 {{remove the call to '__builtin_fabsf' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
560 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
anatofuz
parents:
diff changeset
561 (void)__builtin_fabs(x);
anatofuz
parents:
diff changeset
562 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
anatofuz
parents:
diff changeset
563 // expected-note@-2 {{remove the call to '__builtin_fabs' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
564 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
anatofuz
parents:
diff changeset
565 (void)__builtin_fabsl(x);
anatofuz
parents:
diff changeset
566 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
anatofuz
parents:
diff changeset
567 // expected-note@-2 {{remove the call to '__builtin_fabsl' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
568 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
anatofuz
parents:
diff changeset
569
anatofuz
parents:
diff changeset
570 (void)__builtin_cabsf(x);
anatofuz
parents:
diff changeset
571 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
anatofuz
parents:
diff changeset
572 // expected-note@-2 {{remove the call to '__builtin_cabsf' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
573 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
anatofuz
parents:
diff changeset
574 (void)__builtin_cabs(x);
anatofuz
parents:
diff changeset
575 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
anatofuz
parents:
diff changeset
576 // expected-note@-2 {{remove the call to '__builtin_cabs' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
577 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
anatofuz
parents:
diff changeset
578 (void)__builtin_cabsl(x);
anatofuz
parents:
diff changeset
579 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned int' has no effect}}
anatofuz
parents:
diff changeset
580 // expected-note@-2 {{remove the call to '__builtin_cabsl' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
581 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
anatofuz
parents:
diff changeset
582 }
anatofuz
parents:
diff changeset
583
anatofuz
parents:
diff changeset
584 void test_unsigned_long(unsigned long x) {
anatofuz
parents:
diff changeset
585 (void)std::abs(x);
anatofuz
parents:
diff changeset
586 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
anatofuz
parents:
diff changeset
587 // expected-note@-2 {{remove the call to 'std::abs' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
588 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:17}:""
anatofuz
parents:
diff changeset
589
anatofuz
parents:
diff changeset
590 (void)abs(x);
anatofuz
parents:
diff changeset
591 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
anatofuz
parents:
diff changeset
592 // expected-note@-2 {{remove the call to 'abs' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
593 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:12}:""
anatofuz
parents:
diff changeset
594 (void)labs(x);
anatofuz
parents:
diff changeset
595 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
anatofuz
parents:
diff changeset
596 // expected-note@-2 {{remove the call to 'labs' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
597 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
anatofuz
parents:
diff changeset
598 (void)llabs(x);
anatofuz
parents:
diff changeset
599 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
anatofuz
parents:
diff changeset
600 // expected-note@-2 {{remove the call to 'llabs' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
601 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
anatofuz
parents:
diff changeset
602
anatofuz
parents:
diff changeset
603 (void)fabsf(x);
anatofuz
parents:
diff changeset
604 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
anatofuz
parents:
diff changeset
605 // expected-note@-2 {{remove the call to 'fabsf' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
606 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
anatofuz
parents:
diff changeset
607 (void)fabs(x);
anatofuz
parents:
diff changeset
608 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
anatofuz
parents:
diff changeset
609 // expected-note@-2 {{remove the call to 'fabs' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
610 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
anatofuz
parents:
diff changeset
611 (void)fabsl(x);
anatofuz
parents:
diff changeset
612 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
anatofuz
parents:
diff changeset
613 // expected-note@-2 {{remove the call to 'fabsl' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
614 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
anatofuz
parents:
diff changeset
615
anatofuz
parents:
diff changeset
616 (void)cabsf(x);
anatofuz
parents:
diff changeset
617 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
anatofuz
parents:
diff changeset
618 // expected-note@-2 {{remove the call to 'cabsf' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
619 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
anatofuz
parents:
diff changeset
620 (void)cabs(x);
anatofuz
parents:
diff changeset
621 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
anatofuz
parents:
diff changeset
622 // expected-note@-2 {{remove the call to 'cabs' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
623 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:13}:""
anatofuz
parents:
diff changeset
624 (void)cabsl(x);
anatofuz
parents:
diff changeset
625 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
anatofuz
parents:
diff changeset
626 // expected-note@-2 {{remove the call to 'cabsl' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
627 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:14}:""
anatofuz
parents:
diff changeset
628
anatofuz
parents:
diff changeset
629 (void)__builtin_abs(x);
anatofuz
parents:
diff changeset
630 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
anatofuz
parents:
diff changeset
631 // expected-note@-2 {{remove the call to '__builtin_abs' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
632 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:22}:""
anatofuz
parents:
diff changeset
633 (void)__builtin_labs(x);
anatofuz
parents:
diff changeset
634 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
anatofuz
parents:
diff changeset
635 // expected-note@-2 {{remove the call to '__builtin_labs' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
636 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
anatofuz
parents:
diff changeset
637 (void)__builtin_llabs(x);
anatofuz
parents:
diff changeset
638 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
anatofuz
parents:
diff changeset
639 // expected-note@-2 {{remove the call to '__builtin_llabs' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
640 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
anatofuz
parents:
diff changeset
641
anatofuz
parents:
diff changeset
642 (void)__builtin_fabsf(x);
anatofuz
parents:
diff changeset
643 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
anatofuz
parents:
diff changeset
644 // expected-note@-2 {{remove the call to '__builtin_fabsf' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
645 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
anatofuz
parents:
diff changeset
646 (void)__builtin_fabs(x);
anatofuz
parents:
diff changeset
647 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
anatofuz
parents:
diff changeset
648 // expected-note@-2 {{remove the call to '__builtin_fabs' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
649 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
anatofuz
parents:
diff changeset
650 (void)__builtin_fabsl(x);
anatofuz
parents:
diff changeset
651 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
anatofuz
parents:
diff changeset
652 // expected-note@-2 {{remove the call to '__builtin_fabsl' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
653 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
anatofuz
parents:
diff changeset
654
anatofuz
parents:
diff changeset
655 (void)__builtin_cabsf(x);
anatofuz
parents:
diff changeset
656 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
anatofuz
parents:
diff changeset
657 // expected-note@-2 {{remove the call to '__builtin_cabsf' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
658 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
anatofuz
parents:
diff changeset
659 (void)__builtin_cabs(x);
anatofuz
parents:
diff changeset
660 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
anatofuz
parents:
diff changeset
661 // expected-note@-2 {{remove the call to '__builtin_cabs' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
662 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:23}:""
anatofuz
parents:
diff changeset
663 (void)__builtin_cabsl(x);
anatofuz
parents:
diff changeset
664 // expected-warning@-1 {{taking the absolute value of unsigned type 'unsigned long' has no effect}}
anatofuz
parents:
diff changeset
665 // expected-note@-2 {{remove the call to '__builtin_cabsl' since unsigned values cannot be negative}}
anatofuz
parents:
diff changeset
666 // CHECK: fix-it:"{{.*}}":{[[@LINE-3]]:9-[[@LINE-3]]:24}:""
anatofuz
parents:
diff changeset
667 }
anatofuz
parents:
diff changeset
668