diff mbox series

[29/39] math: Fix clang warnings for math/test-tgmath-ret.c

Message ID 20241222000509.2205895-30-hjl.tools@gmail.com
State New
Headers show
Series [01/39] conform: Use -dD instead of -dN on compiler invocation | expand

Commit Message

H.J. Lu Dec. 22, 2024, 12:04 a.m. UTC
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>

clang warns that since the global variables are only used to function
calls (without being actually used), there are not needed and will
not be emitted.
---
 math/test-tgmath-ret.c | 6 ++++++
 1 file changed, 6 insertions(+)

Comments

Sam James Dec. 22, 2024, 4:51 a.m. UTC | #1
"H.J. Lu" <hjl.tools@gmail.com> writes:

> From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
>
> clang warns that since the global variables are only used to function
> calls (without being actually used), there are not needed and will

they are not needed

> not be emitted.
> ---
>  math/test-tgmath-ret.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/math/test-tgmath-ret.c b/math/test-tgmath-ret.c
> index 36dc132e4f..71f36d39fa 100644
> --- a/math/test-tgmath-ret.c
> +++ b/math/test-tgmath-ret.c
> @@ -21,13 +21,19 @@
>  #include <tgmath.h>
>  #include <stdint.h>
>  #include <stdio.h>
> +#include <libc-diag.h>
>  
> +/* clang warns the global variables are not needed and will not be emitted.
> +   However there are used on the CHECK_RET_* macros.  */

However they are

> +DIAG_PUSH_NEEDS_COMMENT_CLANG;
> +DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wunneeded-internal-declaration");
>  static float fx;
>  static double dx;
>  static long double lx;
>  static int rm = FP_INT_UPWARD;
>  static unsigned int width = 64;
>  static int errors = 0;
> +DIAG_POP_NEEDS_COMMENT_CLANG;
>  
>  static void
>  our_error (const char *c)

Reviewed-by: Sam James <sam@gentoo.org>
diff mbox series

Patch

diff --git a/math/test-tgmath-ret.c b/math/test-tgmath-ret.c
index 36dc132e4f..71f36d39fa 100644
--- a/math/test-tgmath-ret.c
+++ b/math/test-tgmath-ret.c
@@ -21,13 +21,19 @@ 
 #include <tgmath.h>
 #include <stdint.h>
 #include <stdio.h>
+#include <libc-diag.h>
 
+/* clang warns the global variables are not needed and will not be emitted.
+   However there are used on the CHECK_RET_* macros.  */
+DIAG_PUSH_NEEDS_COMMENT_CLANG;
+DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wunneeded-internal-declaration");
 static float fx;
 static double dx;
 static long double lx;
 static int rm = FP_INT_UPWARD;
 static unsigned int width = 64;
 static int errors = 0;
+DIAG_POP_NEEDS_COMMENT_CLANG;
 
 static void
 our_error (const char *c)