]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Support __STDC_WANT_IEC_60559_BFP_EXT__ feature test macro.
authorJoseph Myers <joseph@codesourcery.com>
Wed, 3 Aug 2016 17:30:41 +0000 (17:30 +0000)
committerJoseph Myers <joseph@codesourcery.com>
Wed, 3 Aug 2016 17:30:41 +0000 (17:30 +0000)
This patch implements support for the __STDC_WANT_IEC_60559_BFP_EXT__
feature test macro from ISO/IEC 18661-1:2014, following the
__GLIBC_USE approach now used for __STDC_WANT_LIB_EXT2__.  For this
macro, the relevant consideration is whether it is defined or
undefined when an affected header is included (not what its value is
if defined, and not whether it's defined or undefined when any other
unaffected system header is included).

Currently this macro only affects the issignaling macro and the nextup
and nextdown functions (so they can be enabled by defining this macro,
not just by defining _GNU_SOURCE as previously).  Any further features
from this TS added in future would also be conditioned on this macro.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

* bits/libc-header-start.h (__GLIBC_USE_IEC_60559_BFP_EXT): New
macro.
* include/features.h (__STDC_WANT_IEC_60559_BFP_EXT__): Document.
* manual/arith.texi (issignaling): Document as ISO from TS
18661-1:2014.
(nextup): Likewise.
(nextupf): Likewise.
(nextupl): Likewise.
(nextdown): Likewise.
(nextdownf): Likewise.
(nextdownl): Likewise.
* manual/creature.texi (__STDC_WANT_IEC_60559_BFP_EXT__): Document
macro.
* math/math.h: Define
__GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION and include
<bits/libc-header-start.h> instead of including <features.h>.
(issignaling): Define if [__GLIBC_USE (IEC_60559_BFP_EXT)], not
[__USE_GNU].
* math/bits/mathcalls.h (nextdown): Declare if
[__GLIBC_USE (IEC_60559_BFP_EXT)], not [__USE_GNU].
(nextup): Likewise.
(__issignaling): Likewise.

ChangeLog
NEWS
bits/libc-header-start.h
include/features.h
manual/arith.texi
manual/creature.texi
math/bits/mathcalls.h
math/math.h

index 00fd7c107adf2e9c13c3ee6618f58e783bcc5120..bd751f26d06b8f28d2a40163b00ac549a8447f01 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,28 @@
+2016-08-03  Joseph Myers  <joseph@codesourcery.com>
+
+       * bits/libc-header-start.h (__GLIBC_USE_IEC_60559_BFP_EXT): New
+       macro.
+       * include/features.h (__STDC_WANT_IEC_60559_BFP_EXT__): Document.
+       * manual/arith.texi (issignaling): Document as ISO from TS
+       18661-1:2014.
+       (nextup): Likewise.
+       (nextupf): Likewise.
+       (nextupl): Likewise.
+       (nextdown): Likewise.
+       (nextdownf): Likewise.
+       (nextdownl): Likewise.
+       * manual/creature.texi (__STDC_WANT_IEC_60559_BFP_EXT__): Document
+       macro.
+       * math/math.h: Define
+       __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION and include
+       <bits/libc-header-start.h> instead of including <features.h>.
+       (issignaling): Define if [__GLIBC_USE (IEC_60559_BFP_EXT)], not
+       [__USE_GNU].
+       * math/bits/mathcalls.h (nextdown): Declare if
+       [__GLIBC_USE (IEC_60559_BFP_EXT)], not [__USE_GNU].
+       (nextup): Likewise.
+       (__issignaling): Likewise.
+
 2016-08-03  Paul E. Murphy  <murphyp@linux.vnet.ibm.com>
 
        * s_ccoshf.c (__ccoshf): Remove FE_INVALID
diff --git a/NEWS b/NEWS
index d057c06b573a498497bf9c4ffdc56ee178f45b36..495bde01beee25a565a7b3229eef210618c18d3c 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,11 @@ Version 2.25
   TR.  Note that not all functions from that TR are supported by the GNU C
   Library.
 
+* The feature test macro __STDC_WANT_IEC_60559_BFP_EXT__, from ISO/IEC TS
+  18661-1:2014, is supported to enable declarations of functions and macros
+  from that TS.  Note that most features from that TS are not supported by
+  the GNU C Library.
+
 Security related changes:
 
   [Add security related changes here]
index c6663074a8680cd6e65517599666e3955dbbea46..6a5850526cfaaa7297b625363faa248d94bb057c 100644 (file)
 #else
 # define __GLIBC_USE_LIB_EXT2 0
 #endif
+
+/* ISO/IEC TS 18661-1:2014 defines the __STDC_WANT_IEC_60559_BFP_EXT__
+   macro.  */
+#undef __GLIBC_USE_IEC_60559_BFP_EXT
+#if defined __USE_GNU || defined __STDC_WANT_IEC_60559_BFP_EXT__
+# define __GLIBC_USE_IEC_60559_BFP_EXT 1
+#else
+# define __GLIBC_USE_IEC_60559_BFP_EXT 0
+#endif
index 404014115a3dc642d0faedccb3c14d990d1e6954..f2cd148fa42ad08e3552b1db4a8010b345cc5da7 100644 (file)
@@ -25,6 +25,7 @@
    _ISOC99_SOURCE      Extensions to ISO C89 from ISO C99.
    _ISOC11_SOURCE      Extensions to ISO C99 from ISO C11.
    __STDC_WANT_LIB_EXT2__ Extensions to ISO C99 from TR 27431-2:2010.
+   __STDC_WANT_IEC_60559_BFP_EXT__ Extensions to ISO C11 from TS 18661-1:2014.
    _POSIX_SOURCE       IEEE Std 1003.1.
    _POSIX_C_SOURCE     If ==1, like _POSIX_SOURCE; if >=2 add IEEE Std 1003.2;
                        if >=199309L, add IEEE Std 1003.1b-1993;
index f54b1ec7df411abecf43f538baa412a576fe216e..3d8bdd8cad67fe5dad66e92657812d33d4b307a5 100644 (file)
@@ -397,12 +397,11 @@ to
 @end deftypefn
 
 @comment math.h
-@comment GNU
+@comment ISO
 @deftypefn {Macro} int issignaling (@emph{float-type} @var{x})
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 This macro returns a nonzero value if @var{x} is a signaling NaN
-(sNaN).  It is based on draft TS 18661 and currently enabled as a GNU
-extension.
+(sNaN).  It is from TS 18661-1:2014.
 @end deftypefn
 
 Another set of floating-point classification functions was provided by
@@ -1703,13 +1702,13 @@ double}.
 @end deftypefun
 
 @comment math.h
-@comment GNU
+@comment ISO
 @deftypefun double nextup (double @var{x})
 @comment math.h
-@comment GNU
+@comment ISO
 @deftypefunx float nextupf (float @var{x})
 @comment math.h
-@comment GNU
+@comment ISO
 @deftypefunx {long double} nextupl (long double @var{x})
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 The @code{nextup} function returns the next representable neighbor of @var{x}
@@ -1718,18 +1717,18 @@ subnormal number in the type of @var{x} the function returns @code{-0}.  If
 @math{@var{x} = @code{0}} the function returns the smallest positive subnormal
 number in the type of @var{x}.  If @var{x} is NaN, NaN is returned.
 If @var{x} is @math{+@infinity{}}, @math{+@infinity{}} is returned.
-@code{nextup} is based on TS 18661 and currently enabled as a GNU extension.
+@code{nextup} from TS 18661-1:2014.
 @code{nextup} never raises an exception except for signaling NaNs.
 @end deftypefun
 
 @comment math.h
-@comment GNU
+@comment ISO
 @deftypefun double nextdown (double @var{x})
 @comment math.h
-@comment GNU
+@comment ISO
 @deftypefunx float nextdownf (float @var{x})
 @comment math.h
-@comment GNU
+@comment ISO
 @deftypefunx {long double} nextdownl (long double @var{x})
 @safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
 The @code{nextdown} function returns the next representable neighbor of @var{x}
@@ -1738,7 +1737,7 @@ subnormal number in the type of @var{x} the function returns @code{+0}.  If
 @math{@var{x} = @code{0}} the function returns the smallest negative subnormal
 number in the type of @var{x}.  If @var{x} is NaN, NaN is returned.
 If @var{x} is @math{-@infinity{}}, @math{-@infinity{}} is returned.
-@code{nextdown} is based on TS 18661 and currently enabled as a GNU extension.
+@code{nextdown} is from TS 18661-1:2014.
 @code{nextdown} never raises an exception except for signaling NaNs.
 @end deftypefun
 
index 65c59283439d685e3c0453db63015f1e0bb66694..61b17ce22b6d10ca7f57a52b1ee13bae8b601f5c 100644 (file)
@@ -173,6 +173,15 @@ TR 24731-2:2010 (Dynamic Allocation Functions) are enabled.  Only some
 of the features from this TR are supported by @theglibc{}.
 @end defvr
 
+@comment (none)
+@comment ISO
+@defvr Macro __STDC_WANT_IEC_60559_BFP_EXT__
+If you define this macro, features from ISO/IEC TS 18661-1:2014
+(Floating-point extensions for C: Binary floating-point arithmetic)
+are enabled.  Only some of the features from this TS are supported by
+@theglibc{}.
+@end defvr
+
 @comment (none)
 @comment GNU
 @defvr Macro _GNU_SOURCE
index e2cf49f6271d0d838150c7b1b068f1b40f7b13d9..e1c0521ae8bc0e7261f01b67d7d96c6cc2bf2765 100644 (file)
@@ -294,7 +294,7 @@ __MATHCALLX (nextafter,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
 __MATHCALLX (nexttoward,, (_Mdouble_ __x, long double __y), (__const__));
 # endif
 
-#ifdef __USE_GNU
+#if __GLIBC_USE (IEC_60559_BFP_EXT)
 /* Return X - epsilon.  */
 __MATHCALL (nextdown,, (_Mdouble_ __x));
 /* Return X + epsilon.  */
@@ -377,7 +377,7 @@ __MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
 __END_NAMESPACE_C99
 #endif
 
-#ifdef __USE_GNU
+#if __GLIBC_USE (IEC_60559_BFP_EXT)
 /* Test for signaling NaN.  */
 __MATHDECL_1 (int, __issignaling,, (_Mdouble_ __value))
      __attribute__ ((__const__));
index 4724b10b6f6d4a45376a55ec8707628c23ef7123..ff9d70adf540986769fc6c960d74cd950476262d 100644 (file)
@@ -23,7 +23,8 @@
 #ifndef        _MATH_H
 #define        _MATH_H 1
 
-#include <features.h>
+#define __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
+#include <bits/libc-header-start.h>
 
 __BEGIN_DECLS
 
@@ -328,7 +329,7 @@ enum
 
 #endif /* Use ISO C99.  */
 
-#ifdef __USE_GNU
+#if __GLIBC_USE (IEC_60559_BFP_EXT)
 /* Return nonzero value if X is a signaling NaN.  */
 # ifdef __NO_LONG_DOUBLE_MATH
 #  define issignaling(x) \
@@ -340,7 +341,7 @@ enum
       : sizeof (x) == sizeof (double)                                        \
       ? __issignaling (x) : __issignalingl (x))
 # endif
-#endif /* Use GNU.  */
+#endif /* Use IEC_60559_BFP_EXT.  */
 
 #ifdef __USE_MISC
 /* Support for various different standard error handling behaviors.  */