From: Jonathan Wakely Date: Wed, 19 Apr 2017 10:49:12 +0000 (+0100) Subject: PR libstdc++/80446 cope with libc defining __has_builtin X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=afa56c175189e994a2dc6d31e44120f05efe1690;p=gcc.git PR libstdc++/80446 cope with libc defining __has_builtin PR libstdc++/80446 * include/std/type_traits (is_aggregate): Change __has_builtin checks. * libsupc++/new (launder): Likewise. From-SVN: r246992 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index 503f2341102..3d0561ba36e 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,9 @@ +2017-04-19 Jonathan Wakely + + PR libstdc++/80446 + * include/std/type_traits (is_aggregate): Change __has_builtin checks. + * libsupc++/new (launder): Likewise. + 2017-04-18 Jonathan Wakely * include/std/functional (default_searcher, __boyer_moore_array_base) diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 8ea280125e6..aac7cff6cf6 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -3062,14 +3062,16 @@ template #endif #undef _GLIBCXX_NO_BUILTIN_HAS_UNIQ_OBJ_REP -#ifdef __has_builtin -# if !__has_builtin(__is_aggregate) -// Try not to break non-GNU compilers that don't support the built-in: -# define _GLIBCXX_NO_BUILTIN_IS_AGGREGATE 1 +#if __GNUC__ >= 7 +# define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1 +#elif defined __has_builtin +// For non-GNU compilers: +# if __has_builtin(__is_aggregate) +# define _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE 1 # endif #endif -#ifndef _GLIBCXX_NO_BUILTIN_IS_AGGREGATE +#ifdef _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE #define __cpp_lib_is_aggregate 201703 /// is_aggregate template @@ -3080,7 +3082,7 @@ template template inline constexpr bool is_aggregate_v = is_aggregate<_Tp>::value; #endif -#undef _GLIBCXX_NO_BUILTIN_IS_AGGREGATE +#undef _GLIBCXX_HAVE_BUILTIN_IS_AGGREGATE #endif // C++17 diff --git a/libstdc++-v3/libsupc++/new b/libstdc++-v3/libsupc++/new index 9a7859dc2b1..2de77525c21 100644 --- a/libstdc++-v3/libsupc++/new +++ b/libstdc++-v3/libsupc++/new @@ -177,14 +177,16 @@ inline void operator delete[](void*, void*) _GLIBCXX_USE_NOEXCEPT { } } // extern "C++" #if __cplusplus > 201402L -#ifdef __has_builtin -# if !__has_builtin(__builtin_launder) -// Try not to break non-GNU compilers that don't support the built-in: -# define _GLIBCXX_NO_BUILTIN_LAUNDER 1 +#if __GNUC__ >= 7 +# define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1 +#elif defined __has_builtin +// For non-GNU compilers: +# if __has_builtin(__builtin_launder) +# define _GLIBCXX_HAVE_BUILTIN_LAUNDER 1 # endif #endif -#ifndef _GLIBCXX_NO_BUILTIN_LAUNDER +#ifdef _GLIBCXX_HAVE_BUILTIN_LAUNDER namespace std { #define __cpp_lib_launder 201606 @@ -208,7 +210,7 @@ namespace std void launder(const volatile void*) = delete; } #endif // _GLIBCXX_NO_BUILTIN_LAUNDER -#undef _GLIBCXX_NO_BUILTIN_LAUNDER +#undef _GLIBCXX_HAVE_BUILTIN_LAUNDER #endif // C++17 #pragma GCC visibility pop