aboutsummaryrefslogtreecommitdiff
path: root/sysdeps
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
parenteb65a3d545f9820853b454ce342385799dd479e9 (diff)
downloadglibc-6f9a3dd8b831f92d9d9a53d99101a7fe7f755f44.zip
glibc-6f9a3dd8b831f92d9d9a53d99101a7fe7f755f44.tar.gz
glibc-6f9a3dd8b831f92d9d9a53d99101a7fe7f755f44.tar.bz2
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')
-rw-r--r--sysdeps/arm/ldbl-classify-compat.h (renamed from sysdeps/sh/math_private.h)6
-rw-r--r--sysdeps/arm/math_private.h4
-rw-r--r--sysdeps/generic/ldbl-classify-compat.h33
-rw-r--r--sysdeps/ieee754/dbl-64/s_finite.c3
-rw-r--r--sysdeps/ieee754/dbl-64/s_isinf.c3
-rw-r--r--sysdeps/ieee754/dbl-64/s_isnan.c3
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c3
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c3
-rw-r--r--sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c3
-rw-r--r--sysdeps/m68k/coldfire/ldbl-classify-compat.h (renamed from sysdeps/nios2/math_private.h)6
-rw-r--r--sysdeps/microblaze/ldbl-classify-compat.h (renamed from sysdeps/m68k/coldfire/math_private.h)6
-rw-r--r--sysdeps/mips/ldbl-classify-compat.h (renamed from sysdeps/microblaze/math_private.h)6
-rw-r--r--sysdeps/mips/math_private.h4
-rw-r--r--sysdeps/nios2/ldbl-classify-compat.h8
-rw-r--r--sysdeps/sh/ldbl-classify-compat.h8
15 files changed, 69 insertions, 30 deletions
diff --git a/sysdeps/sh/math_private.h b/sysdeps/arm/ldbl-classify-compat.h
index d13f2d4..f3f1060 100644
--- a/sysdeps/sh/math_private.h
+++ b/sysdeps/arm/ldbl-classify-compat.h
@@ -1,10 +1,8 @@
-#ifndef SH_MATH_PRIVATE_H
-#define SH_MATH_PRIVATE_H 1
+#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
-#include_next <math_private.h>
-
#endif
diff --git a/sysdeps/arm/math_private.h b/sysdeps/arm/math_private.h
index d39e9ee..c175b15 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>
diff --git a/sysdeps/generic/ldbl-classify-compat.h b/sysdeps/generic/ldbl-classify-compat.h
new file mode 100644
index 0000000..d77ca18
--- /dev/null
+++ b/sysdeps/generic/ldbl-classify-compat.h
@@ -0,0 +1,33 @@
+/* Specify whether there should be compat symbol aliases for some
+ classification functions. Generic version.
+ Copyright (C) 2015-2018 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef _LDBL_CLASSIFY_COMPAT_H
+#define _LDBL_CLASSIFY_COMPAT_H 1
+
+/* If defined to 1, enable __finitel, __isinfl, and __isnanl function
+ aliases for binary compatibility when built without long double
+ support. If defined to 0, or if long double does not have the same
+ format as double, there are no such aliases. New ports should use
+ the default definition of this as 0, as such
+ implementation-namespace functions should only have one exported
+ name per floating-point format, not one per floating-point
+ type. */
+#define LDBL_CLASSIFY_COMPAT 0
+
+#endif /* ldbl-classify-compat.h */
diff --git a/sysdeps/ieee754/dbl-64/s_finite.c b/sysdeps/ieee754/dbl-64/s_finite.c
index eed80c6..da1519b 100644
--- a/sysdeps/ieee754/dbl-64/s_finite.c
+++ b/sysdeps/ieee754/dbl-64/s_finite.c
@@ -21,6 +21,7 @@ static char rcsid[] = "$NetBSD: s_finite.c,v 1.8 1995/05/10 20:47:17 jtc Exp $";
#include <math.h>
#include <math_private.h>
+#include <ldbl-classify-compat.h>
#include <shlib-compat.h>
#undef __finite
@@ -38,7 +39,7 @@ int FINITE(double x)
hidden_def (__finite)
weak_alias (__finite, finite)
#ifdef NO_LONG_DOUBLE
-# ifdef LDBL_CLASSIFY_COMPAT
+# if LDBL_CLASSIFY_COMPAT
# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
compat_symbol (libc, __finite, __finitel, GLIBC_2_0);
# endif
diff --git a/sysdeps/ieee754/dbl-64/s_isinf.c b/sysdeps/ieee754/dbl-64/s_isinf.c
index c0ad545..93eb65c 100644
--- a/sysdeps/ieee754/dbl-64/s_isinf.c
+++ b/sysdeps/ieee754/dbl-64/s_isinf.c
@@ -15,6 +15,7 @@ static char rcsid[] = "$NetBSD: s_isinf.c,v 1.3 1995/05/11 23:20:14 jtc Exp $";
#include <math.h>
#include <math_private.h>
+#include <ldbl-classify-compat.h>
#include <shlib-compat.h>
int
@@ -29,7 +30,7 @@ __isinf (double x)
hidden_def (__isinf)
weak_alias (__isinf, isinf)
#ifdef NO_LONG_DOUBLE
-# if defined LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
+# if LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0);
# endif
weak_alias (__isinf, isinfl)
diff --git a/sysdeps/ieee754/dbl-64/s_isnan.c b/sysdeps/ieee754/dbl-64/s_isnan.c
index 642ec3a..82723ee 100644
--- a/sysdeps/ieee754/dbl-64/s_isnan.c
+++ b/sysdeps/ieee754/dbl-64/s_isnan.c
@@ -21,6 +21,7 @@ static char rcsid[] = "$NetBSD: s_isnan.c,v 1.8 1995/05/10 20:47:36 jtc Exp $";
#include <math.h>
#include <math_private.h>
+#include <ldbl-classify-compat.h>
#include <shlib-compat.h>
#undef __isnan
@@ -37,7 +38,7 @@ __isnan (double x)
hidden_def (__isnan)
weak_alias (__isnan, isnan)
#ifdef NO_LONG_DOUBLE
-# if defined LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
+# if LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
# endif
weak_alias (__isnan, isnanl)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c
index ef51608..4067692 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_finite.c
@@ -16,6 +16,7 @@
#include <math.h>
#include <math_private.h>
+#include <ldbl-classify-compat.h>
#include <shlib-compat.h>
#include <stdint.h>
@@ -30,7 +31,7 @@ __finite(double x)
hidden_def (__finite)
weak_alias (__finite, finite)
#ifdef NO_LONG_DOUBLE
-# ifdef LDBL_CLASSIFY_COMPAT
+# if LDBL_CLASSIFY_COMPAT
# if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
compat_symbol (libc, __finite, __finitel, GLIBC_2_0);
# endif
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c
index 951fb73..2b427a8 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_isinf.c
@@ -11,6 +11,7 @@
#include <math.h>
#include <math_private.h>
+#include <ldbl-classify-compat.h>
#include <shlib-compat.h>
int
@@ -26,7 +27,7 @@ __isinf (double x)
hidden_def (__isinf)
weak_alias (__isinf, isinf)
#ifdef NO_LONG_DOUBLE
-# if defined LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
+# if LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
compat_symbol (libc, __isinf, __isinfl, GLIBC_2_0);
# endif
weak_alias (__isinf, isinfl)
diff --git a/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c b/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c
index bcff9e3..cd805d1 100644
--- a/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c
+++ b/sysdeps/ieee754/dbl-64/wordsize-64/s_isnan.c
@@ -17,6 +17,7 @@
#include <math.h>
#include <math_private.h>
+#include <ldbl-classify-compat.h>
#include <shlib-compat.h>
#include <stdint.h>
@@ -32,7 +33,7 @@ int __isnan(double x)
hidden_def (__isnan)
weak_alias (__isnan, isnan)
#ifdef NO_LONG_DOUBLE
-# if defined LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
+# if LDBL_CLASSIFY_COMPAT && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_23)
compat_symbol (libc, __isnan, __isnanl, GLIBC_2_0);
# endif
weak_alias (__isnan, isnanl)
diff --git a/sysdeps/nios2/math_private.h b/sysdeps/m68k/coldfire/ldbl-classify-compat.h
index bc7f9c8..c1ec4d4 100644
--- a/sysdeps/nios2/math_private.h
+++ b/sysdeps/m68k/coldfire/ldbl-classify-compat.h
@@ -1,10 +1,8 @@
-#ifndef NIO2_MATH_PRIVATE_H
-#define NIO2_MATH_PRIVATE_H 1
+#ifndef COLDFIRE_LDBL_CLASSIFY_COMPAT_H
+#define COLDFIRE_LDBL_CLASSIFY_COMPAT_H 1
/* Enable __finitel, __isinfl, and __isnanl for binary compatibility
when built without long double support. */
#define LDBL_CLASSIFY_COMPAT 1
-#include_next <math_private.h>
-
#endif
diff --git a/sysdeps/m68k/coldfire/math_private.h b/sysdeps/microblaze/ldbl-classify-compat.h
index d306a50..38c5c99 100644
--- a/sysdeps/m68k/coldfire/math_private.h
+++ b/sysdeps/microblaze/ldbl-classify-compat.h
@@ -1,10 +1,8 @@
-#ifndef COLDFIRE_MATH_PRIVATE_H
-#define COLDFIRE_MATH_PRIVATE_H 1
+#ifndef MICROBLAZE_LDBL_CLASSIFY_COMPAT_H
+#define MICROBLAZE_LDBL_CLASSIFY_COMPAT_H 1
/* Enable __finitel, __isinfl, and __isnanl for binary compatibility
when built without long double support. */
#define LDBL_CLASSIFY_COMPAT 1
-#include_next <math_private.h>
-
#endif
diff --git a/sysdeps/microblaze/math_private.h b/sysdeps/mips/ldbl-classify-compat.h
index 64dc181..547ac7b 100644
--- a/sysdeps/microblaze/math_private.h
+++ b/sysdeps/mips/ldbl-classify-compat.h
@@ -1,10 +1,8 @@
-#ifndef MICROBLAZE_MATH_PRIVATE_H
-#define MICROBLAZE_MATH_PRIVATE_H 1
+#ifndef MIPS_LDBL_CLASSIFY_COMPAT_H
+#define MIPS_LDBL_CLASSIFY_COMPAT_H 1
/* Enable __finitel, __isinfl, and __isnanl for binary compatibility
when built without long double support. */
#define LDBL_CLASSIFY_COMPAT 1
-#include_next <math_private.h>
-
#endif
diff --git a/sysdeps/mips/math_private.h b/sysdeps/mips/math_private.h
index a3c2513..01ae8b1 100644
--- a/sysdeps/mips/math_private.h
+++ b/sysdeps/mips/math_private.h
@@ -240,10 +240,6 @@ libc_feholdsetround_mips_ctx (struct rm_ctx *ctx, int round)
#endif
-/* Enable __finitel, __isinfl, and __isnanl for binary compatibility
- when built without long double support. */
-#define LDBL_CLASSIFY_COMPAT 1
-
#include_next <math_private.h>
#endif
diff --git a/sysdeps/nios2/ldbl-classify-compat.h b/sysdeps/nios2/ldbl-classify-compat.h
new file mode 100644
index 0000000..a9614de
--- /dev/null
+++ b/sysdeps/nios2/ldbl-classify-compat.h
@@ -0,0 +1,8 @@
+#ifndef NIOS2_LDBL_CLASSIFY_COMPAT_H
+#define NIOS2_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/sh/ldbl-classify-compat.h b/sysdeps/sh/ldbl-classify-compat.h
new file mode 100644
index 0000000..d3b978c
--- /dev/null
+++ b/sysdeps/sh/ldbl-classify-compat.h
@@ -0,0 +1,8 @@
+#ifndef SH_LDBL_CLASSIFY_COMPAT_H
+#define SH_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