This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH v4 2/5] float128: Include math-finite.h for _Float128


Changes since v3:

  - Replace __MATH_DECLARING_FLOAT128 with __MATH_DECLARING_FLOATN.

-- 8< --
All the declarations in math-finite.h are macroized by floating-point
type.  This patch includes it for float128 and protects the
declarations of functions that need not be declared for float128.

2017-05-09  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>

	* math/math.h: Include bits/math-finite.h for float128.
	(__MATH_DECLARING_FLOATN): Define to control declaration of
	float128 functions.
	* math/bits/math-finite.h (pow10): Do not declare for float128.
	(gamma): Likewise.
	(scalb): Likewise.
---
 math/bits/math-finite.h | 13 ++++++++-----
 math/math.h             | 21 +++++++++++++++++++++
 2 files changed, 29 insertions(+), 5 deletions(-)

diff --git a/math/bits/math-finite.h b/math/bits/math-finite.h
index 29f2f2e..b07ce31 100644
--- a/math/bits/math-finite.h
+++ b/math/bits/math-finite.h
@@ -83,7 +83,9 @@ __MATH_REDIRCALL (exp, , (_Mdouble_));
 __MATH_REDIRCALL (exp10, , (_Mdouble_));
 
 /* pow10.  */
+# if !__MATH_DECLARING_FLOATN
 __MATH_REDIRCALL_2 (pow10, , (_Mdouble_), exp10);
+# endif
 #endif
 
 #ifdef __USE_ISOC99
@@ -146,7 +148,7 @@ __NTH (__REDIRFROM (lgamma, , _MSUF_) (_Mdouble_ __d))
 #endif
 
 #if ((defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)) \
-     && defined __extern_always_inline)
+     && defined __extern_always_inline) && !__MATH_DECLARING_FLOATN
 /* gamma.  */
 __extern_always_inline _Mdouble_
 __NTH (__REDIRFROM (gamma, , _MSUF_) (_Mdouble_ __d))
@@ -174,10 +176,11 @@ __MATH_REDIRCALL (pow, , (_Mdouble_, _Mdouble_));
 __MATH_REDIRCALL (remainder, , (_Mdouble_, _Mdouble_));
 #endif
 
-#if (__MATH_DECLARING_DOUBLE \
-     && (defined __USE_MISC \
-	 || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8))) \
-    || (!defined __MATH_DECLARE_LDOUBLE && defined __USE_MISC)
+#if ((__MATH_DECLARING_DOUBLE \
+      && (defined __USE_MISC \
+	  || (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K8))) \
+     || (!defined __MATH_DECLARE_LDOUBLE && defined __USE_MISC)) \
+    && !__MATH_DECLARING_FLOATN
 /* scalb.  */
 __MATH_REDIRCALL (scalb, , (_Mdouble_, _Mdouble_));
 #endif
diff --git a/math/math.h b/math/math.h
index b0b1932..03aadc0 100644
--- a/math/math.h
+++ b/math/math.h
@@ -626,11 +626,13 @@ extern int matherr (struct exception *__exc);
 # define _Mdouble_ double
 # define __MATH_DECLARING_DOUBLE 1
 # define __MATH_DECLARING_LDOUBLE 0
+# define __MATH_DECLARING_FLOATN 0
 # define _MSUF_
 # include <bits/math-finite.h>
 # undef _Mdouble_
 # undef __MATH_DECLARING_DOUBLE
 # undef __MATH_DECLARING_LDOUBLE
+# undef __MATH_DECLARING_FLOATN
 # undef _MSUF_
 
 /* When __USE_ISOC99 is defined, include math-finite for float and
@@ -641,11 +643,13 @@ extern int matherr (struct exception *__exc);
 #  define _Mdouble_ float
 #  define __MATH_DECLARING_DOUBLE 0
 #  define __MATH_DECLARING_LDOUBLE 0
+#  define __MATH_DECLARING_FLOATN 0
 #  define _MSUF_ f
 #  include <bits/math-finite.h>
 #  undef _Mdouble_
 #  undef __MATH_DECLARING_DOUBLE
 #  undef __MATH_DECLARING_LDOUBLE
+#  undef __MATH_DECLARING_FLOATN
 #  undef _MSUF_
 
 /* Include bits/math-finite.h for long double.  */
@@ -653,15 +657,32 @@ extern int matherr (struct exception *__exc);
 #   define _Mdouble_ long double
 #   define __MATH_DECLARING_DOUBLE 0
 #   define __MATH_DECLARING_LDOUBLE 1
+#   define __MATH_DECLARING_FLOATN 0
 #   define _MSUF_ l
 #   include <bits/math-finite.h>
 #   undef _Mdouble_
 #   undef __MATH_DECLARING_DOUBLE
 #   undef __MATH_DECLARING_LDOUBLE
+#   undef __MATH_DECLARING_FLOATN
 #   undef _MSUF_
 #  endif
 
 # endif /* __USE_ISOC99.  */
+
+/* Include bits/math-finite.h for float128.  */
+# if __HAVE_FLOAT128 && __GLIBC_USE (IEC_60559_TYPES_EXT)
+#  define _Mdouble_ _Float128
+#  define __MATH_DECLARING_DOUBLE 0
+#  define __MATH_DECLARING_LDOUBLE 0
+#  define __MATH_DECLARING_FLOATN 1
+#  define _MSUF_ f128
+#  include <bits/math-finite.h>
+#  undef _Mdouble_
+#  undef __MATH_DECLARING_DOUBLE
+#  undef __MATH_DECLARING_LDOUBLE
+#  undef __MATH_DECLARING_FLOATN
+#  undef _MSUF_
+# endif
 #endif /* __FINITE_MATH_ONLY__ > 0.  */
 
 #ifdef __USE_ISOC99
-- 
2.4.11


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]