Commit 6100ed4b authored by Greg Sjaardema's avatar Greg Sjaardema Committed by Victor Zverovich

Eliminate NVCC NVidia compiler emits unreachable code warnings

Similar to the MSC Compiler, the NVidia NVCC compiler also
emits unreachable code warnings when there is a return
statement following an exception.  These changes eliminate
those warnings.
parent 1afe201a
...@@ -117,8 +117,8 @@ ...@@ -117,8 +117,8 @@
# endif # endif
#endif #endif
// [[noreturn]] is disabled on MSVC because of bogus unreachable code warnings. // [[noreturn]] is disabled on MSVC and NVCC because of bogus unreachable code warnings.
#if FMT_EXCEPTIONS && FMT_HAS_CPP_ATTRIBUTE(noreturn) && !FMT_MSC_VER #if FMT_EXCEPTIONS && FMT_HAS_CPP_ATTRIBUTE(noreturn) && !FMT_MSC_VER && !FMT_NVCC
# define FMT_NORETURN [[noreturn]] # define FMT_NORETURN [[noreturn]]
#else #else
# define FMT_NORETURN # define FMT_NORETURN
......
...@@ -86,12 +86,12 @@ ...@@ -86,12 +86,12 @@
#ifndef FMT_THROW #ifndef FMT_THROW
# if FMT_EXCEPTIONS # if FMT_EXCEPTIONS
# if FMT_MSC_VER # if FMT_MSC_VER || FMT_NVCC
FMT_BEGIN_NAMESPACE FMT_BEGIN_NAMESPACE
namespace internal { namespace internal {
template <typename Exception> inline void do_throw(const Exception& x) { template <typename Exception> inline void do_throw(const Exception& x) {
// Silence unreachable code warnings in MSVC because these are nearly // Silence unreachable code warnings in MSVC and NVCC because these
// impossible to fix in a generic code. // are nearly impossible to fix in a generic code.
volatile bool b = true; volatile bool b = true;
if (b) throw x; if (b) throw x;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment