]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Do not use __builtin_types_compatible_p in C++ mode (bug 21930)
authorGabriel F. T. Gomes <gftg@linux.vnet.ibm.com>
Mon, 21 Aug 2017 12:23:27 +0000 (14:23 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Mon, 21 Aug 2017 12:23:27 +0000 (14:23 +0200)
The logic to define isinf for float128 depends on the availability of
__builtin_types_compatible_p, which is only available in C mode,
however, the conditionals do not check for C or C++ mode.  This lead to
an error in libstdc++ configure, as reported by bug 21930.

This patch adds a conditional for C mode in the definition of isinf for
float128.  No definition is provided in C++ mode, since libstdc++
headers undefine isinf.

Tested for powerpc64le (glibc test suite and libstdc++-v3 configure).

[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.

(cherry picked from commit 47a67213a9f51c5f8816d240500b10db605d8b77)

ChangeLog
NEWS
math/math.h

index 6886cd9361d610dc6b42cada5454d1289503fab4..415fa3cc79f89b04733af368718d38c18e274fc0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+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-10  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>
 
        [BZ #21941]
diff --git a/NEWS b/NEWS
index d57c4052cf1775f598b01de2372dc372d7236173..75b82c899e4fb0695bfafaffa14a69d28558d51b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,7 @@ The following bugs are resolved with this release:
 
   [21242] assert: Suppress pedantic warning caused by statement expression
   [21885] getaddrinfo: Release resolver context on error in gethosts
+  [21930] Do not use __builtin_types_compatible_p in C++ mode
   [21932] Unpaired __resolv_context_get in generic get*_r implementation
 \f
 Version 2.26
index e21708045a83dbd358e79964a2f1ed9d79fc1ede..dea8dbe1ae486410394150867a59ad99af837ed9 100644 (file)
@@ -442,8 +442,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))