This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Don't use -Wno-uninitialized in math/


Joseph Myers <joseph@codesourcery.com> writes:

> Does putting the DIAG_* macros (with appropriate comments) in the relevant 
> inline functions (possibly libc_feresetround_aarch64_ctx or 
> libc_feresetround_noex_aarch64_ctx) help?

This works:

	* sysdeps/aarch64/fpu/math_private.h
	(libc_feresetround_aarch64_ctx): Suppress maybe-uninitialized
	warning.
---
 sysdeps/aarch64/fpu/math_private.h | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/sysdeps/aarch64/fpu/math_private.h b/sysdeps/aarch64/fpu/math_private.h
index 1f02ddb..28c4497 100644
--- a/sysdeps/aarch64/fpu/math_private.h
+++ b/sysdeps/aarch64/fpu/math_private.h
@@ -21,6 +21,7 @@
 
 #include <fenv.h>
 #include <fpu_control.h>
+#include <libc-internal.h>
 
 #define math_opt_barrier(x) \
 ({ __typeof (x) __x = (x); __asm ("" : "+w" (__x)); __x; })
@@ -274,7 +275,15 @@ libc_feresetround_aarch64_ctx (struct rm_ctx *ctx)
 {
   /* Restore the rounding mode if updated.  */
   if (__glibc_unlikely (ctx->updated_status))
-    _FPU_SETCW (ctx->env.__fpcr);
+    {
+      /* The initialisation of ctx->env.__fpcr in
+	 libc_feholdsetround_aarch64_ctx is guarded by the same condition,
+	 but GCC doesn't see that.  */
+      DIAG_PUSH_NEEDS_COMMENT;
+      DIAG_IGNORE_NEEDS_COMMENT (5, "-Wmaybe-uninitialized");
+      _FPU_SETCW (ctx->env.__fpcr);
+      DIAG_POP_NEEDS_COMMENT;
+    }
 }
 
 #define libc_feresetround_ctx		libc_feresetround_aarch64_ctx
-- 
2.5.0


Andreas.

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]