about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-03-24 11:08:44 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-04-17 16:12:40 -0300
commit9193695399a8e6cf79a9825a7ef480f21e080583 (patch)
tree33a2d76f9106f297f68c05a70c2805d35341eb30
parent3a249b4037899e00cde197ed76b267df31be06c9 (diff)
downloadglibc-9193695399a8e6cf79a9825a7ef480f21e080583.tar.gz
glibc-9193695399a8e6cf79a9825a7ef480f21e080583.tar.xz
glibc-9193695399a8e6cf79a9825a7ef480f21e080583.zip
math: Fix clang warnings on bug-tgmath1.c
The type generic fabs expansion issues the floating point absolute with
the wrong argument type (for instance cabs with floating point or fabs
with a complex type) and clang warns that implicit conversion might
incur in unexpected behavior.
-rw-r--r--math/bug-tgmath1.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/math/bug-tgmath1.c b/math/bug-tgmath1.c
index 16db9d17a1..1c97df0a40 100644
--- a/math/bug-tgmath1.c
+++ b/math/bug-tgmath1.c
@@ -1,5 +1,6 @@
 #include <stdio.h>
 #include <tgmath.h>
+#include <libc-diag.h>
 
 
 int
@@ -29,6 +30,12 @@ main (void)
   TEST (cimag (1.0f), sizeof (float));
   TEST (cimag (1.0f + 1.0fi), sizeof (float));
 
+  /* The type generic fabs expansion issues the floating point absolute with
+     the wrong argument type (for instance cabs with floating point or fabs
+     with a complex type) and clang warns that implicit conversion might
+     incur in unexpected behavior.  */
+  DIAG_PUSH_NEEDS_COMMENT_CLANG;
+  DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wabsolute-value");
   TEST (fabs (1.0), sizeof (double));
   TEST (fabs (1.0 + 1.0i), sizeof (double));
   TEST (fabs (1.0l), sizeof (long double));