about summary refs log tree commit diff
path: root/sysdeps/arm
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2018-02-01 21:01:00 +0000
committerJoseph Myers <joseph@codesourcery.com>2018-02-01 21:01:00 +0000
commit6f9a3dd8b831f92d9d9a53d99101a7fe7f755f44 (patch)
tree2c2cedff89149294453a1a802884d63948e643b7 /sysdeps/arm
parenteb65a3d545f9820853b454ce342385799dd479e9 (diff)
downloadglibc-6f9a3dd8b831f92d9d9a53d99101a7fe7f755f44.tar.gz
glibc-6f9a3dd8b831f92d9d9a53d99101a7fe7f755f44.tar.xz
glibc-6f9a3dd8b831f92d9d9a53d99101a7fe7f755f44.zip
Move LDBL_CLASSIFY_COMPAT to its own header.
The general rule in glibc is that it's better for a macro to be always
defined, and tested with #if, than for it to be tested with #ifdef,
because the latter is prone to typos in the macro name as well as to
the header with the macro accidentally not being included in a file
testing it.  (Testing with an "if" statement is even better, in those
cases where it's possible to do things that way, as it then means both
cases in the code get checked for syntax in glibc builds with either
value of the condition.)

math_private.h has several different groups of macros, meaning that
architectures wanting to override some of them need to define those
then include the generic version, which then defines macros if not
already defined.  It's hard to avoid that arrangement completely, but
various cases can be improved by splitting out macros or groups of
macros into separate files.

This patch splits out the LDBL_CLASSIFY_COMPAT macro into a separate
ldbl-classify-compat.h header.  This macro is tested with #ifdef; this
patch changes it to testing with #if, with a default definition to 0
in the generic header and then architecture-specific headers defining
it to 1.

Tested with build-many-glibcs.py that installed stripped shared
libraries are unchanged by the patch.

	* sysdeps/generic/ldbl-classify-compat.h: New file.
	* sysdeps/arm/ldbl-classify-compat.h: Likewise.
	* sysdeps/m68k/coldfire/ldbl-classify-compat.h: Likewise.
	* sysdeps/microblaze/ldbl-classify-compat.h: Likewise.
	* sysdeps/mips/ldbl-classify-compat.h: Likewise.
	* sysdeps/nios2/ldbl-classify-compat.h: Likewise.
	* sysdeps/sh/ldbl-classify-compat.h: Likewise.
	* sysdeps/ieee754/dbl-64/s_finite.c: Include
	<ldbl-classify-compat.h>.
	[LDBL_CLASSIFY_COMPAT]: Test value, not whether defined.
	* sysdeps/ieee754/dbl-64/s_isinf.c: Include
	<ldbl-classify-compat.h>.
	[LDBL_CLASSIFY_COMPAT]: Test value, not whether defined.
	* sysdeps/ieee754/dbl-64/s_isnan.c: Include
	<ldbl-classify-compat.h>.
	[LDBL_CLASSIFY_COMPAT]: Test value, not whether defined.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c: Include
	<ldbl-classify-compat.h>.
	[LDBL_CLASSIFY_COMPAT]: Test value, not whether defined.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c: Include
	<ldbl-classify-compat.h>.
	[LDBL_CLASSIFY_COMPAT]: Test value, not whether defined.
	* sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c: Include
	<ldbl-classify-compat.h>.
	[LDBL_CLASSIFY_COMPAT]: Test value, not whether defined.
	* sysdeps/arm/math_private.h (LDBL_CLASSIFY_COMPAT): Remove macro.
	* sysdeps/mips/math_private.h (LDBL_CLASSIFY_COMPAT): Likewise.
	* sysdeps/m68k/coldfire/math_private.h: Remove file.
	* sysdeps/microblaze/math_private.h: Likewise.
	* sysdeps/nios2/math_private.h: Likewise.
	* sysdeps/sh/math_private.h: Likewise.
Diffstat (limited to 'sysdeps/arm')
-rw-r--r--sysdeps/arm/ldbl-classify-compat.h8
-rw-r--r--sysdeps/arm/math_private.h4
2 files changed, 8 insertions, 4 deletions
diff --git a/sysdeps/arm/ldbl-classify-compat.h b/sysdeps/arm/ldbl-classify-compat.h
new file mode 100644
index 0000000000..f3f10607ca
--- /dev/null
+++ b/sysdeps/arm/ldbl-classify-compat.h
@@ -0,0 +1,8 @@
+#ifndef ARM_LDBL_CLASSIFY_COMPAT_H
+#define ARM_LDBL_CLASSIFY_COMPAT_H 1
+
+/* Enable __finitel, __isinfl, and __isnanl for binary compatibility
+   when built without long double support. */
+#define LDBL_CLASSIFY_COMPAT 1
+
+#endif
diff --git a/sysdeps/arm/math_private.h b/sysdeps/arm/math_private.h
index d39e9ee24a..c175b15601 100644
--- a/sysdeps/arm/math_private.h
+++ b/sysdeps/arm/math_private.h
@@ -1,10 +1,6 @@
 #ifndef ARM_MATH_PRIVATE_H
 #define ARM_MATH_PRIVATE_H 1
 
-/* Enable __finitel, __isinfl, and __isnanl for binary compatibility
-   when built without long double support. */
-#define LDBL_CLASSIFY_COMPAT 1
-
 #include "fenv_private.h"
 #include_next <math_private.h>