public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* Refactor long double information into bits/long-double.h
@ 2016-11-24  2:15 Joseph Myers
  2016-11-28 18:10 ` Ping " Joseph Myers
  2016-12-01 22:53 ` Joseph Myers
  0 siblings, 2 replies; 5+ messages in thread
From: Joseph Myers @ 2016-11-24  2:15 UTC (permalink / raw)
  To: libc-alpha

I would like review of this patch.

Information about whether the ABI of long double is the same as that
of double is split between bits/mathdef.h and bits/wordsize.h.

When the ABIs are the same, bits/mathdef.h defines
__NO_LONG_DOUBLE_MATH.  In addition, in the case where the same glibc
binary supports both -mlong-double-64 and -mlong-double-128,
bits/wordsize.h defines __LONG_DOUBLE_MATH_OPTIONAL, along with
__NO_LONG_DOUBLE_MATH if this particular compilation is with
-mlong-double-64.

As part of the refactoring I proposed in
<https://sourceware.org/ml/libc-alpha/2016-11/msg00745.html>, this
patch puts all that information in a single header,
bits/long-double.h.  It is included from sys/cdefs.h alongside the
include of bits/wordsize.h, so other headers generally do not need to
include bits/long-double.h directly.

Previously, six bits/mathdef.h headers and five bits/wordsize.h
headers had this long double information.  After the patch, it's all
in six bits/long-double.h headers.  Furthermore, most of those new
headers are not architecture-specific.  Architectures with optional
long double all use the ldbl-opt sysdeps directory, either in the
order (ldbl-64-128, ldbl-opt, ldbl-128) or (ldbl-128ibm, ldbl-opt).
Thus a generic header for the case where long double = double, and
headers in ldbl-128, ldbl-96 and ldbl-opt, suffices to cover every
architecture except for cases where long double properties vary
between different ABIs sharing a set of installed headers; fortunately
all the ldbl-opt cases share a single compiler-predefined macro
__LONG_DOUBLE_128__ that can be used to tell whether this compilation
is -mlong-double-64 or -mlong-double-128.

The two cases where a set of headers is shared between ABIs with
different long double properties, MIPS (o32 has long double = double,
other ABIs use ldbl-128) and SPARC (32-bit has optional long double,
64-bit has required long double), need their own bits/long-double.h
headers.

As with bits/wordsize.h, multiple-include protection for this header
is generally implicit through the include guards on sys/cdefs.h, and
multiple inclusion is harmless in any case.  There is one subtlety:
the header must not define __LONG_DOUBLE_MATH_OPTIONAL if
__NO_LONG_DOUBLE_MATH was defined before its inclusion, because doing
so breaks how sysdeps/ieee754/ldbl-opt/nldbl-compat.h defines
__NO_LONG_DOUBLE_MATH itself before including system headers.  Subject
to keeping that working, it would be reasonable to move these macros
from defined/undefined #ifdef to always-defined 1/0 #if semantics, but
this patch does not attempt to do so, just rearranges where the macros
are defined.

I had thought this patch would allow eliminating the inclusion of
bits/mathdef.h from complex.h, but that is not quite the case, because
of the code in sysdeps/alpha/bits/mathdef.h specific to inclusion from
complex.h; something would need doing about that ABI compatibility
code to eliminate that inclusion, or to eliminate bits/mathdef.h
completely.

Tested for x86_64 and x86.  Also did compilation-only testing with
build-many-glibcs.py.

2016-11-24  Joseph Myers  <joseph@codesourcery.com>

	* bits/long-double.h: New file.
	* sysdeps/ieee754/ldbl-128/bits/long-double.h: Likewise.
	* sysdeps/ieee754/ldbl-96/bits/long-double.h: Likewise.
	* sysdeps/ieee754/ldbl-opt/bits/long-double.h: Likewise.
	* sysdeps/mips/bits/long-double.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/long-double.h: Likewise.
	* math/Makefile (headers): Add bits/long-double.h.
	* misc/sys/cdefs.h: Include <bits/long-double.h>.
	* stdlib/strtold.c: Include <bits/long-double.h> instead of
	<bits/wordsize.h>.
	* bits/mathdef.h [!__NO_LONG_DOUBLE_MATH]: Remove conditional
	code.
	* sysdeps/arm/bits/mathdef.h [!__NO_LONG_DOUBLE_MATH]: Remove
	conditional code.
	* sysdeps/hppa/fpu/bits/mathdef.h [!__NO_LONG_DOUBLE_MATH]:
	Likewise.
	* sysdeps/mips/bits/mathdef.h: Do not include <sgidefs.h>.
	[!__NO_LONG_DOUBLE_MATH && _MIPS_SIM == _ABIO32]: Remove
	conditional code.
	* sysdeps/s390/s390-32/bits/wordsize.h
	[!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]:
	Likewise.
	* sysdeps/s390/s390-64/bits/wordsize.h
	[!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]:
	Likewise.
	* sysdeps/sh/sh4/bits/mathdef.h [!__NO_LONG_DOUBLE_MATH]:
	Likewise.
	* sysdeps/tile/bits/mathdef.h [!__NO_LONG_DOUBLE_MATH]: Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/wordsize.h
	[!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
	[!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]:
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/wordsize.h
	[!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]:
	Likewise.

diff --git a/bits/long-double.h b/bits/long-double.h
new file mode 100644
index 0000000..2e3c7fd
--- /dev/null
+++ b/bits/long-double.h
@@ -0,0 +1,39 @@
+/* Properties of long double type.
+   Copyright (C) 2016 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  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/>.  */
+
+/* This header is included by <sys/cdefs.h>.
+
+   If long double is ABI-compatible with double, it should define
+   __NO_LONG_DOUBLE_MATH to 1; otherwise, it should leave
+   __NO_LONG_DOUBLE_MATH undefined.
+
+   If this build of the GNU C Library supports both long double
+   ABI-compatible with double and some other long double format not
+   ABI-compatible with double, it should define
+   __LONG_DOUBLE_MATH_OPTIONAL to 1; otherwise, it should leave
+   __LONG_DOUBLE_MATH_OPTIONAL undefined.
+
+   If  is already defined, this header must not define
+   anything; this is needed to work with the definition of
+   __NO_LONG_DOUBLE_MATH in nldbl-compat.h.  */
+
+/* In the default version of this header, long double is
+   ABI-compatible with double.  */
+#ifndef __NO_LONG_DOUBLE_MATH
+# define __NO_LONG_DOUBLE_MATH	1
+#endif
diff --git a/bits/mathdef.h b/bits/mathdef.h
index d557d08..9d19542 100644
--- a/bits/mathdef.h
+++ b/bits/mathdef.h
@@ -48,9 +48,3 @@ typedef double double_t;	/* `double' expressions are evaluated as
 #endif
 
 #endif	/* ISO C99 */
-
-#ifndef __NO_LONG_DOUBLE_MATH
-/* Signal that we do not really have a `long double'.  The disables the
-   declaration of all the `long double' function variants.  */
-# define __NO_LONG_DOUBLE_MATH	1
-#endif
diff --git a/math/Makefile b/math/Makefile
index e84f86a..3056ff3 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -27,7 +27,8 @@ headers		:= math.h bits/mathcalls.h bits/mathinline.h bits/huge_val.h \
 		   fpu_control.h complex.h bits/cmathcalls.h fenv.h \
 		   bits/fenv.h bits/fenvinline.h bits/mathdef.h tgmath.h \
 		   bits/math-finite.h bits/math-vector.h \
-		   bits/libm-simd-decl-stubs.h bits/iscanonical.h
+		   bits/libm-simd-decl-stubs.h bits/iscanonical.h \
+		   bits/long-double.h
 
 # FPU support code.
 aux		:= setfpucw fpu_control
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 9298dd6..e07f3fc 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -439,6 +439,7 @@
 #endif
 
 #include <bits/wordsize.h>
+#include <bits/long-double.h>
 
 #if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
 # define __LDBL_COMPAT 1
diff --git a/stdlib/strtold.c b/stdlib/strtold.c
index bb46f23..251663f 100644
--- a/stdlib/strtold.c
+++ b/stdlib/strtold.c
@@ -20,7 +20,7 @@
 /* The actual implementation for all floating point sizes is in strtod.c.
    These macros tell it to produce the `float' version, `strtof'.  */
 
-#include <bits/wordsize.h>
+#include <bits/long-double.h>
 
 #ifdef __LONG_DOUBLE_MATH_OPTIONAL
 # include <wchar.h>
diff --git a/sysdeps/arm/bits/mathdef.h b/sysdeps/arm/bits/mathdef.h
index ae0bcb7..1f4c428 100644
--- a/sysdeps/arm/bits/mathdef.h
+++ b/sysdeps/arm/bits/mathdef.h
@@ -47,9 +47,3 @@ typedef double double_t;	/* `double' expressions are evaluated as
 # endif
 
 #endif	/* ISO C99 */
-
-#ifndef __NO_LONG_DOUBLE_MATH
-/* Signal that we do not really have a `long double'.  This disables the
-   declaration of all the `long double' function variants.  */
-# define __NO_LONG_DOUBLE_MATH	1
-#endif
diff --git a/sysdeps/hppa/fpu/bits/mathdef.h b/sysdeps/hppa/fpu/bits/mathdef.h
index 99c9cff..4482c1f 100644
--- a/sysdeps/hppa/fpu/bits/mathdef.h
+++ b/sysdeps/hppa/fpu/bits/mathdef.h
@@ -33,11 +33,3 @@ typedef double double_t;	/* `double' expressions are evaluated as
 # define FP_ILOGBNAN	(2147483647)
 
 #endif	/* ISO C99 */
-
-#ifndef __NO_LONG_DOUBLE_MATH
-/* On hppa `long double' and `double' are 64-bits.  So, libm is built
-   with NO_LONG_DOUBLE defined.  The following define ensures the library
-   and headers are consistent.  This disables the declaration of all the
-   `long double' function variants.  */
-# define __NO_LONG_DOUBLE_MATH	1
-#endif
diff --git a/sysdeps/ieee754/ldbl-128/bits/long-double.h b/sysdeps/ieee754/ldbl-128/bits/long-double.h
new file mode 100644
index 0000000..3f10da8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128/bits/long-double.h
@@ -0,0 +1,20 @@
+/* Properties of long double type.  ldbl-128 version.
+   Copyright (C) 2016 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  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/>.  */
+
+/* long double is distinct from double, so there is nothing to
+   define here.  */
diff --git a/sysdeps/ieee754/ldbl-96/bits/long-double.h b/sysdeps/ieee754/ldbl-96/bits/long-double.h
new file mode 100644
index 0000000..180a7cf
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-96/bits/long-double.h
@@ -0,0 +1,20 @@
+/* Properties of long double type.  ldbl-96 version.
+   Copyright (C) 2016 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  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/>.  */
+
+/* long double is distinct from double, so there is nothing to
+   define here.  */
diff --git a/sysdeps/ieee754/ldbl-opt/bits/long-double.h b/sysdeps/ieee754/ldbl-opt/bits/long-double.h
new file mode 100644
index 0000000..dce98c3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/bits/long-double.h
@@ -0,0 +1,24 @@
+/* Properties of long double type.  ldbl-opt version.
+   Copyright (C) 2016 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  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 __NO_LONG_DOUBLE_MATH
+# define __LONG_DOUBLE_MATH_OPTIONAL	1
+# ifndef __LONG_DOUBLE_128__
+#  define __NO_LONG_DOUBLE_MATH		1
+# endif
+#endif
diff --git a/sysdeps/mips/bits/long-double.h b/sysdeps/mips/bits/long-double.h
new file mode 100644
index 0000000..b51fce8
--- /dev/null
+++ b/sysdeps/mips/bits/long-double.h
@@ -0,0 +1,23 @@
+/* Properties of long double type.  MIPS version.
+   Copyright (C) 2016 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  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/>.  */
+
+#include <sgidefs.h>
+
+#if !defined __NO_LONG_DOUBLE_MATH && _MIPS_SIM == _ABIO32
+# define __NO_LONG_DOUBLE_MATH	1
+#endif
diff --git a/sysdeps/mips/bits/mathdef.h b/sysdeps/mips/bits/mathdef.h
index 3a11627..030cd3d 100644
--- a/sysdeps/mips/bits/mathdef.h
+++ b/sysdeps/mips/bits/mathdef.h
@@ -19,8 +19,6 @@
 # error "Never use <bits/mathdef.h> directly; include <math.h> instead"
 #endif
 
-#include <sgidefs.h>
-
 #if defined  __USE_ISOC99 && defined _MATH_H && !defined _MATH_H_MATHDEF
 # define _MATH_H_MATHDEF	1
 
@@ -35,9 +33,3 @@ typedef double double_t;	/* `double' expressions are evaluated as
 # define FP_ILOGBNAN	2147483647
 
 #endif	/* ISO C99 */
-
-#if ! defined __NO_LONG_DOUBLE_MATH && _MIPS_SIM == _ABIO32
-/* Signal that we do not really have a `long double'.  This disables the
-   declaration of all the `long double' function variants.  */
-# define __NO_LONG_DOUBLE_MATH	1
-#endif
diff --git a/sysdeps/s390/s390-32/bits/wordsize.h b/sysdeps/s390/s390-32/bits/wordsize.h
index c7a5fbf..129e471 100644
--- a/sysdeps/s390/s390-32/bits/wordsize.h
+++ b/sysdeps/s390/s390-32/bits/wordsize.h
@@ -9,14 +9,3 @@
 #endif
 
 #define __WORDSIZE_TIME64_COMPAT32     0
-
-#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
-
-/* Signal that we didn't used to have a `long double'. The changes all
-   the `long double' function variants to be redirects to the double
-   functions.  */
-# define __LONG_DOUBLE_MATH_OPTIONAL   1
-# ifndef __LONG_DOUBLE_128__
-#  define __NO_LONG_DOUBLE_MATH        1
-# endif
-#endif
diff --git a/sysdeps/s390/s390-64/bits/wordsize.h b/sysdeps/s390/s390-64/bits/wordsize.h
index 31e0ec6..00e88b0 100644
--- a/sysdeps/s390/s390-64/bits/wordsize.h
+++ b/sysdeps/s390/s390-64/bits/wordsize.h
@@ -9,14 +9,3 @@
 #endif
 
 #define __WORDSIZE_TIME64_COMPAT32     0
-
-#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
-
-/* Signal that we didn't used to have a `long double'. The changes all
-   the `long double' function variants to be redirects to the double
-   functions.  */
-# define __LONG_DOUBLE_MATH_OPTIONAL   1
-# ifndef __LONG_DOUBLE_128__
-#  define __NO_LONG_DOUBLE_MATH        1
-# endif
-#endif
diff --git a/sysdeps/sh/sh4/bits/mathdef.h b/sysdeps/sh/sh4/bits/mathdef.h
index 21ce094..e5d2849 100644
--- a/sysdeps/sh/sh4/bits/mathdef.h
+++ b/sysdeps/sh/sh4/bits/mathdef.h
@@ -38,9 +38,3 @@ typedef double double_t;
 # define FP_ILOGBNAN	0x7fffffff
 
 #endif	/* ISO C99 */
-
-#ifndef __NO_LONG_DOUBLE_MATH
-/* Signal that we do not really have a `long double'.  The disables the
-   declaration of all the `long double' function variants.  */
-# define __NO_LONG_DOUBLE_MATH	1
-#endif
diff --git a/sysdeps/tile/bits/mathdef.h b/sysdeps/tile/bits/mathdef.h
index 2db81b4..0d43321 100644
--- a/sysdeps/tile/bits/mathdef.h
+++ b/sysdeps/tile/bits/mathdef.h
@@ -46,9 +46,3 @@ typedef double double_t;
 # endif
 
 #endif /* ISO C99 */
-
-#ifndef __NO_LONG_DOUBLE_MATH
-/* Signal that we do not really have a `long double'.  This disables the
-   declaration of all the `long double' function variants.  */
-# define __NO_LONG_DOUBLE_MATH	1
-#endif
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h b/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h
index f0961f6..2ef70a9 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h
@@ -17,14 +17,3 @@
 
 #define __WORDSIZE	64
 #define __WORDSIZE_TIME64_COMPAT32	0
-
-#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
-
-/* Signal that we didn't used to have a `long double'. The changes all
-   the `long double' function variants to be redirects to the double
-   functions.  */
-# define __LONG_DOUBLE_MATH_OPTIONAL	1
-# ifndef __LONG_DOUBLE_128__
-#  define __NO_LONG_DOUBLE_MATH		1
-# endif
-#endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h b/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
index 109f08c..04ca9de 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
@@ -9,14 +9,3 @@
 # define __WORDSIZE32_SIZE_ULONG	0
 # define __WORDSIZE32_PTRDIFF_LONG	0
 #endif
-
-#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
-
-/* Signal the glibc ABI didn't used to have a `long double'.
-   The changes all the `long double' function variants to be redirects
-   to the double functions.  */
-# define __LONG_DOUBLE_MATH_OPTIONAL   1
-# ifndef __LONG_DOUBLE_128__
-#  define __NO_LONG_DOUBLE_MATH        1
-# endif
-#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/long-double.h b/sysdeps/unix/sysv/linux/sparc/bits/long-double.h
new file mode 100644
index 0000000..20039ce
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/bits/long-double.h
@@ -0,0 +1,26 @@
+/* Properties of long double type.  SPARC version.
+   Copyright (C) 2016 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  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/>.  */
+
+#include <bits/wordsize.h>
+
+#if !defined __NO_LONG_DOUBLE_MATH && __WORDSIZE == 32
+# define __LONG_DOUBLE_MATH_OPTIONAL   1
+# ifndef __LONG_DOUBLE_128__
+#  define __NO_LONG_DOUBLE_MATH        1
+# endif
+#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h b/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h
index 121b4fe..7562875 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h
@@ -9,16 +9,3 @@
 # define __WORDSIZE32_PTRDIFF_LONG	0
 # define __WORDSIZE_TIME64_COMPAT32	0
 #endif
-
-#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
-
-# if __WORDSIZE == 32
-/* Signal that in 32bit ABI we didn't used to have a `long double'.
-   The changes all the `long double' function variants to be redirects
-   to the double functions.  */
-#  define __LONG_DOUBLE_MATH_OPTIONAL   1
-#  ifndef __LONG_DOUBLE_128__
-#   define __NO_LONG_DOUBLE_MATH        1
-#  endif
-# endif
-#endif

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Ping Re: Refactor long double information into bits/long-double.h
  2016-11-24  2:15 Refactor long double information into bits/long-double.h Joseph Myers
@ 2016-11-28 18:10 ` Joseph Myers
  2016-12-01 22:53 ` Joseph Myers
  1 sibling, 0 replies; 5+ messages in thread
From: Joseph Myers @ 2016-11-28 18:10 UTC (permalink / raw)
  To: libc-alpha

Ping.  This patch 
<https://sourceware.org/ml/libc-alpha/2016-11/msg00865.html> is pending 
review.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Refactor long double information into bits/long-double.h
  2016-11-24  2:15 Refactor long double information into bits/long-double.h Joseph Myers
  2016-11-28 18:10 ` Ping " Joseph Myers
@ 2016-12-01 22:53 ` Joseph Myers
  2016-12-07 22:30   ` Ping " Joseph Myers
  2016-12-14 18:29   ` Joseph Myers
  1 sibling, 2 replies; 5+ messages in thread
From: Joseph Myers @ 2016-12-01 22:53 UTC (permalink / raw)
  To: libc-alpha

This is a new version of 
<https://sourceware.org/ml/libc-alpha/2016-11/msg00865.html> updated for 
the other refactoring of bits/mathdef.h.  I would like review of this 
patch.


Refactor long double information into bits/long-double.h.

Information about whether the ABI of long double is the same as that
of double is split between bits/mathdef.h and bits/wordsize.h.

When the ABIs are the same, bits/mathdef.h defines
__NO_LONG_DOUBLE_MATH.  In addition, in the case where the same glibc
binary supports both -mlong-double-64 and -mlong-double-128,
bits/wordsize.h defines __LONG_DOUBLE_MATH_OPTIONAL, along with
__NO_LONG_DOUBLE_MATH if this particular compilation is with
-mlong-double-64.

As part of the refactoring I proposed in
<https://sourceware.org/ml/libc-alpha/2016-11/msg00745.html>, this
patch puts all that information in a single header,
bits/long-double.h.  It is included from sys/cdefs.h alongside the
include of bits/wordsize.h, so other headers generally do not need to
include bits/long-double.h directly.

Previously, various bits/mathdef.h headers and bits/wordsize.h headers
had this long double information (including implicitly in some
bits/mathdef.h headers through not having the defines present in the
default version).  After the patch, it's all in six bits/long-double.h
headers.  Furthermore, most of those new headers are not
architecture-specific.  Architectures with optional long double all
use the ldbl-opt sysdeps directory, either in the order (ldbl-64-128,
ldbl-opt, ldbl-128) or (ldbl-128ibm, ldbl-opt).  Thus a generic header
for the case where long double = double, and headers in ldbl-128,
ldbl-96 and ldbl-opt, suffices to cover every architecture except for
cases where long double properties vary between different ABIs sharing
a set of installed headers; fortunately all the ldbl-opt cases share a
single compiler-predefined macro __LONG_DOUBLE_128__ that can be used
to tell whether this compilation is -mlong-double-64 or
-mlong-double-128.

The two cases where a set of headers is shared between ABIs with
different long double properties, MIPS (o32 has long double = double,
other ABIs use ldbl-128) and SPARC (32-bit has optional long double,
64-bit has required long double), need their own bits/long-double.h
headers.

As with bits/wordsize.h, multiple-include protection for this header
is generally implicit through the include guards on sys/cdefs.h, and
multiple inclusion is harmless in any case.  There is one subtlety:
the header must not define __LONG_DOUBLE_MATH_OPTIONAL if
__NO_LONG_DOUBLE_MATH was defined before its inclusion, because doing
so breaks how sysdeps/ieee754/ldbl-opt/nldbl-compat.h defines
__NO_LONG_DOUBLE_MATH itself before including system headers.  Subject
to keeping that working, it would be reasonable to move these macros
from defined/undefined #ifdef to always-defined 1/0 #if semantics, but
this patch does not attempt to do so, just rearranges where the macros
are defined.

After this patch, the only use of bits/mathdef.h is the alpha one for
modifying complex function ABIs for old GCC.  Thus, all versions of
the header other than the default and alpha versions are removed, as
is the include from math.h.

Tested for x86_64 and x86.  Also did compilation-only testing with
build-many-glibcs.py.

2016-12-01  Joseph Myers  <joseph@codesourcery.com>

	* bits/long-double.h: New file.
	* sysdeps/ieee754/ldbl-128/bits/long-double.h: Likewise.
	* sysdeps/ieee754/ldbl-96/bits/long-double.h: Likewise.
	* sysdeps/ieee754/ldbl-opt/bits/long-double.h: Likewise.
	* sysdeps/mips/bits/long-double.h: Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/long-double.h: Likewise.
	* math/Makefile (headers): Add bits/long-double.h.
	* misc/sys/cdefs.h: Include <bits/long-double.h>.
	* stdlib/strtold.c: Include <bits/long-double.h> instead of
	<bits/wordsize.h>.
	* bits/mathdef.h [!_COMPLEX_H]: Do not allow inclusion.
	[!__NO_LONG_DOUBLE_MATH]: Remove conditional code.
	* math/math.h: Do not include <bits/mathdef.h>.
	* sysdeps/aarch64/bits/mathdef.h: Remove file.
	* sysdeps/alpha/bits/mathdef.h [!_COMPLEX_H]: Do not allow
	inclusion.
	* sysdeps/ia64/bits/mathdef.h: Remove file.
	* sysdeps/m68k/m680x0/bits/mathdef.h: Likewise.
	* sysdeps/mips/bits/mathdef.h: Likewise.
	* sysdeps/powerpc/bits/mathdef.h: Likewise.
	* sysdeps/s390/bits/mathdef.h: Likewise.
	* sysdeps/sparc/bits/mathdef.h: Likewise.
	* sysdeps/x86/bits/mathdef.h: Likewise.
	* sysdeps/s390/s390-32/bits/wordsize.h
	[!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]: Remove
	conditional code.
	* sysdeps/s390/s390-64/bits/wordsize.h
	[!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]:
	Likewise.
	* sysdeps/unix/sysv/linux/alpha/bits/wordsize.h
	[!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
	[!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]:
	Likewise.
	* sysdeps/unix/sysv/linux/sparc/bits/wordsize.h
	[!__NO_LONG_DOUBLE_MATH && !__LONG_DOUBLE_MATH_OPTIONAL]:
	Likewise.

diff --git a/bits/long-double.h b/bits/long-double.h
new file mode 100644
index 0000000..2e3c7fd
--- /dev/null
+++ b/bits/long-double.h
@@ -0,0 +1,39 @@
+/* Properties of long double type.
+   Copyright (C) 2016 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  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/>.  */
+
+/* This header is included by <sys/cdefs.h>.
+
+   If long double is ABI-compatible with double, it should define
+   __NO_LONG_DOUBLE_MATH to 1; otherwise, it should leave
+   __NO_LONG_DOUBLE_MATH undefined.
+
+   If this build of the GNU C Library supports both long double
+   ABI-compatible with double and some other long double format not
+   ABI-compatible with double, it should define
+   __LONG_DOUBLE_MATH_OPTIONAL to 1; otherwise, it should leave
+   __LONG_DOUBLE_MATH_OPTIONAL undefined.
+
+   If  is already defined, this header must not define
+   anything; this is needed to work with the definition of
+   __NO_LONG_DOUBLE_MATH in nldbl-compat.h.  */
+
+/* In the default version of this header, long double is
+   ABI-compatible with double.  */
+#ifndef __NO_LONG_DOUBLE_MATH
+# define __NO_LONG_DOUBLE_MATH	1
+#endif
diff --git a/bits/mathdef.h b/bits/mathdef.h
index 0148297..5e80e92 100644
--- a/bits/mathdef.h
+++ b/bits/mathdef.h
@@ -15,12 +15,6 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#if !defined _MATH_H && !defined _COMPLEX_H
-# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
-#endif
-
-#ifndef __NO_LONG_DOUBLE_MATH
-/* Signal that we do not really have a `long double'.  The disables the
-   declaration of all the `long double' function variants.  */
-# define __NO_LONG_DOUBLE_MATH	1
+#ifndef _COMPLEX_H
+# error "Never use <bits/mathdef.h> directly; include <complex.h> instead"
 #endif
diff --git a/math/Makefile b/math/Makefile
index ac3a90a..47a7a9d 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -28,7 +28,8 @@ headers		:= math.h bits/mathcalls.h bits/mathinline.h bits/huge_val.h \
 		   bits/fenv.h bits/fenvinline.h bits/mathdef.h tgmath.h \
 		   bits/math-finite.h bits/math-vector.h \
 		   bits/libm-simd-decl-stubs.h bits/iscanonical.h \
-		   bits/flt-eval-method.h bits/fp-fast.h bits/fp-logb.h
+		   bits/flt-eval-method.h bits/fp-fast.h bits/fp-logb.h \
+		   bits/long-double.h
 
 # FPU support code.
 aux		:= setfpucw fpu_control
diff --git a/math/math.h b/math/math.h
index 6e4bf9e..929f6f9 100644
--- a/math/math.h
+++ b/math/math.h
@@ -119,10 +119,6 @@ typedef _Float128x double_t;
 # endif
 #endif
 
-/* Get information about long double.  */
-
-#include <bits/mathdef.h>
-
 /* Get the architecture specific values describing the floating-point
    evaluation.  The following symbols will get defined:
 
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index 9298dd6..e07f3fc 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -439,6 +439,7 @@
 #endif
 
 #include <bits/wordsize.h>
+#include <bits/long-double.h>
 
 #if defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
 # define __LDBL_COMPAT 1
diff --git a/stdlib/strtold.c b/stdlib/strtold.c
index bb46f23..251663f 100644
--- a/stdlib/strtold.c
+++ b/stdlib/strtold.c
@@ -20,7 +20,7 @@
 /* The actual implementation for all floating point sizes is in strtod.c.
    These macros tell it to produce the `float' version, `strtof'.  */
 
-#include <bits/wordsize.h>
+#include <bits/long-double.h>
 
 #ifdef __LONG_DOUBLE_MATH_OPTIONAL
 # include <wchar.h>
diff --git a/sysdeps/aarch64/bits/mathdef.h b/sysdeps/aarch64/bits/mathdef.h
deleted file mode 100644
index 2213635..0000000
--- a/sysdeps/aarch64/bits/mathdef.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright (C) 1999-2016 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/>.  */
-
-#if !defined _MATH_H && !defined _COMPLEX_H
-# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
-#endif
diff --git a/sysdeps/alpha/bits/mathdef.h b/sysdeps/alpha/bits/mathdef.h
index 021563f..e56f3e5 100644
--- a/sysdeps/alpha/bits/mathdef.h
+++ b/sysdeps/alpha/bits/mathdef.h
@@ -15,8 +15,8 @@
    License along with the GNU C Library.  If not, see
    <http://www.gnu.org/licenses/>.  */
 
-#if !defined _MATH_H && !defined _COMPLEX_H
-# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
+#ifndef _COMPLEX_H
+# error "Never use <bits/mathdef.h> directly; include <complex.h> instead"
 #endif
 
 #if defined _COMPLEX_H && !defined _COMPLEX_H_MATHDEF
diff --git a/sysdeps/ia64/bits/mathdef.h b/sysdeps/ia64/bits/mathdef.h
deleted file mode 100644
index e689835..0000000
--- a/sysdeps/ia64/bits/mathdef.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (C) 2000-2016 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/>.  */
-
-#if !defined _MATH_H && !defined _COMPLEX_H
-# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
-#endif
diff --git a/sysdeps/ieee754/ldbl-128/bits/long-double.h b/sysdeps/ieee754/ldbl-128/bits/long-double.h
new file mode 100644
index 0000000..3f10da8
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128/bits/long-double.h
@@ -0,0 +1,20 @@
+/* Properties of long double type.  ldbl-128 version.
+   Copyright (C) 2016 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  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/>.  */
+
+/* long double is distinct from double, so there is nothing to
+   define here.  */
diff --git a/sysdeps/ieee754/ldbl-96/bits/long-double.h b/sysdeps/ieee754/ldbl-96/bits/long-double.h
new file mode 100644
index 0000000..180a7cf
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-96/bits/long-double.h
@@ -0,0 +1,20 @@
+/* Properties of long double type.  ldbl-96 version.
+   Copyright (C) 2016 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  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/>.  */
+
+/* long double is distinct from double, so there is nothing to
+   define here.  */
diff --git a/sysdeps/ieee754/ldbl-opt/bits/long-double.h b/sysdeps/ieee754/ldbl-opt/bits/long-double.h
new file mode 100644
index 0000000..dce98c3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/bits/long-double.h
@@ -0,0 +1,24 @@
+/* Properties of long double type.  ldbl-opt version.
+   Copyright (C) 2016 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  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 __NO_LONG_DOUBLE_MATH
+# define __LONG_DOUBLE_MATH_OPTIONAL	1
+# ifndef __LONG_DOUBLE_128__
+#  define __NO_LONG_DOUBLE_MATH		1
+# endif
+#endif
diff --git a/sysdeps/m68k/m680x0/bits/mathdef.h b/sysdeps/m68k/m680x0/bits/mathdef.h
deleted file mode 100644
index 7926c6a..0000000
--- a/sysdeps/m68k/m680x0/bits/mathdef.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (C) 1997-2016 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/>.  */
-
-#if !defined _MATH_H && !defined _COMPLEX_H
-# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
-#endif
diff --git a/sysdeps/mips/bits/long-double.h b/sysdeps/mips/bits/long-double.h
new file mode 100644
index 0000000..b51fce8
--- /dev/null
+++ b/sysdeps/mips/bits/long-double.h
@@ -0,0 +1,23 @@
+/* Properties of long double type.  MIPS version.
+   Copyright (C) 2016 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  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/>.  */
+
+#include <sgidefs.h>
+
+#if !defined __NO_LONG_DOUBLE_MATH && _MIPS_SIM == _ABIO32
+# define __NO_LONG_DOUBLE_MATH	1
+#endif
diff --git a/sysdeps/mips/bits/mathdef.h b/sysdeps/mips/bits/mathdef.h
deleted file mode 100644
index 31fc400..0000000
--- a/sysdeps/mips/bits/mathdef.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Copyright (C) 1997-2016 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/>.  */
-
-#if !defined _MATH_H && !defined _COMPLEX_H
-# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
-#endif
-
-#include <sgidefs.h>
-
-#if ! defined __NO_LONG_DOUBLE_MATH && _MIPS_SIM == _ABIO32
-/* Signal that we do not really have a `long double'.  This disables the
-   declaration of all the `long double' function variants.  */
-# define __NO_LONG_DOUBLE_MATH	1
-#endif
diff --git a/sysdeps/powerpc/bits/mathdef.h b/sysdeps/powerpc/bits/mathdef.h
deleted file mode 100644
index eeea6fc..0000000
--- a/sysdeps/powerpc/bits/mathdef.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (C) 1997-2016 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/>.  */
-
-#if !defined _MATH_H && !defined _COMPLEX_H
-# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
-#endif
diff --git a/sysdeps/s390/bits/mathdef.h b/sysdeps/s390/bits/mathdef.h
deleted file mode 100644
index eeea6fc..0000000
--- a/sysdeps/s390/bits/mathdef.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (C) 1997-2016 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/>.  */
-
-#if !defined _MATH_H && !defined _COMPLEX_H
-# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
-#endif
diff --git a/sysdeps/s390/s390-32/bits/wordsize.h b/sysdeps/s390/s390-32/bits/wordsize.h
index c7a5fbf..129e471 100644
--- a/sysdeps/s390/s390-32/bits/wordsize.h
+++ b/sysdeps/s390/s390-32/bits/wordsize.h
@@ -9,14 +9,3 @@
 #endif
 
 #define __WORDSIZE_TIME64_COMPAT32     0
-
-#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
-
-/* Signal that we didn't used to have a `long double'. The changes all
-   the `long double' function variants to be redirects to the double
-   functions.  */
-# define __LONG_DOUBLE_MATH_OPTIONAL   1
-# ifndef __LONG_DOUBLE_128__
-#  define __NO_LONG_DOUBLE_MATH        1
-# endif
-#endif
diff --git a/sysdeps/s390/s390-64/bits/wordsize.h b/sysdeps/s390/s390-64/bits/wordsize.h
index 31e0ec6..00e88b0 100644
--- a/sysdeps/s390/s390-64/bits/wordsize.h
+++ b/sysdeps/s390/s390-64/bits/wordsize.h
@@ -9,14 +9,3 @@
 #endif
 
 #define __WORDSIZE_TIME64_COMPAT32     0
-
-#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
-
-/* Signal that we didn't used to have a `long double'. The changes all
-   the `long double' function variants to be redirects to the double
-   functions.  */
-# define __LONG_DOUBLE_MATH_OPTIONAL   1
-# ifndef __LONG_DOUBLE_128__
-#  define __NO_LONG_DOUBLE_MATH        1
-# endif
-#endif
diff --git a/sysdeps/sparc/bits/mathdef.h b/sysdeps/sparc/bits/mathdef.h
deleted file mode 100644
index 65ab45a..0000000
--- a/sysdeps/sparc/bits/mathdef.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright (C) 1997-2016 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/>.  */
-
-#if !defined _MATH_H && !defined _COMPLEX_H
-# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
-#endif
-
-#include <bits/wordsize.h>
diff --git a/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h b/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h
index f0961f6..2ef70a9 100644
--- a/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h
+++ b/sysdeps/unix/sysv/linux/alpha/bits/wordsize.h
@@ -17,14 +17,3 @@
 
 #define __WORDSIZE	64
 #define __WORDSIZE_TIME64_COMPAT32	0
-
-#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
-
-/* Signal that we didn't used to have a `long double'. The changes all
-   the `long double' function variants to be redirects to the double
-   functions.  */
-# define __LONG_DOUBLE_MATH_OPTIONAL	1
-# ifndef __LONG_DOUBLE_128__
-#  define __NO_LONG_DOUBLE_MATH		1
-# endif
-#endif
diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h b/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
index 109f08c..04ca9de 100644
--- a/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/wordsize.h
@@ -9,14 +9,3 @@
 # define __WORDSIZE32_SIZE_ULONG	0
 # define __WORDSIZE32_PTRDIFF_LONG	0
 #endif
-
-#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
-
-/* Signal the glibc ABI didn't used to have a `long double'.
-   The changes all the `long double' function variants to be redirects
-   to the double functions.  */
-# define __LONG_DOUBLE_MATH_OPTIONAL   1
-# ifndef __LONG_DOUBLE_128__
-#  define __NO_LONG_DOUBLE_MATH        1
-# endif
-#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/long-double.h b/sysdeps/unix/sysv/linux/sparc/bits/long-double.h
new file mode 100644
index 0000000..20039ce
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/sparc/bits/long-double.h
@@ -0,0 +1,26 @@
+/* Properties of long double type.  SPARC version.
+   Copyright (C) 2016 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  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/>.  */
+
+#include <bits/wordsize.h>
+
+#if !defined __NO_LONG_DOUBLE_MATH && __WORDSIZE == 32
+# define __LONG_DOUBLE_MATH_OPTIONAL   1
+# ifndef __LONG_DOUBLE_128__
+#  define __NO_LONG_DOUBLE_MATH        1
+# endif
+#endif
diff --git a/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h b/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h
index 121b4fe..7562875 100644
--- a/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h
+++ b/sysdeps/unix/sysv/linux/sparc/bits/wordsize.h
@@ -9,16 +9,3 @@
 # define __WORDSIZE32_PTRDIFF_LONG	0
 # define __WORDSIZE_TIME64_COMPAT32	0
 #endif
-
-#if !defined __NO_LONG_DOUBLE_MATH && !defined __LONG_DOUBLE_MATH_OPTIONAL
-
-# if __WORDSIZE == 32
-/* Signal that in 32bit ABI we didn't used to have a `long double'.
-   The changes all the `long double' function variants to be redirects
-   to the double functions.  */
-#  define __LONG_DOUBLE_MATH_OPTIONAL   1
-#  ifndef __LONG_DOUBLE_128__
-#   define __NO_LONG_DOUBLE_MATH        1
-#  endif
-# endif
-#endif
diff --git a/sysdeps/x86/bits/mathdef.h b/sysdeps/x86/bits/mathdef.h
deleted file mode 100644
index 1c6aee6..0000000
--- a/sysdeps/x86/bits/mathdef.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* Copyright (C) 2001-2016 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/>.  */
-
-#if !defined _MATH_H && !defined _COMPLEX_H
-# error "Never use <bits/mathdef.h> directly; include <math.h> instead"
-#endif

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Ping Re: Refactor long double information into bits/long-double.h
  2016-12-01 22:53 ` Joseph Myers
@ 2016-12-07 22:30   ` Joseph Myers
  2016-12-14 18:29   ` Joseph Myers
  1 sibling, 0 replies; 5+ messages in thread
From: Joseph Myers @ 2016-12-07 22:30 UTC (permalink / raw)
  To: libc-alpha

Ping.  This patch 
<https://sourceware.org/ml/libc-alpha/2016-12/msg00031.html> is pending 
review.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Refactor long double information into bits/long-double.h
  2016-12-01 22:53 ` Joseph Myers
  2016-12-07 22:30   ` Ping " Joseph Myers
@ 2016-12-14 18:29   ` Joseph Myers
  1 sibling, 0 replies; 5+ messages in thread
From: Joseph Myers @ 2016-12-14 18:29 UTC (permalink / raw)
  To: libc-alpha

In the absence of any comments, I've treated this patch as a libm patch 
and committed it.

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-12-14 18:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-24  2:15 Refactor long double information into bits/long-double.h Joseph Myers
2016-11-28 18:10 ` Ping " Joseph Myers
2016-12-01 22:53 ` Joseph Myers
2016-12-07 22:30   ` Ping " Joseph Myers
2016-12-14 18:29   ` Joseph Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).