Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move _CCCL_COMPILER_GCC to the new macro #2850

Merged
merged 17 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cub/cub/device/dispatch/dispatch_histogram.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ public:
{
// GCC 14 rightfully warns that when a value-initialized array of this struct is copied using memcpy, uninitialized
// bytes may be accessed. To avoid this, we add a dummy member, so value initialization actually initializes the memory.
#if defined(_CCCL_COMPILER_GCC) && __GNUC__ >= 13
#if _CCCL_COMPILER(GCC, >=, 13)
char dummy;
#endif

Expand Down
6 changes: 3 additions & 3 deletions cub/cub/util_compiler.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,11 @@
# define CUB_HOST_COMPILER CUB_HOST_COMPILER_CLANG
//! deprecated [Since 2.7]
# define CUB_CLANG_VERSION _CCCL_CLANG_VERSION
#elif defined(_CCCL_COMPILER_GCC)
#elif _CCCL_COMPILER(GCC)
//! deprecated [Since 2.7]
# define CUB_HOST_COMPILER CUB_HOST_COMPILER_GCC
//! deprecated [Since 2.7]
# define CUB_GCC_VERSION _CCCL_GCC_VERSION
# define CUB_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#endif

// figure out which device compiler we're using
Expand All @@ -92,7 +92,7 @@
#elif defined(_CCCL_COMPILER_MSVC)
//! deprecated [Since 2.7]
# define CUB_DEVICE_COMPILER CUB_DEVICE_COMPILER_MSVC
#elif defined(_CCCL_COMPILER_GCC)
#elif _CCCL_COMPILER(GCC)
//! deprecated [Since 2.7]
# define CUB_DEVICE_COMPILER CUB_DEVICE_COMPILER_GCC
#elif defined(_CCCL_COMPILER_CLANG)
Expand Down
2 changes: 1 addition & 1 deletion cub/cub/util_cpp_dialect.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
# ifndef CUB_IGNORE_DEPRECATED_COMPILER

// Compiler checks:
# if defined(_CCCL_COMPILER_GCC) && _CCCL_GCC_VERSION < 50000
# if _CCCL_COMPILER(GCC, <, 5)
CUB_COMPILER_DEPRECATION(GCC 5.0);
# elif defined(_CCCL_COMPILER_CLANG) && _CCCL_CLANG_VERSION < 70000
CUB_COMPILER_DEPRECATION(Clang 7.0);
Expand Down
2 changes: 1 addition & 1 deletion cub/cub/util_deprecated.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
#elif defined(_CCCL_COMPILER_CLANG)
# define CUB_DEPRECATED __attribute__((deprecated))
# define CUB_DEPRECATED_BECAUSE(MSG) __attribute__((deprecated(MSG)))
#elif defined(_CCCL_COMPILER_GCC)
#elif _CCCL_COMPILER(GCC)
# define CUB_DEPRECATED __attribute__((deprecated))
# define CUB_DEPRECATED_BECAUSE(MSG) __attribute__((deprecated(MSG)))
#else
Expand Down
2 changes: 1 addition & 1 deletion cub/cub/util_type.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ CUB_NAMESPACE_BEGIN
# endif // !defined(__CUDACC_RTC_INT128__)
# else // !defined(__CUDACC_RTC__)
# if _CCCL_CUDACC_AT_LEAST(11, 5)
# if defined(_CCCL_COMPILER_GCC) || defined(_CCCL_COMPILER_CLANG) || _CCCL_COMPILER(ICC) || _CCCL_COMPILER(NVHPC)
# if _CCCL_COMPILER(GCC) || defined(_CCCL_COMPILER_CLANG) || _CCCL_COMPILER(ICC) || _CCCL_COMPILER(NVHPC)
# define CUB_IS_INT128_ENABLED 1
# endif // GCC || CLANG || ICC || NVHPC
# endif // _CCCL_CUDACC_AT_LEAST(11, 5)
Expand Down
6 changes: 3 additions & 3 deletions cudax/include/cuda/experimental/__detail/config.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@
#define _CUDAX_TRIVIAL_DEVICE_API _CUDAX_DEVICE_API _CCCL_FORCEINLINE _CUDAX_ARTIFICIAL _LIBCUDACXX_NODEBUG

// GCC struggles with guaranteed copy elision of immovable types.
#if defined(_CCCL_COMPILER_GCC)
#if _CCCL_COMPILER(GCC)
# define _CUDAX_IMMOVABLE(_XP) _XP(_XP&&)
#else // ^^^ _CCCL_COMPILER_GCC ^^^ / vvv !_CCCL_COMPILER_GCC vvv
#else // ^^^ _CCCL_COMPILER(GCC) ^^^ / vvv !_CCCL_COMPILER(GCC) vvv
# define _CUDAX_IMMOVABLE(_XP) _XP(_XP&&) = delete
#endif // !_CCCL_COMPILER_GCC
#endif // !_CCCL_COMPILER(GCC)

namespace cuda::experimental
{
Expand Down
2 changes: 1 addition & 1 deletion libcudacxx/include/cuda/__memcpy_async/memcpy_async_tx.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ _CCCL_DEVICE inline async_contract_fulfillment memcpy_async_tx(
// incorrectly classified as not trivially copyable. Remove this assertion to allow for their usage with
// memcpy_async when compiling with GCC 4.8.
// FIXME: remove the #if once GCC 4.8 is no longer supported.
# if !defined(_CCCL_COMPILER_GCC) || _GNUC_VER > 408
# if !_CCCL_COMPILER(GCC) || _CCCL_COMPILER(GCC, >, 4, 8)
static_assert(_CUDA_VSTD::is_trivially_copyable<_Tp>::value, "memcpy_async_tx requires a trivially copyable type");
# endif
static_assert(16 <= _Alignment, "mempcy_async_tx expects arguments to be at least 16 byte aligned.");
Expand Down
2 changes: 1 addition & 1 deletion libcudacxx/include/cuda/std/__algorithm/copy.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 bool __dispatch_memmove(_Up* __r
// This is a pessimisation, but there's no way to do the code path detection correctly before GCC 9.0.
// __builtin_memmove is also illegal in constexpr there, so... just always assume we are constant evaluated,
// and let the optimizer *maybe* recover some of the perf.
#if defined(_CCCL_COMPILER_GCC) && _GNUC_VER < 900
#if _CCCL_COMPILER(GCC, <, 9)
return false;
#endif

Expand Down
2 changes: 1 addition & 1 deletion libcudacxx/include/cuda/std/__atomic/types/base.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct __atomic_storage
using __underlying_t = _Tp;
static constexpr __atomic_tag __tag = __atomic_tag::__atomic_base_tag;

#if !defined(_CCCL_COMPILER_GCC) || (__GNUC__ >= 5)
#if !_CCCL_COMPILER(GCC) || _CCCL_COMPILER(GCC, >=, 5)
static_assert(_CCCL_TRAIT(is_trivially_copyable, _Tp),
"std::atomic<Tp> requires that 'Tp' be a trivially copyable type");
#endif
Expand Down
2 changes: 1 addition & 1 deletion libcudacxx/include/cuda/std/__atomic/types/reference.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ struct __atomic_ref_storage
using __underlying_t = _Tp;
static constexpr __atomic_tag __tag = __atomic_tag::__atomic_base_tag;

#if !defined(_CCCL_COMPILER_GCC) || (__GNUC__ >= 5)
#if !_CCCL_COMPILER(GCC) || _CCCL_COMPILER(GCC, >=, 5)
static_assert(_CCCL_TRAIT(is_trivially_copyable, _Tp),
"std::atomic_ref<Tp> requires that 'Tp' be a trivially copyable type");
#endif
Expand Down
8 changes: 4 additions & 4 deletions libcudacxx/include/cuda/std/__bit/bit_cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ _LIBCUDACXX_BEGIN_NAMESPACE_STD
# define _LIBCUDACXX_CONSTEXPR_BIT_CAST constexpr
#else // ^^^ _CCCL_BUILTIN_BIT_CAST ^^^ / vvv !_CCCL_BUILTIN_BIT_CAST vvv
# define _LIBCUDACXX_CONSTEXPR_BIT_CAST
# if defined(_CCCL_COMPILER_GCC) && __GNUC__ >= 8
# if _CCCL_COMPILER(GCC, >=, 8)
// GCC starting with GCC8 warns about our extended floating point types having protected data members
_CCCL_DIAG_PUSH
_CCCL_DIAG_SUPPRESS_GCC("-Wclass-memaccess")
# endif // _CCCL_COMPILER_GCC >= 8
# endif // _CCCL_COMPILER(GCC, >=, 8)
#endif // !_CCCL_BUILTIN_BIT_CAST

template <
Expand All @@ -61,9 +61,9 @@ _CCCL_NODISCARD _LIBCUDACXX_HIDE_FROM_ABI _LIBCUDACXX_CONSTEXPR_BIT_CAST _To bit
}

#if !defined(_CCCL_BUILTIN_BIT_CAST)
# if defined(_CCCL_COMPILER_GCC) && __GNUC__ >= 8
# if _CCCL_COMPILER(GCC, >=, 8)
_CCCL_DIAG_POP
# endif // _CCCL_COMPILER_GCC >= 8
# endif // _CCCL_COMPILER(GCC, >=, 8)
#endif // !_CCCL_BUILTIN_BIT_CAST

_LIBCUDACXX_END_NAMESPACE_STD
Expand Down
8 changes: 4 additions & 4 deletions libcudacxx/include/cuda/std/__bit/reference.h
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 __bit_iterator<_Cp, false> __cop
if (__n > 0)
{
__storage_type __m = ~__storage_type(0) << (__bits_per_word - __n);
#if defined(_CCCL_COMPILER_GCC) && _GNUC_VER < 900
#if _CCCL_COMPILER(GCC, <, 9)
// workaround for GCC pre-9 being really bad at tracking one-past-the-end pointers at constexpr
// can't check for is-constant-evaluated, because GCC pre-9 also lacks _that_.
if (__last.__seg_ == __first.__seg_ + 1)
Expand All @@ -461,7 +461,7 @@ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 __bit_iterator<_Cp, false> __cop
--__last.__seg_;
#endif // !GCC || GCC >= 9
__storage_type __b = *__last.__seg_ & __m;
#if defined(_CCCL_COMPILER_GCC) && _GNUC_VER < 900
#if _CCCL_COMPILER(GCC, <, 9)
// workaround for GCC pre-9 being really bad at tracking one-past-the-end pointers at constexpr
// can't check for is-constant-evaluated, because GCC pre-9 also lacks _that_.
if (__result.__seg_ == __first.__seg_ + 1)
Expand Down Expand Up @@ -527,7 +527,7 @@ _LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 __bit_iterator<_Cp, false> __cop
if (__dn > 0)
{
// __result.__ctz_ == 0
#if defined(_CCCL_COMPILER_GCC) && _GNUC_VER < 900
#if _CCCL_COMPILER(GCC, <, 9)
// workaround for GCC pre-9 being really bad at tracking one-past-the-end pointers at constexpr
// can't check for is-constant-evaluated, because GCC pre-9 also lacks _that_.
if (__result.__seg_ == __first.__seg_ + 1)
Expand Down Expand Up @@ -1166,7 +1166,7 @@ class __bit_iterator
_LIBCUDACXX_HIDE_FROM_ABI _CCCL_CONSTEXPR_CXX14 friend difference_type
operator-(const __bit_iterator& __x, const __bit_iterator& __y)
{
#if defined(_CCCL_COMPILER_GCC) && _GNUC_VER >= 800 && _GNUC_VER < 900
#if _CCCL_COMPILER(GCC, >=, 8) && _CCCL_COMPILER(GCC, <, 9)
if (__y.__seg_ && __y.__seg_ != __x.__seg_)
{
return (__x.__seg_ == __y.__seg_ + 1 ? 1 : __x.__seg_ - __y.__seg_) * __bits_per_word + __x.__ctz_ - __y.__ctz_;
Expand Down
2 changes: 1 addition & 1 deletion libcudacxx/include/cuda/std/__cccl/attributes.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
# define _CCCL_FALLTHROUGH() [[clang::fallthrough]]
#elif _CCCL_COMPILER(NVHPC)
# define _CCCL_FALLTHROUGH()
#elif _CCCL_HAS_ATTRIBUTE(fallthough) || _GNUC_VER >= 700
#elif _CCCL_HAS_ATTRIBUTE(fallthough) || _CCCL_COMPILER(GCC, >=, 7)
# define _CCCL_FALLTHROUGH() __attribute__((__fallthrough__))
#else
# define _CCCL_FALLTHROUGH() ((void) 0)
Expand Down
Loading
Loading