Skip to content

Commit a9cb38b

Browse files
Deprecate Thrust's cpp_compatibility.h macros
1 parent d58afc7 commit a9cb38b

File tree

17 files changed

+35
-55
lines changed

17 files changed

+35
-55
lines changed

thrust/thrust/async/copy.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ struct copy_fn final
117117

118118
} // namespace copy_detail
119119

120-
THRUST_INLINE_CONSTANT copy_detail::copy_fn copy{};
120+
_CCCL_GLOBAL_CONSTANT copy_detail::copy_fn copy{};
121121

122122
/*! \endcond
123123
*/

thrust/thrust/async/for_each.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ struct for_each_fn final
9494

9595
} // namespace for_each_detail
9696

97-
THRUST_INLINE_CONSTANT for_each_detail::for_each_fn for_each{};
97+
_CCCL_GLOBAL_CONSTANT for_each_detail::for_each_fn for_each{};
9898

9999
/*! \endcond
100100
*/

thrust/thrust/async/reduce.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ struct reduce_fn final
160160

161161
} // namespace reduce_detail
162162

163-
THRUST_INLINE_CONSTANT reduce_detail::reduce_fn reduce{};
163+
_CCCL_GLOBAL_CONSTANT reduce_detail::reduce_fn reduce{};
164164

165165
///////////////////////////////////////////////////////////////////////////////
166166

@@ -296,7 +296,7 @@ struct reduce_into_fn final
296296

297297
} // namespace reduce_into_detail
298298

299-
THRUST_INLINE_CONSTANT reduce_into_detail::reduce_into_fn reduce_into{};
299+
_CCCL_GLOBAL_CONSTANT reduce_into_detail::reduce_into_fn reduce_into{};
300300

301301
/*! \endcond
302302
*/

thrust/thrust/async/scan.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ struct inclusive_scan_fn final
179179

180180
} // namespace inclusive_scan_detail
181181

182-
THRUST_INLINE_CONSTANT inclusive_scan_detail::inclusive_scan_fn inclusive_scan{};
182+
_CCCL_GLOBAL_CONSTANT inclusive_scan_detail::inclusive_scan_fn inclusive_scan{};
183183

184184
namespace exclusive_scan_detail
185185
{
@@ -288,7 +288,7 @@ struct exclusive_scan_fn final
288288

289289
} // namespace exclusive_scan_detail
290290

291-
THRUST_INLINE_CONSTANT exclusive_scan_detail::exclusive_scan_fn exclusive_scan{};
291+
_CCCL_GLOBAL_CONSTANT exclusive_scan_detail::exclusive_scan_fn exclusive_scan{};
292292

293293
} // namespace async
294294

thrust/thrust/async/sort.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ struct stable_sort_fn final
146146

147147
} // namespace stable_sort_detail
148148

149-
THRUST_INLINE_CONSTANT stable_sort_detail::stable_sort_fn stable_sort{};
149+
_CCCL_GLOBAL_CONSTANT stable_sort_detail::stable_sort_fn stable_sort{};
150150

151151
namespace fallback
152152
{
@@ -259,7 +259,7 @@ struct sort_fn final
259259

260260
} // namespace sort_detail
261261

262-
THRUST_INLINE_CONSTANT sort_detail::sort_fn sort{};
262+
_CCCL_GLOBAL_CONSTANT sort_detail::sort_fn sort{};
263263

264264
/*! \endcond
265265
*/

thrust/thrust/async/transform.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ struct transform_fn final
125125

126126
} // namespace transform_detail
127127

128-
THRUST_INLINE_CONSTANT transform_detail::transform_fn transform{};
128+
_CCCL_GLOBAL_CONSTANT transform_detail::transform_fn transform{};
129129

130130
/*! \endcond
131131
*/

thrust/thrust/detail/config/cpp_compatibility.h

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
#pragma once
1818

19-
// Internal config header that is only included through thrust/detail/config/config.h
19+
#include <cuda/__cccl_config>
2020

2121
#if defined(_CCCL_IMPLICIT_SYSTEM_HEADER_GCC)
2222
# pragma GCC system_header
@@ -26,29 +26,9 @@
2626
# pragma system_header
2727
#endif // no system header
2828

29-
#include <thrust/detail/config/cpp_dialect.h> // IWYU pragma: export
30-
31-
#include <cuda/std/cstddef>
32-
29+
// deprecated [Since 2.8.0]
3330
#define THRUST_NODISCARD _CCCL_NODISCARD
34-
35-
// FIXME: Combine THRUST_INLINE_CONSTANT and
36-
// THRUST_INLINE_INTEGRAL_MEMBER_CONSTANT into one macro when NVCC properly
37-
// supports `constexpr` globals in host and device code.
38-
#if defined(__CUDA_ARCH__) || defined(_NVHPC_CUDA)
39-
// FIXME: Add this when NVCC supports inline variables.
40-
// # if _CCCL_STD_VER >= 2017
41-
// # define THRUST_INLINE_CONSTANT inline constexpr
42-
// # define THRUST_INLINE_INTEGRAL_MEMBER_CONSTANT inline constexpr
43-
# define THRUST_INLINE_CONSTANT static const _CCCL_DEVICE
44-
# define THRUST_INLINE_INTEGRAL_MEMBER_CONSTANT static constexpr
45-
46-
#else
47-
// FIXME: Add this when NVCC supports inline variables.
48-
// # if _CCCL_STD_VER >= 2017
49-
// # define THRUST_INLINE_CONSTANT inline constexpr
50-
// # define THRUST_INLINE_INTEGRAL_MEMBER_CONSTANT inline constexpr
51-
# define THRUST_INLINE_CONSTANT static constexpr
52-
# define THRUST_INLINE_INTEGRAL_MEMBER_CONSTANT static constexpr
53-
54-
#endif
31+
// deprecated [Since 2.8.0]
32+
#define THRUST_INLINE_CONSTANT _CCCL_GLOBAL_CONSTANT
33+
// deprecated [Since 2.8.0]
34+
#define THRUST_INLINE_INTEGRAL_MEMBER_CONSTANT static constexpr

thrust/thrust/detail/select_system.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ struct select_system_fn final
6464

6565
} // namespace select_system_detail
6666

67-
THRUST_INLINE_CONSTANT select_system_detail::select_system_fn select_system{};
67+
_CCCL_GLOBAL_CONSTANT select_system_detail::select_system_fn select_system{};
6868

6969
} // namespace detail
7070

thrust/thrust/detail/seq.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ struct seq_t
4949

5050
} // namespace detail
5151

52-
THRUST_INLINE_CONSTANT detail::seq_t seq;
52+
_CCCL_GLOBAL_CONSTANT detail::seq_t seq;
5353

5454
THRUST_NAMESPACE_END

thrust/thrust/detail/static_assert.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ namespace detail
4545
template <typename, bool x>
4646
struct depend_on_instantiation
4747
{
48-
THRUST_INLINE_INTEGRAL_MEMBER_CONSTANT bool value = x;
48+
static constexpr bool value = x;
4949
};
5050

5151
#if _CCCL_STD_VER >= 2017

0 commit comments

Comments
 (0)