Testing/Performance: Add `THRUST_NOEXCEPT` macro to deal with incompatibilities
in `std::exception`s interfaces betweeen C++03 and C++11.
git-commit
git-author Bryce Adelstein Lelbach aka wash
[git-p4: depot-paths = "//sw/gpgpu/thrust/": change = 24019084]
MODIFY
internal/benchmark/bench.cu
internal/benchmark/bench.cu
#define PP_CAT(a, b) a ## b
+// We don't use THRUST_NOEXCEPT because it's new, and we want this benchmark to
+// be backwards-compatible to older versions of Thrust.
+#if __cplusplus >= 201103L
+ #define NOEXCEPT noexcept
+#else
+ #define NOEXCEPT throw()
+#endif
+
///////////////////////////////////////////////////////////////////////////////
template <typename T>
@@ -987,8 +995,8 @@ std::vector<std::string> split(std::string const& str, std::string const& delim)
struct command_line_option_error : std::exception
{
- virtual ~command_line_option_error() {}
- virtual const char* what() const = 0;
+ virtual ~command_line_option_error() NOEXCEPT {}
+ virtual const char* what() const NOEXCEPT = 0;
};
struct only_one_option_allowed : command_line_option_error
@@ -1017,9 +1025,9 @@ struct only_one_option_allowed : command_line_option_error
message += ".";
}
- virtual ~only_one_option_allowed() {}
+ virtual ~only_one_option_allowed() NOEXCEPT {}
- virtual const char* what() const
+ virtual const char* what() const NOEXCEPT
{
return message.c_str();
}
@@ -1040,9 +1048,9 @@ struct required_option_missing : command_line_option_error
message += "` option is required.";
}
- virtual ~required_option_missing() {}
+ virtual ~required_option_missing() NOEXCEPT {}
- virtual const char* what() const
+ virtual const char* what() const NOEXCEPT
{
return message.c_str();
}

MODIFY
thrust/detail/config/compiler.h
thrust/detail/config/compiler.h
// XXX we should move the definition of THRUST_DEPRECATED out of this logic
#if defined(_MSC_VER)
#define THRUST_HOST_COMPILER THRUST_HOST_COMPILER_MSVC
-#define THRUST_DEPRECATED __declspec(deprecated)
#elif defined(__clang__)
#define THRUST_HOST_COMPILER THRUST_HOST_COMPILER_CLANG
#define THRUST_DEPRECATED __attribute__ ((deprecated))
#define THRUST_GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
#else
#define THRUST_HOST_COMPILER THRUST_HOST_COMPILER_UNKNOWN
-#define THRUST_DEPRECATED
#endif // THRUST_HOST_COMPILER
// figure out which device compiler we're using
@@ -123,3 +121,22 @@ __THRUST_DISABLE_MSVC_WARNING_END(4800)
__THRUST_DISABLE_MSVC_WARNING_BEGIN(4800)
#define __THRUST_DISABLE_MSVC_FORCING_VALUE_TO_BOOL_END \
__THRUST_DISABLE_MSVC_WARNING_END(4800)
+
+// figure out which host compiler we're using
+// XXX we should move the definition of THRUST_DEPRECATED out of this logic
+#if THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_MSVC
+ #define THRUST_DEPRECATED __declspec(deprecated)
+#elif THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_CLANG
+ #define THRUST_DEPRECATED __attribute__((deprecated))
+#elif THRUST_HOST_COMPILER == THRUST_HOST_COMPILER_GCC
+ #define THRUST_DEPRECATED __attribute__((deprecated))
+#else
+ #define THRUST_DEPRECATED
+#endif
+
+#if __cplusplus >= 201103L
+ #define THRUST_NOEXCEPT noexcept
+#else
+ #define THRUST_NOEXCEPT throw()
+#endif
+

Testing/Performance: Add `THRUST_NOEXCEPT` macro to deal with incompatibilities
in `std::exception`s interfaces betweeen C++03 and C++11.
git-commit df547514dd5449675eee6846140d431e5c70a2a0
git-author Bryce Adelstein Lelbach aka wash <brycelelbach@gmail.com>

[git-p4: depot-paths = "//sw/gpgpu/thrust/": change = 24019084]