Minor cleanup

This commit is contained in:
Victor Zverovich 2018-06-06 16:51:35 +02:00
parent 691a7a91a1
commit 6322b47e60
4 changed files with 13 additions and 26 deletions

View File

@ -112,7 +112,7 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
endif ()
if (MSVC)
set(PEDANTIC_COMPILE_FLAGS /W4)
set(PEDANTIC_COMPILE_FLAGS /W3)
set(WERROR_FLAG /WX)
endif ()

View File

@ -104,7 +104,7 @@
#if FMT_HAS_CPP_ATTRIBUTE(noreturn)
# define FMT_NORETURN [[noreturn]]
#else
# define FMT_NORETURN /*noreturn*/
# define FMT_NORETURN
#endif
// Check if exceptions are disabled.

View File

@ -146,7 +146,8 @@ FMT_END_NAMESPACE
# define FMT_USE_TRAILING_RETURN 0
#endif
#if FMT_HAS_GXX_CXX11 || FMT_HAS_FEATURE(cxx_rvalue_references) || FMT_MSC_VER >= 1600
#if FMT_HAS_GXX_CXX11 || FMT_HAS_FEATURE(cxx_rvalue_references) || \
FMT_MSC_VER >= 1600
# define FMT_USE_RVALUE_REFERENCES 1
#else
# define FMT_USE_RVALUE_REFERENCES 0
@ -283,18 +284,21 @@ class fp {
typedef uint64_t significand_type;
// All sizes are in bits.
static FMT_CONSTEXPR_DECL const int char_size = std::numeric_limits<unsigned char>::digits;
static FMT_CONSTEXPR_DECL const int char_size =
std::numeric_limits<unsigned char>::digits;
// Subtract 1 to account for an implicit most significant bit in the
// normalized form.
static FMT_CONSTEXPR_DECL const int double_significand_size =
std::numeric_limits<double>::digits - 1;
static FMT_CONSTEXPR_DECL const uint64_t implicit_bit = 1ull << double_significand_size;
static FMT_CONSTEXPR_DECL const uint64_t implicit_bit =
1ull << double_significand_size;
public:
significand_type f;
int e;
static FMT_CONSTEXPR_DECL const int significand_size = sizeof(significand_type) * char_size;
static FMT_CONSTEXPR_DECL const int significand_size =
sizeof(significand_type) * char_size;
fp(uint64_t f, int e): f(f), e(e) {}
@ -1670,13 +1674,6 @@ FMT_CONSTEXPR unsigned parse_nonnegative_int(Iterator &it, ErrorHandler &&eh) {
return value;
}
#if FMT_MSC_VER
// Warns that the compiler cannot generate an assignment operator
// The class has a reference member variable, so this is obviously the case
# pragma warning(push)
# pragma warning(disable: 4512)
#endif
template <typename Char, typename Context>
class custom_formatter: public function<bool> {
private:
@ -1694,10 +1691,6 @@ class custom_formatter: public function<bool> {
bool operator()(T) const { return false; }
};
#if FMT_MSC_VER
# pragma warning(pop)
#endif
template <typename T>
struct is_integer {
enum {

View File

@ -49,10 +49,9 @@ class printf_precision_handler: public function<int> {
}
template <typename T>
typename std::enable_if<!std::is_integral<T>::value, int>::type
operator()(T) {
typename std::enable_if<!std::is_integral<T>::value, int>::type operator()(T) {
FMT_THROW(format_error("precision is not integer"));
return 0; // Silence visual studio
return 0;
}
};
@ -194,7 +193,7 @@ class printf_width_handler: public function<unsigned> {
typename std::enable_if<!std::is_integral<T>::value, unsigned>::type
operator()(T) {
FMT_THROW(format_error("width is not integer"));
return 0; // Silence Visual Studio
return 0;
}
};
} // namespace internal
@ -635,13 +634,8 @@ inline int fprintf(std::FILE *f, string_view format_str, const Args & ... args)
template <typename... Args>
inline int fprintf(std::FILE *f, wstring_view format_str,
const Args & ... args) {
#if FMT_GCC_VERSION && FMT_GCC_VERSION <= 440
return vfprintf<wchar_t>(f, format_str,
make_format_args<typename printf_context<internal::wbuffer>::type>(args...));
#else
return vfprintf(f, format_str,
make_format_args<typename printf_context<internal::wbuffer>::type>(args...));
#endif
}
inline int vprintf(string_view format, printf_args args) {