Skip to content

Commit fdaaf97

Browse files
Require C++17 for compiling Thrust and CUB (#3255)
* Issue an unsuppressable warning when compiling with < C++17 * Remove C++11/14 presets * Remove CCCL_IGNORE_DEPRECATED_CPP_DIALECT from headers * Remove [CUB|THRUST|TCT]_IGNORE_DEPRECATED_CPP_[11|14] * Remove CUB_ENABLE_DIALECT_CPP[11|14] * Update CI runs * Remove C++11/14 CI runs for CUB and Thrust * Raise compiler minimum versions for C++17 * Update ReadMe * Drop Thrust's cpp14_required.h * Add escape hatch for C++17 removal Fixes: #3252
1 parent fc01646 commit fdaaf97

File tree

30 files changed

+32
-294
lines changed

30 files changed

+32
-294
lines changed

CMakePresets.json

Lines changed: 0 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@
6969
"CUB_ENABLE_TESTING": true,
7070
"CUB_ENABLE_EXAMPLES": true,
7171
"CUB_SEPARATE_CATCH2": true,
72-
"CUB_ENABLE_DIALECT_CPP11": true,
73-
"CUB_ENABLE_DIALECT_CPP14": true,
7472
"CUB_ENABLE_DIALECT_CPP17": true,
7573
"CUB_ENABLE_DIALECT_CPP20": true,
7674
"THRUST_ENABLE_MULTICONFIG": true,
@@ -232,30 +230,10 @@
232230
"CUB_ENABLE_TESTING": true,
233231
"CUB_ENABLE_EXAMPLES": true,
234232
"CUB_SEPARATE_CATCH2": true,
235-
"CUB_ENABLE_DIALECT_CPP11": false,
236-
"CUB_ENABLE_DIALECT_CPP14": false,
237233
"CUB_ENABLE_DIALECT_CPP17": false,
238234
"CUB_ENABLE_DIALECT_CPP20": false
239235
}
240236
},
241-
{
242-
"name": "cub-cpp11",
243-
"displayName": "CUB: C++11",
244-
"inherits": "cub-base",
245-
"cacheVariables": {
246-
"CCCL_IGNORE_DEPRECATED_CPP_DIALECT": true,
247-
"CUB_ENABLE_DIALECT_CPP11": true
248-
}
249-
},
250-
{
251-
"name": "cub-cpp14",
252-
"displayName": "CUB: C++14",
253-
"inherits": "cub-base",
254-
"cacheVariables": {
255-
"CCCL_IGNORE_DEPRECATED_CPP_DIALECT": true,
256-
"CUB_ENABLE_DIALECT_CPP14": true
257-
}
258-
},
259237
{
260238
"name": "cub-cpp17",
261239
"displayName": "CUB: C++17",
@@ -289,24 +267,6 @@
289267
"THRUST_MULTICONFIG_ENABLE_DIALECT_CPP20": false
290268
}
291269
},
292-
{
293-
"name": "thrust-cpp11",
294-
"displayName": "Thrust: C++11",
295-
"inherits": "thrust-base",
296-
"cacheVariables": {
297-
"CCCL_IGNORE_DEPRECATED_CPP_DIALECT": true,
298-
"THRUST_MULTICONFIG_ENABLE_DIALECT_CPP11": true
299-
}
300-
},
301-
{
302-
"name": "thrust-cpp14",
303-
"displayName": "Thrust: C++14",
304-
"inherits": "thrust-base",
305-
"cacheVariables": {
306-
"CCCL_IGNORE_DEPRECATED_CPP_DIALECT": true,
307-
"THRUST_MULTICONFIG_ENABLE_DIALECT_CPP14": true
308-
}
309-
},
310270
{
311271
"name": "thrust-cpp17",
312272
"displayName": "Thrust: C++17",
@@ -520,14 +480,6 @@
520480
"libcudacxx-base"
521481
]
522482
},
523-
{
524-
"name": "cub-cpp11",
525-
"configurePreset": "cub-cpp11"
526-
},
527-
{
528-
"name": "cub-cpp14",
529-
"configurePreset": "cub-cpp14"
530-
},
531483
{
532484
"name": "cub-cpp17",
533485
"configurePreset": "cub-cpp17"
@@ -536,14 +488,6 @@
536488
"name": "cub-cpp20",
537489
"configurePreset": "cub-cpp20"
538490
},
539-
{
540-
"name": "thrust-cpp11",
541-
"configurePreset": "thrust-cpp11"
542-
},
543-
{
544-
"name": "thrust-cpp14",
545-
"configurePreset": "thrust-cpp14"
546-
},
547491
{
548492
"name": "thrust-cpp17",
549493
"configurePreset": "thrust-cpp17"
@@ -736,16 +680,6 @@
736680
}
737681
}
738682
},
739-
{
740-
"name": "cub-nolid-cpp11",
741-
"configurePreset": "cub-cpp11",
742-
"inherits": "cub-nolid-base"
743-
},
744-
{
745-
"name": "cub-nolid-cpp14",
746-
"configurePreset": "cub-cpp14",
747-
"inherits": "cub-nolid-base"
748-
},
749683
{
750684
"name": "cub-nolid-cpp17",
751685
"configurePreset": "cub-cpp17",
@@ -756,16 +690,6 @@
756690
"configurePreset": "cub-cpp20",
757691
"inherits": "cub-nolid-base"
758692
},
759-
{
760-
"name": "cub-lid0-cpp11",
761-
"configurePreset": "cub-cpp11",
762-
"inherits": "cub-lid0-base"
763-
},
764-
{
765-
"name": "cub-lid0-cpp14",
766-
"configurePreset": "cub-cpp14",
767-
"inherits": "cub-lid0-base"
768-
},
769693
{
770694
"name": "cub-lid0-cpp17",
771695
"configurePreset": "cub-cpp17",
@@ -776,16 +700,6 @@
776700
"configurePreset": "cub-cpp20",
777701
"inherits": "cub-lid0-base"
778702
},
779-
{
780-
"name": "cub-lid1-cpp11",
781-
"configurePreset": "cub-cpp11",
782-
"inherits": "cub-lid1-base"
783-
},
784-
{
785-
"name": "cub-lid1-cpp14",
786-
"configurePreset": "cub-cpp14",
787-
"inherits": "cub-lid1-base"
788-
},
789703
{
790704
"name": "cub-lid1-cpp17",
791705
"configurePreset": "cub-cpp17",
@@ -796,16 +710,6 @@
796710
"configurePreset": "cub-cpp20",
797711
"inherits": "cub-lid1-base"
798712
},
799-
{
800-
"name": "cub-lid2-cpp11",
801-
"configurePreset": "cub-cpp11",
802-
"inherits": "cub-lid2-base"
803-
},
804-
{
805-
"name": "cub-lid2-cpp14",
806-
"configurePreset": "cub-cpp14",
807-
"inherits": "cub-lid2-base"
808-
},
809713
{
810714
"name": "cub-lid2-cpp17",
811715
"configurePreset": "cub-cpp17",
@@ -816,16 +720,6 @@
816720
"configurePreset": "cub-cpp20",
817721
"inherits": "cub-lid2-base"
818722
},
819-
{
820-
"name": "cub-cpp11",
821-
"configurePreset": "cub-cpp11",
822-
"inherits": "cub-base"
823-
},
824-
{
825-
"name": "cub-cpp14",
826-
"configurePreset": "cub-cpp14",
827-
"inherits": "cub-base"
828-
},
829723
{
830724
"name": "cub-cpp17",
831725
"configurePreset": "cub-cpp17",
@@ -866,16 +760,6 @@
866760
}
867761
}
868762
},
869-
{
870-
"name": "thrust-gpu-cpp11",
871-
"configurePreset": "thrust-cpp11",
872-
"inherits": "thrust-gpu-base"
873-
},
874-
{
875-
"name": "thrust-gpu-cpp14",
876-
"configurePreset": "thrust-cpp14",
877-
"inherits": "thrust-gpu-base"
878-
},
879763
{
880764
"name": "thrust-gpu-cpp17",
881765
"configurePreset": "thrust-cpp17",
@@ -886,16 +770,6 @@
886770
"configurePreset": "thrust-cpp20",
887771
"inherits": "thrust-gpu-base"
888772
},
889-
{
890-
"name": "thrust-cpu-cpp11",
891-
"configurePreset": "thrust-cpp11",
892-
"inherits": "thrust-cpu-base"
893-
},
894-
{
895-
"name": "thrust-cpu-cpp14",
896-
"configurePreset": "thrust-cpp14",
897-
"inherits": "thrust-cpu-base"
898-
},
899773
{
900774
"name": "thrust-cpu-cpp17",
901775
"configurePreset": "thrust-cpp17",
@@ -906,16 +780,6 @@
906780
"configurePreset": "thrust-cpp20",
907781
"inherits": "thrust-cpu-base"
908782
},
909-
{
910-
"name": "thrust-cpp11",
911-
"configurePreset": "thrust-cpp11",
912-
"inherits": "thrust-base"
913-
},
914-
{
915-
"name": "thrust-cpp14",
916-
"configurePreset": "thrust-cpp14",
917-
"inherits": "thrust-base"
918-
},
919783
{
920784
"name": "thrust-cpp17",
921785
"configurePreset": "thrust-cpp17",

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -269,8 +269,8 @@ But we will not invest significant time in triaging or fixing issues for older c
269269
In the spirit of "You only support what you test", see our [CI Overview](https://github.com/NVIDIA/cccl/blob/main/ci-overview.md) for more information on exactly what we test.
270270

271271
### C++ Dialects
272-
- C++11 (Deprecated in Thrust/CUB, to be removed in next major version)
273-
- C++14 (Deprecated in Thrust/CUB, to be removed in next major version)
272+
- C++11 (only libcu++)
273+
- C++14 (only libcu++)
274274
- C++17
275275
- C++20
276276

ci/matrix.yaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ workflows:
1313
# Old CTK/compiler
1414
- {jobs: ['build'], std: 'minmax', ctk: '12.0', cxx: ['gcc7', 'gcc9', 'clang9', 'msvc2019']}
1515
# Current CTK build-only
16-
- {jobs: ['build'], std: [11, 14], cxx: ['gcc7', 'clang9']}
16+
- {jobs: ['build'], std: [11, 14], cxx: ['gcc7', 'clang9'], project: 'libcudacxx'}
17+
- {jobs: ['build'], std: [17], cxx: ['gcc7', 'clang9']}
1718
- {jobs: ['build'], std: 'max', cxx: ['gcc8', 'gcc9', 'gcc10', 'gcc11', 'gcc12']}
1819
- {jobs: ['build'], std: 'max', cxx: ['clang10', 'clang11', 'clang12', 'clang13', 'clang14', 'clang15', 'clang16', 'clang17']}
1920
- {jobs: ['build'], std: 'max', cxx: ['msvc2019']}
@@ -246,11 +247,11 @@ projects:
246247
stds: [11, 14, 17, 20]
247248
cub:
248249
name: 'CUB'
249-
stds: [11, 14, 17, 20]
250+
stds: [17, 20]
250251
job_map: { test: ['test_nolid', 'test_lid0', 'test_lid1', 'test_lid2'] }
251252
thrust:
252253
name: 'Thrust'
253-
stds: [11, 14, 17, 20]
254+
stds: [17, 20]
254255
job_map: { test: ['test_cpu', 'test_gpu'] }
255256
cudax:
256257
stds: [17, 20]

cub/cmake/CubBuildTargetList.cmake

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,6 @@ function(cub_build_target_list)
150150
cmake_minimum_required(VERSION 3.18.3)
151151
endif()
152152

153-
# Supported versions of MSVC do not distinguish between C++11 and C++14.
154-
# Warn the user that they may be generating a ton of redundant targets.
155-
if ("MSVC" STREQUAL "${CMAKE_CXX_COMPILER_ID}" AND
156-
CUB_ENABLE_DIALECT_CPP11)
157-
message(WARNING
158-
"Supported versions of MSVC (2017+) do not distinguish between C++11 "
159-
"and C++14. The requested C++11 targets will be built with C++14."
160-
)
161-
endif()
162-
163153
# Generic config flags:
164154
macro(add_flag_option flag docstring default)
165155
set(opt "CCCL_${flag}")

cub/cub/util_cpp_dialect.cuh

Lines changed: 11 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,9 @@
4444

4545
// Deprecation warnings may be silenced by defining the following macros. These
4646
// may be combined.
47-
// - CCCL_IGNORE_DEPRECATED_CPP_DIALECT:
48-
// Ignore all deprecated C++ dialects and outdated compilers.
49-
// - CCCL_IGNORE_DEPRECATED_CPP_11:
50-
// Ignore deprecation warnings when compiling with C++11. C++03 and outdated
51-
// compilers will still issue warnings.
52-
// - CCCL_IGNORE_DEPRECATED_CPP_14:
53-
// Ignore deprecation warnings when compiling with C++14. C++03 and outdated
54-
// compilers will still issue warnings.
5547
// - CCCL_IGNORE_DEPRECATED_COMPILER
5648
// Ignore deprecation warnings when using deprecated compilers. Compiling
57-
// with C++03, C++11 and C++14 will still issue warnings.
49+
// with deprecated C++ dialects will still issue warnings.
5850

5951
# define CUB_CPP_DIALECT _CCCL_STD_VER
6052

@@ -65,19 +57,18 @@
6557
# define CUB_COMP_DEPR_IMPL(msg) _CCCL_PRAGMA(GCC warning #msg)
6658
# endif
6759

60+
// Compiler checks:
6861
// clang-format off
6962
# define CUB_COMPILER_DEPRECATION(REQ) \
7063
CUB_COMP_DEPR_IMPL(CUB requires at least REQ. Define CCCL_IGNORE_DEPRECATED_COMPILER to suppress this message.)
7164

7265
# define CUB_COMPILER_DEPRECATION_SOFT(REQ, CUR) \
7366
CUB_COMP_DEPR_IMPL( \
7467
CUB requires at least REQ. CUR is deprecated but still supported. CUR support will be removed in a \
75-
future release. Define CCCL_IGNORE_DEPRECATED_CPP_DIALECT to suppress this message.)
68+
future release. Define CCCL_IGNORE_DEPRECATED_COMPILER to suppress this message.)
7669
// clang-format on
7770

7871
# ifndef CCCL_IGNORE_DEPRECATED_COMPILER
79-
80-
// Compiler checks:
8172
# if _CCCL_COMPILER(GCC, <, 7)
8273
CUB_COMPILER_DEPRECATION(GCC 7.0);
8374
# elif _CCCL_COMPILER(CLANG, <, 7)
@@ -89,24 +80,18 @@ CUB_COMPILER_DEPRECATION(MSVC 2019(19.20 / 16.0 / 14.20));
8980
// >=2017, <2019. Soft deprecation message:
9081
CUB_COMPILER_DEPRECATION_SOFT(MSVC 2019(19.20 / 16.0 / 14.20), MSVC 2017);
9182
# endif
92-
9383
# endif // CCCL_IGNORE_DEPRECATED_COMPILER
9484

95-
# if _CCCL_STD_VER < 2011
96-
// <C++11. Hard upgrade message:
97-
CUB_COMPILER_DEPRECATION(C++ 17);
98-
# elif _CCCL_STD_VER == 2011 && !defined(CCCL_IGNORE_DEPRECATED_CPP_11)
99-
// =C++11. Soft upgrade message:
100-
CUB_COMPILER_DEPRECATION_SOFT(C++ 17, C++ 11);
101-
# elif _CCCL_STD_VER == 2014 && !defined(CCCL_IGNORE_DEPRECATED_CPP_14)
102-
// =C++14. Soft upgrade message:
103-
CUB_COMPILER_DEPRECATION_SOFT(C++ 17, C++ 14);
104-
# endif // _CCCL_STD_VER >= 2017
105-
10685
# undef CUB_COMPILER_DEPRECATION_SOFT
10786
# undef CUB_COMPILER_DEPRECATION
87+
88+
// C++17 dialect check:
89+
# ifndef CCCL_IGNORE_DEPRECATED_CPP_DIALECT
90+
# if _CCCL_STD_VER < 2017
91+
CUB_COMP_DEPR_IMPL(CUB requires at least C++ 17. Define CCCL_IGNORE_DEPRECATED_CPP_DIALECT to suppress this message.)
92+
# endif // _CCCL_STD_VER >= 2017
93+
# endif
94+
10895
# undef CUB_COMP_DEPR_IMPL
109-
# undef CUB_COMP_DEPR_IMPL0
110-
# undef CUB_COMP_DEPR_IMPL1
11196

11297
#endif // !_CCCL_DOXYGEN_INVOKED

lib/cmake/thrust/thrust-config.cmake

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -237,36 +237,10 @@ function(thrust_create_target target_name)
237237
target_compile_definitions(${target_name} INTERFACE "THRUST_FORCE_64_BIT_OFFSET_TYPE")
238238
endif()
239239

240-
# This would be nice to enforce, but breaks when using old cmake + new
241-
# compiler, since cmake doesn't know what features the new compiler version
242-
# supports.
243-
# Leaving this here as a reminder not to add it back. Just let the
244-
# compile-time checks in thrust/detail/config/cpp_dialect.h handle it.
245-
#
246-
# if (NOT TCT_IGNORE_DEPRECATED_CPP_DIALECT)
247-
# if (TCT_IGNORE_DEPRECATED_CPP_11)
248-
# target_compile_features(${target_name} INTERFACE cxx_std_11)
249-
# else()
250-
# target_compile_features(${target_name} INTERFACE cxx_std_14)
251-
# endif()
252-
# endif()
253-
254-
if (TCT_IGNORE_DEPRECATED_CPP_DIALECT OR CCCL_IGNORE_DEPRECATED_CPP_DIALECT)
255-
target_compile_definitions(${target_name} INTERFACE "CCCL_IGNORE_DEPRECATED_CPP_DIALECT")
256-
endif()
257-
258240
if (TCT_IGNORE_DEPRECATED_API OR CCCL_IGNORE_DEPRECATED_API)
259241
target_compile_definitions(${target_name} INTERFACE "CCCL_IGNORE_DEPRECATED_API")
260242
endif()
261243

262-
if (TCT_IGNORE_DEPRECATED_CPP_11 OR CCCL_IGNORE_DEPRECATED_CPP_11)
263-
target_compile_definitions(${target_name} INTERFACE "CCCL_IGNORE_DEPRECATED_CPP_11")
264-
endif()
265-
266-
if (TCT_IGNORE_DEPRECATED_CPP_14 OR CCCL_IGNORE_DEPRECATED_CPP_14)
267-
target_compile_definitions(${target_name} INTERFACE "CCCL_IGNORE_DEPRECATED_CPP_14")
268-
endif()
269-
270244
if (TCT_IGNORE_DEPRECATED_COMPILER OR CCCL_IGNORE_DEPRECATED_COMPILER)
271245
target_compile_definitions(${target_name} INTERFACE "CCCL_IGNORE_DEPRECATED_COMPILER")
272246
endif()

0 commit comments

Comments
 (0)