diff options
author | mikhnenko <[email protected]> | 2025-09-10 08:30:27 +0300 |
---|---|---|
committer | mikhnenko <[email protected]> | 2025-09-10 08:49:16 +0300 |
commit | 2da7a2f68603364c748131cbd9ce78e53795fc7b (patch) | |
tree | aa0638231a7ce0d29b7a32c5b7fa737585a2cfab /contrib/libs/cxxsupp/libcxx | |
parent | a4ea9cdc4305504b097dfa8d5d61cda5276cc0c2 (diff) |
Make compatible libcxx with cuda+clang20
commit_hash:853db31a401cf9e6e76a5edb00bfb6fcc8230707
Diffstat (limited to 'contrib/libs/cxxsupp/libcxx')
6 files changed, 51 insertions, 36 deletions
diff --git a/contrib/libs/cxxsupp/libcxx/include/__assertion_handler b/contrib/libs/cxxsupp/libcxx/include/__assertion_handler index e12ccccdaff..7fe21c2d1ab 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__assertion_handler +++ b/contrib/libs/cxxsupp/libcxx/include/__assertion_handler @@ -23,7 +23,7 @@ #else -# if __has_builtin(__builtin_verbose_trap) +# if __has_builtin(__builtin_verbose_trap) && !defined(__CUDACC__) // AppleClang shipped a slightly different version of __builtin_verbose_trap from the upstream // version before upstream Clang actually got the builtin. // TODO: Remove once AppleClang supports the two-arguments version of the builtin. diff --git a/contrib/libs/cxxsupp/libcxx/include/__bit/countl.h b/contrib/libs/cxxsupp/libcxx/include/__bit/countl.h index bb09e8e5b58..7b3dd54895f 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__bit/countl.h +++ b/contrib/libs/cxxsupp/libcxx/include/__bit/countl.h @@ -41,7 +41,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD #ifndef _LIBCPP_HAS_NO_INT128 inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(__uint128_t __x) _NOEXCEPT { -# if __has_builtin(__builtin_clzg) +# if __has_builtin(__builtin_clzg) && !defined(__CUDACC__) return __builtin_clzg(__x); # else // The function is written in this form due to C++ constexpr limitations. @@ -62,7 +62,7 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(__uint128_t __x) template <class _Tp> _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __countl_zero(_Tp __t) _NOEXCEPT { static_assert(__libcpp_is_unsigned_integer<_Tp>::value, "__countl_zero requires an unsigned integer type"); -#if __has_builtin(__builtin_clzg) +#if __has_builtin(__builtin_clzg) && !defined(__CUDACC__) return __builtin_clzg(__t, numeric_limits<_Tp>::digits); #else // __has_builtin(__builtin_clzg) if (__t == 0) diff --git a/contrib/libs/cxxsupp/libcxx/include/__bit/countr.h b/contrib/libs/cxxsupp/libcxx/include/__bit/countr.h index 2f7571133bd..c54e328f41a 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__bit/countr.h +++ b/contrib/libs/cxxsupp/libcxx/include/__bit/countr.h @@ -40,7 +40,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD template <class _Tp> [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 int __countr_zero(_Tp __t) _NOEXCEPT { -#if __has_builtin(__builtin_ctzg) +#if __has_builtin(__builtin_ctzg) && !defined(__CUDACC__) return __builtin_ctzg(__t, numeric_limits<_Tp>::digits); #else // __has_builtin(__builtin_ctzg) if (__t == 0) diff --git a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_convertible.h b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_convertible.h index bfc5a94cbad..e36fbf809fc 100644 --- a/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_convertible.h +++ b/contrib/libs/cxxsupp/libcxx/include/__type_traits/is_nothrow_convertible.h @@ -26,7 +26,7 @@ _LIBCPP_BEGIN_NAMESPACE_STD #if _LIBCPP_STD_VER >= 20 -# if __has_builtin(__is_nothrow_convertible) +# if __has_builtin(__is_nothrow_convertible) && !defined(__CUDACC__) template <class _Tp, class _Up> struct is_nothrow_convertible : bool_constant<__is_nothrow_convertible(_Tp, _Up)> {}; diff --git a/contrib/libs/cxxsupp/libcxx/patches/70-auto-cuda.sh b/contrib/libs/cxxsupp/libcxx/patches/70-auto-cuda.sh new file mode 100644 index 00000000000..654ffe882f6 --- /dev/null +++ b/contrib/libs/cxxsupp/libcxx/patches/70-auto-cuda.sh @@ -0,0 +1,46 @@ +set -xue + +replace_has_builtin_in() +{ + sed 's/if __has_builtin('${1}')/if __has_builtin('${1}') \&\& !defined(__CUDACC__)/g' -i include/${2} +} + +replace_has_extension_in() +{ + sed 's/if __has_extension('${1}')/if __has_extension('${1}') \&\& !defined(__CUDACC__)/g' -i include/${2} +} + +replace_has_builtin_in_type_traits() +{ + replace_has_builtin_in ${1} __type_traits/${2} +} + +replace_has_extension_in_type_traits() +{ + replace_has_extension_in ${1} __type_traits/${2} +} + +replace_has_builtin_in_type_traits __array_extent extent.h +replace_has_builtin_in_type_traits __is_compound is_compound.h +replace_has_builtin_in_type_traits __is_const is_const.h +replace_has_builtin_in_type_traits __is_destructible is_destructible.h +replace_has_builtin_in_type_traits __is_function is_function.h +replace_has_builtin_in_type_traits __is_fundamental is_fundamental.h +replace_has_builtin_in_type_traits __is_integral is_integral.h +replace_has_builtin_in_type_traits __is_member_pointer is_member_pointer.h +replace_has_builtin_in_type_traits __is_nothrow_convertible is_nothrow_convertible.h +replace_has_builtin_in_type_traits __is_object is_object.h +replace_has_builtin_in_type_traits __is_pointer is_pointer.h +replace_has_builtin_in_type_traits __is_scalar is_scalar.h +replace_has_builtin_in_type_traits __is_signed is_signed.h +replace_has_builtin_in_type_traits __is_trivially_destructible is_trivially_destructible.h +replace_has_builtin_in_type_traits __is_trivially_relocatable is_trivially_relocatable.h +replace_has_builtin_in_type_traits __is_unsigned is_unsigned.h +replace_has_builtin_in_type_traits __is_void is_void.h +replace_has_builtin_in_type_traits __is_volatile is_volatile.h + +replace_has_builtin_in __builtin_verbose_trap __assertion_handler +replace_has_builtin_in __builtin_clzg __bit/countl.h +replace_has_builtin_in __builtin_ctzg __bit/countr.h + +replace_has_extension_in_type_traits datasizeof datasizeof.h diff --git a/contrib/libs/cxxsupp/libcxx/patches/70-auto-type-traits.sh b/contrib/libs/cxxsupp/libcxx/patches/70-auto-type-traits.sh deleted file mode 100644 index e35c5b7b79b..00000000000 --- a/contrib/libs/cxxsupp/libcxx/patches/70-auto-type-traits.sh +++ /dev/null @@ -1,31 +0,0 @@ -replace_has_builtin_in() -{ - sed 's/#if __has_builtin('${1}')/#if __has_builtin('${1}') \&\& !defined(__CUDACC__)/g' -i include/__type_traits/${2} -} - -replace_has_extension_in() -{ - sed 's/#if __has_extension('${1}')/#if __has_extension('${1}') \&\& !defined(__CUDACC__)/g' -i include/__type_traits/${2} -} - -replace_has_builtin_in __array_extent extent.h -replace_has_builtin_in __is_compound is_compound.h -replace_has_builtin_in __is_const is_const.h -replace_has_builtin_in __is_destructible is_destructible.h -replace_has_builtin_in __is_function is_function.h -replace_has_builtin_in __is_fundamental is_fundamental.h -replace_has_builtin_in __is_integral is_integral.h -replace_has_builtin_in __is_member_function_pointer is_member_function_pointer.h -replace_has_builtin_in __is_member_object_pointer is_member_object_pointer.h -replace_has_builtin_in __is_member_pointer is_member_pointer.h -replace_has_builtin_in __is_object is_object.h -replace_has_builtin_in __is_pointer is_pointer.h -replace_has_builtin_in __is_scalar is_scalar.h -replace_has_builtin_in __is_signed is_signed.h -replace_has_builtin_in __is_trivially_destructible is_trivially_destructible.h -replace_has_builtin_in __is_unsigned is_unsigned.h -replace_has_builtin_in __is_void is_void.h -replace_has_builtin_in __is_volatile is_volatile.h -replace_has_builtin_in __is_trivially_relocatable is_trivially_relocatable.h - -replace_has_extension_in datasizeof datasizeof.h |