mirror of
https://sourceware.org/git/glibc.git
synced 2025-08-01 10:06:57 +03:00
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.
This commit is contained in:
@ -51,6 +51,17 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* 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. */
|
||||
#ifdef __KERNEL__
|
||||
# define _FP_ZERO_INIT = 0
|
||||
#else
|
||||
# define _FP_ZERO_INIT
|
||||
#endif
|
||||
|
||||
#define _FP_WORKBITS 3
|
||||
#define _FP_WORK_LSB ((_FP_W_TYPE) 1 << 3)
|
||||
#define _FP_WORK_ROUND ((_FP_W_TYPE) 1 << 2)
|
||||
|
Reference in New Issue
Block a user