mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 21:16:56 +00:00
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.
This commit is contained in:
parent
1afe201ae8
commit
6100ed4bb3
@ -117,8 +117,8 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
// [[noreturn]] is disabled on MSVC because of bogus unreachable code warnings.
|
||||
#if FMT_EXCEPTIONS && FMT_HAS_CPP_ATTRIBUTE(noreturn) && !FMT_MSC_VER
|
||||
// [[noreturn]] is disabled on MSVC and NVCC because of bogus unreachable code warnings.
|
||||
#if FMT_EXCEPTIONS && FMT_HAS_CPP_ATTRIBUTE(noreturn) && !FMT_MSC_VER && !FMT_NVCC
|
||||
# define FMT_NORETURN [[noreturn]]
|
||||
#else
|
||||
# define FMT_NORETURN
|
||||
|
@ -86,12 +86,12 @@
|
||||
|
||||
#ifndef FMT_THROW
|
||||
# if FMT_EXCEPTIONS
|
||||
# if FMT_MSC_VER
|
||||
# if FMT_MSC_VER || FMT_NVCC
|
||||
FMT_BEGIN_NAMESPACE
|
||||
namespace internal {
|
||||
template <typename Exception> inline void do_throw(const Exception& x) {
|
||||
// Silence unreachable code warnings in MSVC because these are nearly
|
||||
// impossible to fix in a generic code.
|
||||
// Silence unreachable code warnings in MSVC and NVCC because these
|
||||
// are nearly impossible to fix in a generic code.
|
||||
volatile bool b = true;
|
||||
if (b) throw x;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user