From 6c9749bc8067d1ba9e68fce3f3a525539e271c4a Mon Sep 17 00:00:00 2001 From: Bernhard Manfred Gruber Date: Thu, 1 Aug 2024 20:23:23 +0200 Subject: [PATCH] Warn when using C++14 in CUB and Thrust Fixes: #2165 --- cub/cub/util_cpp_dialect.cuh | 11 +++++++++-- thrust/thrust/detail/config/cpp_dialect.h | 19 ++++++++++++------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/cub/cub/util_cpp_dialect.cuh b/cub/cub/util_cpp_dialect.cuh index 449db09e03c..473562895a2 100644 --- a/cub/cub/util_cpp_dialect.cuh +++ b/cub/cub/util_cpp_dialect.cuh @@ -50,9 +50,12 @@ // - CUB_IGNORE_DEPRECATED_CPP_11: // Ignore deprecation warnings when compiling with C++11. C++03 and outdated // compilers will still issue warnings. +// - CUB_IGNORE_DEPRECATED_CPP_14: +// Ignore deprecation warnings when compiling with C++14. C++03 and outdated +// compilers will still issue warnings. // - CUB_IGNORE_DEPRECATED_COMPILER // Ignore deprecation warnings when using deprecated compilers. Compiling -// with C++03 and C++11 will still issue warnings. +// with C++03, C++11 and C++14 will still issue warnings. // Check for the thrust opt-outs as well: # if !defined(CUB_IGNORE_DEPRECATED_CPP_DIALECT) && defined(THRUST_IGNORE_DEPRECATED_CPP_DIALECT) @@ -67,6 +70,7 @@ # ifdef CUB_IGNORE_DEPRECATED_CPP_DIALECT # define CUB_IGNORE_DEPRECATED_CPP_11 +# define CUB_IGNORE_DEPRECATED_CPP_14 # ifndef CUB_IGNORE_DEPRECATED_COMPILER # define CUB_IGNORE_DEPRECATED_COMPILER # endif @@ -118,7 +122,10 @@ CUB_COMPILER_DEPRECATION_SOFT(MSVC 2019(19.20 / 16.0 / 14.20), MSVC 2017); CUB_COMPILER_DEPRECATION(C++ 14); # elif _CCCL_STD_VER == 2011 && !defined(CUB_IGNORE_DEPRECATED_CPP_11) // =C++11. Soft upgrade message: -CUB_COMPILER_DEPRECATION_SOFT(C++ 14, C++ 11); +CUB_COMPILER_DEPRECATION_SOFT(C++ 17, C++ 11); +# elif _CCCL_STD_VER == 2014 && !defined(CUB_IGNORE_DEPRECATED_CPP_14) +// =C++14. Soft upgrade message: +CUB_COMPILER_DEPRECATION_SOFT(C++ 17, C++ 11); # endif # endif // CUB_IGNORE_DEPRECATED_DIALECT diff --git a/thrust/thrust/detail/config/cpp_dialect.h b/thrust/thrust/detail/config/cpp_dialect.h index 714c8556225..9b63ff28d33 100644 --- a/thrust/thrust/detail/config/cpp_dialect.h +++ b/thrust/thrust/detail/config/cpp_dialect.h @@ -39,9 +39,12 @@ // - THRUST_IGNORE_DEPRECATED_CPP_11: // Ignore deprecation warnings when compiling with C++11. C++03 and outdated // compilers will still issue warnings. +// - THRUST_IGNORE_DEPRECATED_CPP_14: +// Ignore deprecation warnings when compiling with C++14. C++03 and outdated +// compilers will still issue warnings. // - THRUST_IGNORE_DEPRECATED_COMPILER // Ignore deprecation warnings when using deprecated compilers. Compiling -// with C++03 and C++11 will still issue warnings. +// with C++03, C++11 and C++14 will still issue warnings. // Check for the CUB opt-outs as well: #if !defined(THRUST_IGNORE_DEPRECATED_CPP_DIALECT) && defined(CUB_IGNORE_DEPRECATED_CPP_DIALECT) @@ -56,6 +59,7 @@ #ifdef THRUST_IGNORE_DEPRECATED_CPP_DIALECT # define THRUST_IGNORE_DEPRECATED_CPP_11 +# define THRUST_IGNORE_DEPRECATED_CPP_14 # ifndef THRUST_IGNORE_DEPRECATED_COMPILER # define THRUST_IGNORE_DEPRECATED_COMPILER # endif @@ -84,7 +88,6 @@ #ifndef THRUST_IGNORE_DEPRECATED_COMPILER -// clang-format off // Compiler checks: # if defined(_CCCL_COMPILER_GCC) && THRUST_GCC_VERSION < 50000 THRUST_COMPILER_DEPRECATION(GCC 5.0); @@ -92,10 +95,10 @@ THRUST_COMPILER_DEPRECATION(GCC 5.0); THRUST_COMPILER_DEPRECATION(Clang 7.0); # elif defined(_CCCL_COMPILER_MSVC) && THRUST_MSVC_VERSION < 1910 // <2017. Hard upgrade message: -THRUST_COMPILER_DEPRECATION(MSVC 2019 (19.20/16.0/14.20)); +THRUST_COMPILER_DEPRECATION(MSVC 2019(19.20 / 16.0 / 14.20)); # elif defined(_CCCL_COMPILER_MSVC) && THRUST_MSVC_VERSION < 1920 // >=2017, <2019. Soft deprecation message: -THRUST_COMPILER_DEPRECATION_SOFT(MSVC 2019 (19.20/16.0/14.20), MSVC 2017); +THRUST_COMPILER_DEPRECATION_SOFT(MSVC 2019(19.20 / 16.0 / 14.20), MSVC 2017); # endif #endif // THRUST_IGNORE_DEPRECATED_COMPILER @@ -105,12 +108,14 @@ THRUST_COMPILER_DEPRECATION_SOFT(MSVC 2019 (19.20/16.0/14.20), MSVC 2017); // Dialect checks: # if _CCCL_STD_VER < 2011 //