mirror of
https://github.com/fmtlib/fmt.git
synced 2024-11-26 20:20:04 +00:00
Get rid of FMT_NORETURN because it breaks when FMT_EXCEPTIONS=0
This commit is contained in:
parent
3c3ae4e319
commit
66915785dd
26
format.cc
26
format.cc
@ -66,26 +66,10 @@ using fmt::internal::Arg;
|
||||
#ifndef FMT_THROW
|
||||
# if FMT_EXCEPTIONS
|
||||
# define FMT_THROW(x) throw x
|
||||
# define FMT_RETURN_AFTER_THROW(x)
|
||||
# else
|
||||
# ifndef NDEBUG
|
||||
# define FMT_THROW(x) assert(false && #x)
|
||||
# elif defined _MSC_VER
|
||||
# define FMT_THROW(x) __assume(0)
|
||||
# elif defined __clang__ || FMT_GCC_VERSION >= 405
|
||||
# define FMT_THROW(x) __builtin_unreachable()
|
||||
# else
|
||||
# define FMT_THROW(x) std::abort()
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef FMT_NORETURN
|
||||
# if defined __GNUC__ || defined __clang__
|
||||
# define FMT_NORETURN __attribute__((__noreturn__))
|
||||
# elif defined _MSC_VER
|
||||
# define FMT_NORETURN __declspec(noreturn)
|
||||
# else
|
||||
# define FMT_NORETURN
|
||||
# define FMT_THROW(x) assert(false)
|
||||
# define FMT_RETURN_AFTER_THROW(x) return x
|
||||
# endif
|
||||
#endif
|
||||
|
||||
@ -307,9 +291,9 @@ class WidthHandler : public fmt::internal::ArgVisitor<WidthHandler, unsigned> {
|
||||
public:
|
||||
explicit WidthHandler(fmt::FormatSpec &spec) : spec_(spec) {}
|
||||
|
||||
FMT_NORETURN
|
||||
unsigned visit_unhandled_arg() {
|
||||
FMT_THROW(fmt::FormatError("width is not integer"));
|
||||
FMT_RETURN_AFTER_THROW(0);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -329,9 +313,9 @@ class WidthHandler : public fmt::internal::ArgVisitor<WidthHandler, unsigned> {
|
||||
class PrecisionHandler :
|
||||
public fmt::internal::ArgVisitor<PrecisionHandler, int> {
|
||||
public:
|
||||
FMT_NORETURN
|
||||
unsigned visit_unhandled_arg() {
|
||||
FMT_THROW(fmt::FormatError("precision is not integer"));
|
||||
FMT_RETURN_AFTER_THROW(0);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
Loading…
Reference in New Issue
Block a user