From b838844bc5028b2b3401af9f0f51687d8a1f8a54 Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Sat, 7 Mar 2015 01:39:42 +0000 Subject: soft-fp: Support conditional zero-initialization in declarations. In the Linux kernel, some architectures have a single function that uses different kinds of unpacking and packing depending on the instruction being emulated, meaning it is not readily visible to the compiler that variables from _FP_DECL and _FP_FRAC_DECL_* macros are only used in cases where they were initialized. The existing copy of soft-fp in the Linux kernel uses zero-initialization to avoid warnings in this case, so while frowned upon as a warning suppression mechanism in code built for glibc it seems appropriate to have such zero-initialization conditional on __KERNEL__. This patch duly adds it, via a macro _FP_ZERO_INIT that expands to empty for non-kernel compilations. Tested for powerpc-nofpu that installed stripped shared libraries are unchanged by this patch. * soft-fp/soft-fp.h (_FP_ZERO_INIT): New macro. Define depending on [__KERNEL__]. * soft-fp/op-1.h (_FP_FRAC_DECL_1): Use _FP_ZERO_INIT. * soft-fp/op-2.h (_FP_FRAC_DECL_2): Likewise. * soft-fp/op-common.h (_FP_DECL): Likewise. --- soft-fp/op-2.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'soft-fp/op-2.h') diff --git a/soft-fp/op-2.h b/soft-fp/op-2.h index 94a1c71542..26bdfc093d 100644 --- a/soft-fp/op-2.h +++ b/soft-fp/op-2.h @@ -30,7 +30,8 @@ License along with the GNU C Library; if not, see . */ -#define _FP_FRAC_DECL_2(X) _FP_W_TYPE X##_f0, X##_f1 +#define _FP_FRAC_DECL_2(X) \ + _FP_W_TYPE X##_f0 _FP_ZERO_INIT, X##_f1 _FP_ZERO_INIT #define _FP_FRAC_COPY_2(D, S) (D##_f0 = S##_f0, D##_f1 = S##_f1) #define _FP_FRAC_SET_2(X, I) __FP_FRAC_SET_2 (X, I) #define _FP_FRAC_HIGH_2(X) (X##_f1) -- cgit 1.4.1