fix compile warnings for Xcode
This commit is contained in:
parent
ba17cca432
commit
de5b4812b2
@ -66,8 +66,10 @@ using fmt::internal::Arg;
|
|||||||
#ifndef FMT_THROW
|
#ifndef FMT_THROW
|
||||||
# if FMT_EXCEPTIONS
|
# if FMT_EXCEPTIONS
|
||||||
# define FMT_THROW(x) throw x
|
# define FMT_THROW(x) throw x
|
||||||
|
# define FMT_RETURNAFTERTHROW(x)
|
||||||
# else
|
# else
|
||||||
# define FMT_THROW(x) assert(false)
|
# define FMT_THROW(x) assert(false)
|
||||||
|
# define FMT_RETURNAFTERTHROW(x) return x
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -251,7 +253,7 @@ class WidthHandler : public fmt::internal::ArgVisitor<WidthHandler, unsigned> {
|
|||||||
|
|
||||||
unsigned visit_unhandled_arg() {
|
unsigned visit_unhandled_arg() {
|
||||||
FMT_THROW(fmt::FormatError("width is not integer"));
|
FMT_THROW(fmt::FormatError("width is not integer"));
|
||||||
return 0;
|
FMT_RETURNAFTERTHROW(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -273,7 +275,7 @@ class PrecisionHandler :
|
|||||||
public:
|
public:
|
||||||
unsigned visit_unhandled_arg() {
|
unsigned visit_unhandled_arg() {
|
||||||
FMT_THROW(fmt::FormatError("precision is not integer"));
|
FMT_THROW(fmt::FormatError("precision is not integer"));
|
||||||
return 0;
|
FMT_RETURNAFTERTHROW(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
@ -625,7 +627,7 @@ void fmt::BasicWriter<Char>::write_str(
|
|||||||
if (*str_value)
|
if (*str_value)
|
||||||
str_size = std::char_traits<StrChar>::length(str_value);
|
str_size = std::char_traits<StrChar>::length(str_value);
|
||||||
}
|
}
|
||||||
if (spec.precision_ >= 0 && spec.precision_ < str_size)
|
if (spec.precision_ >= 0 && static_cast<std::size_t>(spec.precision_) < str_size)
|
||||||
str_size = spec.precision_;
|
str_size = spec.precision_;
|
||||||
write_str(str_value, str_size, spec);
|
write_str(str_value, str_size, spec);
|
||||||
}
|
}
|
||||||
|
|||||||
17
format.h
17
format.h
@ -60,6 +60,16 @@
|
|||||||
# define FMT_GCC_EXTENSION
|
# define FMT_GCC_EXTENSION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define FMT_CLANGFALLTHROUGH
|
||||||
|
|
||||||
|
#ifdef __clang__
|
||||||
|
#pragma clang diagnostic ignored "-Wdocumentation-unknown-command"
|
||||||
|
#ifdef NDEBUG
|
||||||
|
#undef FMT_CLANGFALLTHROUGH
|
||||||
|
#define FMT_CLANGFALLTHROUGH [[clang::fallthrough]];
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __GNUC_LIBSTD__
|
#ifdef __GNUC_LIBSTD__
|
||||||
# define FMT_GNUC_LIBSTD_VERSION (__GNUC_LIBSTD__ * 100 + __GNUC_LIBSTD_MINOR__)
|
# define FMT_GNUC_LIBSTD_VERSION (__GNUC_LIBSTD__ * 100 + __GNUC_LIBSTD_MINOR__)
|
||||||
#endif
|
#endif
|
||||||
@ -865,7 +875,8 @@ class ArgVisitor {
|
|||||||
default:
|
default:
|
||||||
assert(false);
|
assert(false);
|
||||||
// Fall through.
|
// Fall through.
|
||||||
case Arg::INT:
|
FMT_CLANGFALLTHROUGH
|
||||||
|
case Arg::INT:
|
||||||
return FMT_DISPATCH(visit_int(arg.int_value));
|
return FMT_DISPATCH(visit_int(arg.int_value));
|
||||||
case Arg::UINT:
|
case Arg::UINT:
|
||||||
return FMT_DISPATCH(visit_uint(arg.uint_value));
|
return FMT_DISPATCH(visit_uint(arg.uint_value));
|
||||||
@ -2442,6 +2453,10 @@ FMT_VARIADIC(int, fprintf, std::FILE *, StringRef)
|
|||||||
# pragma GCC diagnostic pop
|
# pragma GCC diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef __clang__
|
||||||
|
# pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef FMT_HEADER_ONLY
|
#ifdef FMT_HEADER_ONLY
|
||||||
# include "format.cc"
|
# include "format.cc"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user