From 7561ff27e51aebce2c9d99c55a6571e05fe357b5 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sat, 15 Feb 2014 10:02:02 -0800 Subject: [PATCH] Fix warnings about unsigned long long as well. --- format.h | 34 ++++++++++++---------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/format.h b/format.h index e44cfc86..e4d40fe4 100644 --- a/format.h +++ b/format.h @@ -70,12 +70,6 @@ # define FMT_NOEXCEPT(expr) #endif -#if FMT_GCC_VERSION >= 406 -# define FMT_GCC_DIAGNOSTIC -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wlong-long" -#endif - #if _MSC_VER # pragma warning(push) # pragma warning(disable: 4521) @@ -87,8 +81,10 @@ namespace fmt { // that don't support the diagnostic pragma. #ifdef __GNUC__ __extension__ typedef long long LongLong; +__extension__ typedef unsigned long long ULongLong; #else typedef long long LongLong; +typedef unsigned long long ULongLong; #endif namespace internal { @@ -241,7 +237,7 @@ template <> struct IntTraits : SignedIntTraits {}; template <> -struct IntTraits : SignedIntTraits {}; +struct IntTraits : SignedIntTraits {}; template struct IsLongDouble { enum {VALUE = 0}; }; @@ -542,7 +538,7 @@ DEFINE_INT_FORMATTERS(long) DEFINE_INT_FORMATTERS(unsigned) DEFINE_INT_FORMATTERS(unsigned long) DEFINE_INT_FORMATTERS(LongLong) -DEFINE_INT_FORMATTERS(unsigned long long) +DEFINE_INT_FORMATTERS(ULongLong) /** \rst @@ -732,8 +728,8 @@ class BasicWriter { /** Formats *value* and writes it to the stream. */ - BasicWriter &operator<<(unsigned long long value) { - return *this << IntFormatSpec(value); + BasicWriter &operator<<(ULongLong value) { + return *this << IntFormatSpec(value); } BasicWriter &operator<<(double value) { @@ -984,7 +980,7 @@ class BasicFormatter { long long_value; unsigned long ulong_value; LongLong long_long_value; - unsigned long long ulong_long_value; + ULongLong ulong_long_value; long double long_double_value; const void *pointer_value; StringValue string; @@ -1000,7 +996,7 @@ class BasicFormatter { Arg(unsigned long value) : type(ULONG), ulong_value(value), formatter(0) {} Arg(LongLong value) : type(LONG_LONG), long_long_value(value), formatter(0) {} - Arg(unsigned long long value) + Arg(ULongLong value) : type(ULONG_LONG), ulong_long_value(value), formatter(0) {} Arg(float value) : type(DOUBLE), double_value(value), formatter(0) {} Arg(double value) : type(DOUBLE), double_value(value), formatter(0) {} @@ -1066,8 +1062,6 @@ class BasicFormatter { int num_open_braces_; int next_arg_index_; - typedef unsigned long long ULongLong; - friend class internal::FormatterProxy; // Forbid copying from a temporary as in the following example: @@ -1293,12 +1287,12 @@ class FormatInt { private: // Buffer should be large enough to hold all digits (digits10 + 1), // a sign and a null character. - enum {BUFFER_SIZE = std::numeric_limits::digits10 + 3}; + enum {BUFFER_SIZE = std::numeric_limits::digits10 + 3}; mutable char buffer_[BUFFER_SIZE]; char *str_; // Formats value in reverse and returns the number of digits. - char *FormatDecimal(unsigned long long value) { + char *FormatDecimal(ULongLong value) { char *buffer_end = buffer_ + BUFFER_SIZE - 1; while (value >= 100) { // Integer division is slow so do it for a group of two digits instead @@ -1320,7 +1314,7 @@ class FormatInt { } void FormatSigned(LongLong value) { - unsigned long long abs_value = value; + ULongLong abs_value = value; bool negative = value < 0; if (negative) abs_value = 0 - value; @@ -1335,7 +1329,7 @@ class FormatInt { explicit FormatInt(LongLong value) { FormatSigned(value); } explicit FormatInt(unsigned value) : str_(FormatDecimal(value)) {} explicit FormatInt(unsigned long value) : str_(FormatDecimal(value)) {} - explicit FormatInt(unsigned long long value) : str_(FormatDecimal(value)) {} + explicit FormatInt(ULongLong value) : str_(FormatDecimal(value)) {} /** Returns the number of characters written to the output buffer. @@ -1428,10 +1422,6 @@ inline Formatter Print(StringRef format) { } } -#ifdef FMT_GCC_DIAGNOSTIC -# pragma GCC diagnostic pop -#endif - #if _MSC_VER # pragma warning(pop) #endif