diff --git a/.clang-format b/.clang-format index d081c43b21..8466a34fa2 100644 --- a/.clang-format +++ b/.clang-format @@ -39,6 +39,8 @@ AttributeMacros: [ '_CCCL_NODISCARD_FRIEND', '_CCCL_NODISCARD', '_CCCL_NORETURN', + '_CCCL_DEPRECATED', + '_CCCL_DEPRECATED_BECAUSE', '_CCCL_TYPE_VISIBILITY_DEFAULT', '_CCCL_VISIBILITY_HIDDEN', 'CUB_RUNTIME_FUNCTION', diff --git a/cub/cub/util_deprecated.cuh b/cub/cub/util_deprecated.cuh index c227d4309b..144694f397 100644 --- a/cub/cub/util_deprecated.cuh +++ b/cub/cub/util_deprecated.cuh @@ -50,23 +50,8 @@ #endif #ifdef CUB_IGNORE_DEPRECATED_API -# define CUB_DEPRECATED -# define CUB_DEPRECATED_BECAUSE(MSG) -#elif _CCCL_STD_VER >= 2014 -# define CUB_DEPRECATED [[deprecated]] -# define CUB_DEPRECATED_BECAUSE(MSG) [[deprecated(MSG)]] -#elif _CCCL_COMPILER(MSVC) -# define CUB_DEPRECATED __declspec(deprecated) -# define CUB_DEPRECATED_BECAUSE(MSG) __declspec(deprecated(MSG)) -#elif _CCCL_COMPILER(CLANG) -# define CUB_DEPRECATED __attribute__((deprecated)) -# define CUB_DEPRECATED_BECAUSE(MSG) __attribute__((deprecated(MSG))) -#elif _CCCL_COMPILER(GCC) -# define CUB_DEPRECATED __attribute__((deprecated)) -# define CUB_DEPRECATED_BECAUSE(MSG) __attribute__((deprecated(MSG))) -#else -# define CUB_DEPRECATED -# define CUB_DEPRECATED_BECAUSE(MSG) +# define CUB_DEPRECATED _CCCL_DEPRECATED +# define CUB_DEPRECATED_BECAUSE(MSG) _CCCL_DEPRECATED_BECAUSE(MSG) #endif #define CUB_DETAIL_RUNTIME_DEBUG_SYNC_IS_NOT_SUPPORTED \ diff --git a/libcudacxx/include/cuda/std/__cccl/attributes.h b/libcudacxx/include/cuda/std/__cccl/attributes.h index 0ed5fdd2b7..aa777ff1ae 100644 --- a/libcudacxx/include/cuda/std/__cccl/attributes.h +++ b/libcudacxx/include/cuda/std/__cccl/attributes.h @@ -115,4 +115,18 @@ # define _CCCL_RESTRICT __restrict__ #endif // ^^^ !_CCCL_COMPILER(MSVC) ^^^ +#if _CCCL_STD_VER >= 2014 +# define _CCCL_DEPRECATED [[deprecated]] +# define _CCCL_DEPRECATED_BECAUSE(_MSG) [[deprecated(_MSG)]] +#elif _CCCL_COMPILER(MSVC) +# define _CCCL_DEPRECATED __declspec(deprecated) +# define _CCCL_DEPRECATED_BECAUSE(_MSG) __declspec(deprecated(_MSG)) +#else _CCCL_COMPILER(GCC) || _CCCL_COMPILER(CLANG) || _CCCL_COMPILER(NVHPC) || _CCCL_COMPILER(ICC) +# define _CCCL_DEPRECATED __attribute__((deprecated)) +# define _CCCL_DEPRECATED_BECAUSE(_MSG) __attribute__((deprecated(_MSG))) +#else +# define _CCCL_DEPRECATED +# define _CCCL_DEPRECATED_BECAUSE(_MSG) +#endif + #endif // __CCCL_ATTRIBUTES_H diff --git a/libcudacxx/include/cuda/std/detail/libcxx/include/__config b/libcudacxx/include/cuda/std/detail/libcxx/include/__config index 2944ef6d4c..c1e8a374e0 100644 --- a/libcudacxx/include/cuda/std/detail/libcxx/include/__config +++ b/libcudacxx/include/cuda/std/detail/libcxx/include/__config @@ -630,13 +630,7 @@ typedef unsigned int char32_t; // by defining _LIBCUDACXX_DISABLE_DEPRECATION_WARNINGS. // NVCC 11.1 and 11.2 are broken with the deprecated attribute, so disable it # if !defined(_LIBCUDACXX_DISABLE_DEPRECATION_WARNINGS) && _CCCL_CUDACC_AT_LEAST(11, 3) -# if _CCCL_HAS_ATTRIBUTE(deprecated) -# define _LIBCUDACXX_DEPRECATED __attribute__((deprecated)) -# elif _CCCL_STD_VER > 2011 -# define _LIBCUDACXX_DEPRECATED [[deprecated]] -# else -# define _LIBCUDACXX_DEPRECATED -# endif +# define _LIBCUDACXX_DEPRECATED _CCCL_DEPRECATED # else # define _LIBCUDACXX_DEPRECATED # endif diff --git a/thrust/thrust/detail/config/deprecated.h b/thrust/thrust/detail/config/deprecated.h index 29204f4928..2c04ab5cf0 100644 --- a/thrust/thrust/detail/config/deprecated.h +++ b/thrust/thrust/detail/config/deprecated.h @@ -40,19 +40,7 @@ #ifdef THRUST_IGNORE_DEPRECATED_API # define THRUST_DEPRECATED # define THRUST_DEPRECATED_BECAUSE(MSG) -#elif _CCCL_STD_VER >= 2014 -# define THRUST_DEPRECATED [[deprecated]] -# define THRUST_DEPRECATED_BECAUSE(MSG) [[deprecated(MSG)]] -#elif _CCCL_COMPILER(MSVC) -# define THRUST_DEPRECATED __declspec(deprecated) -# define THRUST_DEPRECATED_BECAUSE(MSG) __declspec(deprecated(MSG)) -#elif _CCCL_COMPILER(CLANG) -# define THRUST_DEPRECATED __attribute__((deprecated)) -# define THRUST_DEPRECATED_BECAUSE(MSG) __attribute__((deprecated(MSG))) -#elif _CCCL_COMPILER(GCC) -# define THRUST_DEPRECATED __attribute__((deprecated)) -# define THRUST_DEPRECATED_BECAUSE(MSG) __attribute__((deprecated(MSG))) #else -# define THRUST_DEPRECATED -# define THRUST_DEPRECATED_BECAUSE(MSG) +# define THRUST_DEPRECATED _CCCL_DEPRECATED +# define THRUST_DEPRECATED_BECAUSE(MSG) _CCCL_DEPRECATED(MSG) #endif