From 37ad436068595a0722331510c8bfdf51c6df5749 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 6 Feb 2015 21:27:31 -0800 Subject: [PATCH] Fix by @dixlorenz for clang warnings "'return' will never be executed" (#96) --- format.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/format.cc b/format.cc index fbb0d967..4974b355 100644 --- a/format.cc +++ b/format.cc @@ -66,8 +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 # define FMT_THROW(x) assert(false) +# define FMT_RETURN_AFTER_THROW(x) return x # endif #endif @@ -251,7 +253,7 @@ class WidthHandler : public fmt::internal::ArgVisitor { unsigned visit_unhandled_arg() { FMT_THROW(fmt::FormatError("width is not integer")); - return 0; + FMT_RETURN_AFTER_THROW(0); } template @@ -273,7 +275,7 @@ class PrecisionHandler : public: unsigned visit_unhandled_arg() { FMT_THROW(fmt::FormatError("precision is not integer")); - return 0; + FMT_RETURN_AFTER_THROW(0); } template