Message ID | 20170727072715.43fqiep4nawwvzlc@netzach.ktns.kdns.info |
---|---|
State | New |
Headers | show |
On 27/07/17 16:27 +0900, Katsuhiko Nishimra wrote: >From 56c4a18d0d8c8ce7aa1239880138775e4db06645 Mon Sep 17 00:00:00 2001 >From: Katsuhiko Nishimra <ktns.87@gmail.com> >Date: Thu, 27 Jul 2017 16:03:54 +0900 >Subject: [PATCH] libstdc++: Support std::is_aggregate on clang++ > >Currently, libstdc++ tries to detect __is_aggregate built-in macro using >__has_builtin, but this fails on clang++ because __has_builtin on >clang++ detects only built-in functions, not built-in macros. This patch >adds a test using __is_identifier. Tested on clang++ >5.0.0-svn308422-1~exp1 and g++ 7.1.0-10 from Debian unstable. >--- > libstdc++-v3/include/std/type_traits | 5 +++++ > 1 file changed, 5 insertions(+) > >diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits >index 390b6f40a..e7ec402fb 100644 >--- a/libstdc++-v3/include/std/type_traits >+++ b/libstdc++-v3/include/std/type_traits >@@ -2894,6 +2894,11 @@ template <typename _From, typename _To> > > #if __GNUC__ >= 7 > # define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1 >+#elif defined(__is_identifier) >+// For clang >+# if ! __is_identifier(__is_aggregate) >+# define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1 >+# endif > #elif defined __has_builtin > // For non-GNU compilers: > # if __has_builtin(__is_aggregate) This __has_bultin check only exists for Clang, so should be replaced by the correct __is_identifier check, not left there in addition to it.
On Mon, Jul 31, 2017 at 10:53 AM, Jonathan Wakely <jwakely@redhat.com> wrote: > On 27/07/17 16:27 +0900, Katsuhiko Nishimra wrote: >> >> From 56c4a18d0d8c8ce7aa1239880138775e4db06645 Mon Sep 17 00:00:00 2001 >> From: Katsuhiko Nishimra <ktns.87@gmail.com> >> Date: Thu, 27 Jul 2017 16:03:54 +0900 >> Subject: [PATCH] libstdc++: Support std::is_aggregate on clang++ >> >> Currently, libstdc++ tries to detect __is_aggregate built-in macro using >> __has_builtin, but this fails on clang++ because __has_builtin on >> clang++ detects only built-in functions, not built-in macros. This patch >> adds a test using __is_identifier. Tested on clang++ >> 5.0.0-svn308422-1~exp1 and g++ 7.1.0-10 from Debian unstable. >> --- >> libstdc++-v3/include/std/type_traits | 5 +++++ >> 1 file changed, 5 insertions(+) >> >> diff --git a/libstdc++-v3/include/std/type_traits >> b/libstdc++-v3/include/std/type_traits >> index 390b6f40a..e7ec402fb 100644 >> --- a/libstdc++-v3/include/std/type_traits >> +++ b/libstdc++-v3/include/std/type_traits >> @@ -2894,6 +2894,11 @@ template <typename _From, typename _To> >> >> #if __GNUC__ >= 7 >> # define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1 >> +#elif defined(__is_identifier) >> +// For clang >> +# if ! __is_identifier(__is_aggregate) >> +# define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1 >> +# endif >> #elif defined __has_builtin >> // For non-GNU compilers: >> # if __has_builtin(__is_aggregate) > > > This __has_bultin check only exists for Clang, so should be replaced > by the correct __is_identifier check, not left there in addition to > it. > > https://clang.llvm.org/docs/LanguageExtensions.html#checks-for-type-trait-primitives seems to suggest using __has_extension instead.
On Mon, Jul 31, 2017 at 11:13 AM, Tim Song <t.canens.cpp@gmail.com> wrote: > > https://clang.llvm.org/docs/LanguageExtensions.html#checks-for-type-trait-primitives > seems to suggest using __has_extension instead. Hmm, that doesn't work. Oh well.
diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 390b6f40a..e7ec402fb 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -2894,6 +2894,11 @@ template <typename _From, typename _To> #if __GNUC__ >= 7 # define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1 +#elif defined(__is_identifier) +// For clang +# if ! __is_identifier(__is_aggregate) +# define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1 +# endif #elif defined __has_builtin // For non-GNU compilers: # if __has_builtin(__is_aggregate)
From 56c4a18d0d8c8ce7aa1239880138775e4db06645 Mon Sep 17 00:00:00 2001 From: Katsuhiko Nishimra <ktns.87@gmail.com> Date: Thu, 27 Jul 2017 16:03:54 +0900 Subject: [PATCH] libstdc++: Support std::is_aggregate on clang++ Currently, libstdc++ tries to detect __is_aggregate built-in macro using __has_builtin, but this fails on clang++ because __has_builtin on clang++ detects only built-in functions, not built-in macros. This patch adds a test using __is_identifier. Tested on clang++ 5.0.0-svn308422-1~exp1 and g++ 7.1.0-10 from Debian unstable. --- libstdc++-v3/include/std/type_traits | 5 +++++ 1 file changed, 5 insertions(+)