summary refs log tree commit diff
path: root/soft-fp/op-common.h
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2015-03-07 01:39:42 +0000
committerJoseph Myers <joseph@codesourcery.com>2015-03-07 01:39:42 +0000
commitb838844bc5028b2b3401af9f0f51687d8a1f8a54 (patch)
treebd3df50946aab64591337ea1852a3a39ca36dbd8 /soft-fp/op-common.h
parente0ed2fb40a0e29c43cf60addc74741dab15f2e05 (diff)
downloadglibc-b838844bc5028b2b3401af9f0f51687d8a1f8a54.tar.gz
glibc-b838844bc5028b2b3401af9f0f51687d8a1f8a54.tar.xz
glibc-b838844bc5028b2b3401af9f0f51687d8a1f8a54.zip
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.
Diffstat (limited to 'soft-fp/op-common.h')
-rw-r--r--soft-fp/op-common.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/soft-fp/op-common.h b/soft-fp/op-common.h
index 14fd6cdc96..ee4147602f 100644
--- a/soft-fp/op-common.h
+++ b/soft-fp/op-common.h
@@ -29,10 +29,10 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#define _FP_DECL(wc, X)				\
-  _FP_I_TYPE X##_c __attribute__ ((unused));	\
-  _FP_I_TYPE X##_s __attribute__ ((unused));	\
-  _FP_I_TYPE X##_e __attribute__ ((unused));	\
+#define _FP_DECL(wc, X)						\
+  _FP_I_TYPE X##_c __attribute__ ((unused)) _FP_ZERO_INIT;	\
+  _FP_I_TYPE X##_s __attribute__ ((unused)) _FP_ZERO_INIT;	\
+  _FP_I_TYPE X##_e __attribute__ ((unused)) _FP_ZERO_INIT;	\
   _FP_FRAC_DECL_##wc (X)
 
 /* Test whether the qNaN bit denotes a signaling NaN.  */