Skip to content

Commit

Permalink
abide by CCCL config macro naming conventions
Browse files Browse the repository at this point in the history
  • Loading branch information
ericniebler committed Oct 28, 2024
1 parent 8f1691d commit 87b9b6b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions libcudacxx/include/cuda/std/__cccl/builtin.h
Original file line number Diff line number Diff line change
Expand Up @@ -510,20 +510,20 @@

#if defined(_CCCL_COMPILER_MSVC)
# if _CCCL_MSVC_VERSION >= 1935
# define _CCCL_PRETTY_FUNCTION __builtin_FUNCSIG()
# define _CCCL_BUILTIN_PRETTY_FUNCTION() __builtin_FUNCSIG()
# else // ^^^ _CCCL_MSVC_VERSION >= 1935 ^^^ / vvv _CCCL_MSVC_VERSION < 1935 vvv
# define _CCCL_PRETTY_FUNCTION __FUNCSIG__
# define _CCCL_BUILTIN_PRETTY_FUNCTION() __FUNCSIG__
# endif // _CCCL_MSVC_VERSION < 1935
#else // ^^^ _CCCL_COMPILER_MSVC ^^^ / vvv !_CCCL_COMPILER_MSVC vvv
# define _CCCL_PRETTY_FUNCTION __PRETTY_FUNCTION__
# define _CCCL_BUILTIN_PRETTY_FUNCTION() __PRETTY_FUNCTION__
#endif // !_CCCL_COMPILER_MSVC

// GCC's builtin_strlen isn't reliable at constexpr time
// MSVC does not expose builtin_strlen before C++17
// NVRTC does not expose builtin_strlen
#if defined(_CCCL_COMPILER_GCC) || defined(_CCCL_COMPILER_NVRTC) \
|| (defined(_CCCL_COMPILER_MSVC) && _CCCL_STD_VER < 2017)
# define _CCCL_HAS_NO_BUILTIN_STRLEN
#if !defined(_CCCL_COMPILER_GCC) && !defined(_CCCL_COMPILER_NVRTC) \
&& !(defined(_CCCL_COMPILER_MSVC) && _CCCL_STD_VER < 2017)
# define _CCCL_BUILTIN_STRLEN(...) __builtin_strlen(__VA_ARGS__)
#endif

#endif // __CCCL_BUILTIN_H
6 changes: 3 additions & 3 deletions libcudacxx/include/cuda/std/__string/string_view.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,10 +294,10 @@ struct __string_view

_CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI static constexpr size_t __strlen_(char const* __str) noexcept
{
#ifndef _CCCL_HAS_NO_BUILTIN_STRLEN
return __builtin_strlen(__str);
#ifdef _CCCL_BUILTIN_STRLEN
return _CCCL_BUILTIN_STRLEN(__str);
#elif _CCCL_STD_VER >= 2014
return std::char_traits<char>::length(__str);
return _CUDA_VSTD::char_traits<char>::length(__str);
#else
return __strlen_0x_(__str, 0);
#endif
Expand Down
6 changes: 3 additions & 3 deletions libcudacxx/include/cuda/std/__utility/typeid.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,15 @@ template <class _Tp, size_t _Np>
_CCCL_HIDE_FROM_ABI _CCCL_HOST_DEVICE constexpr auto __make_pretty_name(integral_constant<size_t, _Np>) noexcept //
-> __enable_if_t<_Np == size_t(-1), __string_view>
{
using _TpName = __static_nameof<_Tp, sizeof(_CCCL_PRETTY_FUNCTION)>;
using _TpName = __static_nameof<_Tp, sizeof(_CCCL_BUILTIN_PRETTY_FUNCTION())>;
return __string_view(_TpName::value.__str_, _TpName::value.__len_);
}

template <class _Tp, size_t _Np>
_CCCL_HIDE_FROM_ABI _CCCL_HOST_DEVICE constexpr auto __make_pretty_name(integral_constant<size_t, _Np>) noexcept //
-> __enable_if_t<_Np != size_t(-1), __sstring<_Np>>
{
return _CUDA_VSTD::__make_pretty_name_impl<_Np>(_CCCL_PRETTY_FUNCTION, make_index_sequence<_Np>{});
return _CUDA_VSTD::__make_pretty_name_impl<_Np>(_CCCL_BUILTIN_PRETTY_FUNCTION(), make_index_sequence<_Np>{});
}

// TODO: class statics cannot be accessed from device code, so we need to use
Expand Down Expand Up @@ -177,7 +177,7 @@ _CCCL_NODISCARD _CCCL_HIDE_FROM_ABI _CCCL_HOST_DEVICE constexpr __string_view __
#if defined(_CCCL_COMPILER_GCC) && _CCCL_GCC_VERSION < 90000 && !defined(__CUDA_ARCH__)
return _CUDA_VSTD::__find_pretty_name(_CUDA_VSTD::__make_pretty_name<_Tp>(integral_constant<size_t, size_t(-1)>{}));
#else // ^^^ gcc < 9 ^^^^/ vvv other compiler vvv
return _CUDA_VSTD::__find_pretty_name(_CUDA_VSTD::__string_view(_CCCL_PRETTY_FUNCTION));
return _CUDA_VSTD::__find_pretty_name(_CUDA_VSTD::__string_view(_CCCL_BUILTIN_PRETTY_FUNCTION()));
#endif // not gcc < 9
}

Expand Down

0 comments on commit 87b9b6b

Please sign in to comment.