forked from pool/glibc
Andreas Schwab
c0dd082d43
- assert-pedantic.patch: Suppress pedantic warning caused by statement expression (BZ #21242, BZ #21972) - math-c++-compat.patch: Add more C++ compatibility - getaddrinfo-errno.patch: Fix errno and h_errno handling in getaddrinfo (BZ #21915, BZ #21922) - resolv-conf-oom.patch: Fix memory handling in OOM situation during resolv.conf parsing (BZ #22095, BZ #22096) - dynarray-enlarge.patch: Fix initial size of dynarray allocation and set errno on overflow error - nearbyint-inexact.patch: Avoid spurious inexact in nearbyint (BZ #22225) OBS-URL: https://build.opensuse.org/request/show/529148 OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=479
185 lines
6.6 KiB
Diff
185 lines
6.6 KiB
Diff
2017-09-22 Gabriel F. T. Gomes <gabriel@inconstante.eti.br>
|
|
|
|
[BZ #22146]
|
|
math/math.h: Let fpclassify use the builtin in C++ mode, even
|
|
when optimazing for size.
|
|
|
|
2017-08-28 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
|
|
|
|
[BZ #21930]
|
|
* math/math.h [defined __cplusplus && defined __SUPPORT_SNAN__]
|
|
(iszero): New C++ implementation that does not use
|
|
fpclassify/__MATH_TG/__builtin_types_compatible_p, when
|
|
signaling nans are enabled, since __builtin_types_compatible_p
|
|
is a C-only feature.
|
|
|
|
2017-08-24 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
|
|
|
|
* math/math.h [defined __cplusplus] (issignaling): In the long
|
|
double case, call __issignalingl only if __NO_LONG_DOUBLE_MATH
|
|
is not defined. Call __issignaling, otherwise.
|
|
|
|
2017-08-22 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
|
|
|
|
* math/math.h [defined __cplusplus] (issignaling): Provide a C++
|
|
definition for issignaling that does not rely on __MATH_TG,
|
|
since __MATH_TG uses __builtin_types_compatible_p, which is only
|
|
available in C mode.
|
|
|
|
2017-08-18 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
|
|
|
|
[BZ #21930]
|
|
* math/math.h (isinf): Check if in C or C++ mode before using
|
|
__builtin_types_compatible_p, since this is a C mode feature.
|
|
|
|
2017-08-18 Gabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
|
|
|
|
* misc/sys/cdefs.h (__HAVE_GENERIC_SELECTION): Define to 0, if
|
|
in C++ mode.
|
|
|
|
Index: glibc-2.26/math/math.h
|
|
===================================================================
|
|
--- glibc-2.26.orig/math/math.h
|
|
+++ glibc-2.26/math/math.h
|
|
@@ -402,7 +402,13 @@ enum
|
|
|
|
/* Return number of classification appropriate for X. */
|
|
# if __GNUC_PREREQ (4,4) && !defined __SUPPORT_SNAN__ \
|
|
- && !defined __OPTIMIZE_SIZE__
|
|
+ && (!defined __OPTIMIZE_SIZE__ || defined __cplusplus)
|
|
+ /* The check for __cplusplus allows the use of the builtin, even
|
|
+ when optimization for size is on. This is provided for
|
|
+ libstdc++, only to let its configure test work when it is built
|
|
+ with -Os. No further use of this definition of fpclassify is
|
|
+ expected in C++ mode, since libstdc++ provides its own version
|
|
+ of fpclassify in cmath (which undefines fpclassify). */
|
|
# define fpclassify(x) __builtin_fpclassify (FP_NAN, FP_INFINITE, \
|
|
FP_NORMAL, FP_SUBNORMAL, FP_ZERO, x)
|
|
# else
|
|
@@ -442,8 +448,12 @@ enum
|
|
|
|
/* Return nonzero value if X is positive or negative infinity. */
|
|
# if __HAVE_DISTINCT_FLOAT128 && !__GNUC_PREREQ (7,0) \
|
|
- && !defined __SUPPORT_SNAN__
|
|
- /* __builtin_isinf_sign is broken for float128 only before GCC 7.0. */
|
|
+ && !defined __SUPPORT_SNAN__ && !defined __cplusplus
|
|
+ /* Since __builtin_isinf_sign is broken for float128 before GCC 7.0,
|
|
+ use the helper function, __isinff128, with older compilers. This is
|
|
+ only provided for C mode, because in C++ mode, GCC has no support
|
|
+ for __builtin_types_compatible_p (and when in C++ mode, this macro is
|
|
+ not used anyway, because libstdc++ headers undefine it). */
|
|
# define isinf(x) \
|
|
(__builtin_types_compatible_p (__typeof (x), _Float128) \
|
|
? __isinff128 (x) : __builtin_isinf_sign (x))
|
|
@@ -470,7 +480,32 @@ enum
|
|
# include <bits/iscanonical.h>
|
|
|
|
/* Return nonzero value if X is a signaling NaN. */
|
|
-# define issignaling(x) __MATH_TG ((x), __issignaling, (x))
|
|
+# ifndef __cplusplus
|
|
+# define issignaling(x) __MATH_TG ((x), __issignaling, (x))
|
|
+# else
|
|
+ /* In C++ mode, __MATH_TG cannot be used, because it relies on
|
|
+ __builtin_types_compatible_p, which is a C-only builtin. On the
|
|
+ other hand, overloading provides the means to distinguish between
|
|
+ the floating-point types. The overloading resolution will match
|
|
+ the correct parameter (regardless of type qualifiers (i.e.: const
|
|
+ and volatile). */
|
|
+extern "C++" {
|
|
+inline int issignaling (float __val) { return __issignalingf (__val); }
|
|
+inline int issignaling (double __val) { return __issignaling (__val); }
|
|
+inline int
|
|
+issignaling (long double __val)
|
|
+{
|
|
+# ifdef __NO_LONG_DOUBLE_MATH
|
|
+ return __issignaling (__val);
|
|
+# else
|
|
+ return __issignalingl (__val);
|
|
+# endif
|
|
+}
|
|
+# if __HAVE_DISTINCT_FLOAT128
|
|
+inline int issignaling (_Float128 __val) { return __issignalingf128 (__val); }
|
|
+# endif
|
|
+} /* extern C++ */
|
|
+# endif
|
|
|
|
/* Return nonzero value if X is subnormal. */
|
|
# define issubnormal(x) (fpclassify (x) == FP_SUBNORMAL)
|
|
@@ -484,15 +519,40 @@ enum
|
|
# endif
|
|
# else /* __cplusplus */
|
|
extern "C++" {
|
|
+# ifdef __SUPPORT_SNAN__
|
|
+inline int
|
|
+iszero (float __val)
|
|
+{
|
|
+ return __fpclassifyf (__val) == FP_ZERO;
|
|
+}
|
|
+inline int
|
|
+iszero (double __val)
|
|
+{
|
|
+ return __fpclassify (__val) == FP_ZERO;
|
|
+}
|
|
+inline int
|
|
+iszero (long double __val)
|
|
+{
|
|
+# ifdef __NO_LONG_DOUBLE_MATH
|
|
+ return __fpclassify (__val) == FP_ZERO;
|
|
+# else
|
|
+ return __fpclassifyl (__val) == FP_ZERO;
|
|
+# endif
|
|
+}
|
|
+# if __HAVE_DISTINCT_FLOAT128
|
|
+inline int
|
|
+iszero (_Float128 __val)
|
|
+{
|
|
+ return __fpclassifyf128 (__val) == FP_ZERO;
|
|
+}
|
|
+# endif
|
|
+# else
|
|
template <class __T> inline bool
|
|
iszero (__T __val)
|
|
{
|
|
-# ifdef __SUPPORT_SNAN__
|
|
- return fpclassify (__val) == FP_ZERO;
|
|
-# else
|
|
return __val == 0;
|
|
-# endif
|
|
}
|
|
+# endif
|
|
} /* extern C++ */
|
|
# endif /* __cplusplus */
|
|
#endif /* Use IEC_60559_BFP_EXT. */
|
|
Index: glibc-2.26/misc/sys/cdefs.h
|
|
===================================================================
|
|
--- glibc-2.26.orig/misc/sys/cdefs.h
|
|
+++ glibc-2.26/misc/sys/cdefs.h
|
|
@@ -464,17 +464,18 @@
|
|
# define __glibc_macro_warning(msg)
|
|
#endif
|
|
|
|
-/* Support for generic selection (ISO C11) is available in GCC since
|
|
- version 4.9. Previous versions do not provide generic selection,
|
|
- even though they might set __STDC_VERSION__ to 201112L, when in
|
|
- -std=c11 mode. Thus, we must check for !defined __GNUC__ when
|
|
- testing __STDC_VERSION__ for generic selection support.
|
|
+/* Generic selection (ISO C11) is a C-only feature, available in GCC
|
|
+ since version 4.9. Previous versions do not provide generic
|
|
+ selection, even though they might set __STDC_VERSION__ to 201112L,
|
|
+ when in -std=c11 mode. Thus, we must check for !defined __GNUC__
|
|
+ when testing __STDC_VERSION__ for generic selection support.
|
|
On the other hand, Clang also defines __GNUC__, so a clang-specific
|
|
check is required to enable the use of generic selection. */
|
|
-#if __GNUC_PREREQ (4, 9) \
|
|
- || __glibc_clang_has_extension (c_generic_selections) \
|
|
- || (!defined __GNUC__ && defined __STDC_VERSION__ \
|
|
- && __STDC_VERSION__ >= 201112L)
|
|
+#if !defined __cplusplus \
|
|
+ && (__GNUC_PREREQ (4, 9) \
|
|
+ || __glibc_clang_has_extension (c_generic_selections) \
|
|
+ || (!defined __GNUC__ && defined __STDC_VERSION__ \
|
|
+ && __STDC_VERSION__ >= 201112L))
|
|
# define __HAVE_GENERIC_SELECTION 1
|
|
#else
|
|
# define __HAVE_GENERIC_SELECTION 0
|