warn-absolute-value.c 46 KB

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