]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix preprocessor checks for Clang builtins
authorJonathan Wakely <jwakely@redhat.com>
Wed, 3 Jul 2019 21:09:08 +0000 (22:09 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Wed, 3 Jul 2019 21:09:08 +0000 (22:09 +0100)
Clang seems to define built-ins that start with "__builtin_" as
non-keywords, which means that we need to use __has_builtin to detect
them, not __is_identifier. The built-ins that don't start with
"__builtin_" are keywords, and can only be detected using
__is_identifier and not by __has_builtin.

Backport from mainline
2019-07-02  Jonathan Wakely  <jwakely@redhat.com>

* include/bits/c++config (_GLIBCXX_HAVE_BUILTIN_LAUNDER)
(_GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED): Use __has_builtin
instead of __is_identifier to detect Clang support.

From-SVN: r273024

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/c++config

index 1ca540f3ede55ccc5c920feb6d5ab8a8f95a52d8..147ac95b390571e24570ee716f3255dedaad7256 100644 (file)
@@ -1,3 +1,12 @@
+2019-07-03  Jonathan Wakely  <jwakely@redhat.com>
+
+       Backport from mainline
+       2019-07-02  Jonathan Wakely  <jwakely@redhat.com>
+
+       * include/bits/c++config (_GLIBCXX_HAVE_BUILTIN_LAUNDER)
+       (_GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED): Use __has_builtin
+       instead of __is_identifier to detect Clang support.
+
 2019-06-27  Jonathan Wakely  <jwakely@redhat.com>
 
        PR libstdc++/85494 use rand_s in std::random_device
index 5016f4853de308e6c94d62a5ef715d91e1242f79..7a7e78819ba7d27374b86282002b65fecb7df29f 100644 (file)
@@ -649,7 +649,7 @@ namespace std
 # if __GNUC__ >= 9
 #  define _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED 1
 # endif
-#elif defined(__is_identifier)
+#elif defined(__is_identifier) && defined(__has_builtin)
 // For non-GNU compilers:
 # if ! __is_identifier(__has_unique_object_representations)
 #  define _GLIBCXX_HAVE_BUILTIN_HAS_UNIQ_OBJ_REP 1
@@ -657,10 +657,10 @@ namespace std
 # if ! __is_identifier(__is_aggregate)
 #  define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1
 # endif
-# if ! __is_identifier(__builtin_launder)
+# if __has_builtin(__builtin_launder)
 #  define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1
 # endif
-# if ! __is_identifier(__builtin_is_constant_evaluated)
+# if __has_builtin(__builtin_is_constant_evaluated)
 #  define _GLIBCXX_HAVE_BUILTIN_IS_CONSTANT_EVALUATED 1
 # endif
 #endif // GCC