Skip to content

Commit 63f32a1

Browse files
authored
Merge pull request NVIDIA#1459 from allisonvacanti/update_deprecate_impl
Update deprecation mechanism.
2 parents 20f1c6a + 506c82b commit 63f32a1

6 files changed

Lines changed: 24 additions & 19 deletions

File tree

cmake/ThrustBuildTargetList.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,10 @@ function(thrust_build_target_list)
314314
add_flag_option(IGNORE_DEPRECATED_COMPILER "Don't warn about deprecated compilers." OFF)
315315
add_flag_option(IGNORE_CUB_VERSION_CHECK "Don't warn about mismatched CUB versions." OFF)
316316

317+
# By default, suppress deprecation warnings when building our test suite,
318+
## since we'll need to test deprecated APIs with `-Werror`.
319+
add_flag_option(IGNORE_DEPRECATED_API "Don't warn about deprecated Thrust or CUB APIs." ON)
320+
317321
# Top level meta-target. Makes it easier to just build thrust targets when
318322
# building both CUB and Thrust. Add all project files here so IDEs will be
319323
# aware of them. This will not generate build rules.

internal/build/common_build.mk

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ ifeq ($(OS),Linux)
66
LIBRARIES += m
77
endif
88

9+
# Disable our THRUST_DEPRECATED and CUB_DEPRECATED macros for internal
10+
# builds, since we need to build and test our deprecated APIs with -Werror.
11+
CUDACC_FLAGS += -DTHRUST_IGNORE_DEPRECATED_API
12+
913
include $(ROOTDIR)/thrust/internal/build/common_compiler.mk
1014

1115
# Add /bigobj to Windows build flag to workaround building Thrust with debug

thrust/cmake/thrust-config.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
#
5151
# # Create target with HOST=CPP DEVICE=CUDA and some advanced flags set
5252
# thrust_create_target(TargetName
53+
# IGNORE_DEPRECATED_API # Silence build warnings about deprecated APIs
5354
# IGNORE_DEPRECATED_CPP_DIALECT # Silence build warnings about deprecated compilers and C++ standards
5455
# IGNORE_DEPRECATED_CPP_11 # Only silence deprecation warnings for C++11
5556
# IGNORE_DEPRECATED_COMPILER # Only silence deprecation warnings for old compilers
@@ -104,6 +105,7 @@ function(thrust_create_target target_name)
104105
ADVANCED
105106
FROM_OPTIONS
106107
IGNORE_CUB_VERSION_CHECK
108+
IGNORE_DEPRECATED_API
107109
IGNORE_DEPRECATED_COMPILER
108110
IGNORE_DEPRECATED_CPP_11
109111
IGNORE_DEPRECATED_CPP_DIALECT
@@ -196,6 +198,10 @@ function(thrust_create_target target_name)
196198
target_compile_definitions(${target_name} INTERFACE "THRUST_IGNORE_DEPRECATED_CPP_DIALECT")
197199
endif()
198200

201+
if (TCT_IGNORE_DEPRECATED_API)
202+
target_compile_definitions(${target_name} INTERFACE "THRUST_IGNORE_DEPRECATED_API")
203+
endif()
204+
199205
if (TCT_IGNORE_DEPRECATED_CPP_11)
200206
target_compile_definitions(${target_name} INTERFACE "THRUST_IGNORE_DEPRECATED_CPP_11")
201207
endif()

thrust/detail/config/deprecated.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,17 @@
2121
#pragma once
2222

2323
#include <thrust/detail/config/compiler.h>
24+
#include <thrust/detail/config/cpp_dialect.h>
2425

25-
#if THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_MSVC
26+
#if defined(CUB_IGNORE_DEPRECATED_API) && !defined(THRUST_IGNORE_DEPRECATED_API)
27+
# define THRUST_IGNORE_DEPRECATED_API
28+
#endif
29+
30+
#ifdef THRUST_IGNORE_DEPRECATED_API
31+
# define THRUST_DEPRECATED
32+
#elif THRUST_CPP_DIALECT >= 2014
33+
# define THRUST_DEPRECATED [[deprecated]]
34+
#elif THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_MSVC
2635
# define THRUST_DEPRECATED __declspec(deprecated)
2736
#elif THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_CLANG
2837
# define THRUST_DEPRECATED __attribute__((deprecated))

thrust/iterator/detail/device_system_tag.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,3 @@ namespace thrust
2929
typedef thrust::system::__THRUST_DEVICE_SYSTEM_NAMESPACE::tag device_system_tag;
3030

3131
} // end thrust
32-
33-
// TODO remove this in 1.8.0
34-
namespace thrust
35-
{
36-
37-
typedef THRUST_DEPRECATED device_system_tag device_space_tag;
38-
39-
} // end thrust
40-

thrust/iterator/detail/host_system_tag.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,3 @@ namespace thrust
2929
typedef thrust::system::__THRUST_HOST_SYSTEM_NAMESPACE::tag host_system_tag;
3030

3131
} // end thrust
32-
33-
// TODO remove this in 1.8.0
34-
namespace thrust
35-
{
36-
37-
typedef THRUST_DEPRECATED host_system_tag host_space_tag;
38-
39-
} // end thrust
40-

0 commit comments

Comments
 (0)