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