Fix warnings from edits to master

This commit is contained in:
Elias Kosunen 2018-06-05 02:29:25 +03:00
parent 739af475b3
commit 25f9b090ec
4 changed files with 19 additions and 13 deletions

View File

@ -283,12 +283,12 @@ class fp {
typedef uint64_t significand_type;
// All sizes are in bits.
static constexpr 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 constexpr int double_significand_size =
static FMT_CONSTEXPR_DECL const int double_significand_size =
std::numeric_limits<double>::digits - 1;
static constexpr 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;
@ -317,7 +317,7 @@ class fp {
f += implicit_bit;
else
biased_e = 1; // Subnormals use biased exponent 1 (min exponent).
e = biased_e - exponent_bias - double_significand_size;
e = static_cast<int>(biased_e - exponent_bias - double_significand_size);
}
// Normalizes the value converted from double and multiplied by (1 << SHIFT).
@ -2660,7 +2660,7 @@ class basic_writer {
};
struct double_writer {
unsigned n;
size_t n;
char sign;
basic_memory_buffer<char_type> &buffer;
@ -2914,7 +2914,7 @@ void basic_writer<Range>::write_double(T value, const format_specs &spec) {
internal::fp product = fp_value * dec_pow;
// Generate output.
internal::fp one(1ull << -product.e, product.e);
uint32_t hi = product.f >> -one.e;
uint64_t hi = product.f >> -one.e;
uint64_t f = product.f & (one.f - 1);
typedef back_insert_range<internal::basic_buffer<char_type>> range;
basic_writer<range> w{range(buffer)};
@ -2934,7 +2934,7 @@ void basic_writer<Range>::write_double(T value, const format_specs &spec) {
normalized_spec.type_ = handler.type;
write_double_sprintf(value, normalized_spec, buffer);
}
unsigned n = buffer.size();
size_t n = buffer.size();
align_spec as = spec;
if (spec.align() == ALIGN_NUMERIC) {
if (sign) {

View File

@ -36,7 +36,7 @@ elseif (CMAKE_CXX_STANDARD EQUAL 14)
set(CXX_STANDARD_FLAG -std=c++1y)
endif ()
elseif (CMAKE_CXX_STANDARD EQUAL 11)
check_cxx_compiler_flag(-std=c++11 has_std_14_flag)
check_cxx_compiler_flag(-std=c++11 has_std_11_flag)
check_cxx_compiler_flag(-std=c++0x has_std_0x_flag)
if (has_std_11_flag)

View File

@ -150,8 +150,6 @@ if (FMT_PEDANTIC)
target_include_directories(no-windows-h-test SYSTEM PUBLIC gtest gmock)
endif ()
message(STATUS USER_DEFINED_LITERALS: ${SUPPORTS_USER_DEFINED_LITERALS})
add_test(compile-test ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMAKE_CURRENT_SOURCE_DIR}/compile-test"

View File

@ -475,7 +475,13 @@ double _strtod_l(const char *nptr, char **endptr, _locale_t locale) {
# pragma warning(pop)
#endif
LocaleType newlocale(int category_mask, const char *locale, LocaleType base) {
#if defined(__THROW) && FMT_GCC_VERSION > 0 && FMT_GCC_VERSION <= 408
#define FMT_LOCALE_THROW __THROW
#else
#define FMT_LOCALE_THROW
#endif
LocaleType newlocale(int category_mask, const char *locale, LocaleType base) FMT_LOCALE_THROW {
return LocaleMock::instance->newlocale(category_mask, locale, base);
}
@ -485,15 +491,17 @@ typedef int FreeLocaleResult;
typedef void FreeLocaleResult;
#endif
FreeLocaleResult freelocale(LocaleType locale) {
FreeLocaleResult freelocale(LocaleType locale) FMT_LOCALE_THROW {
LocaleMock::instance->freelocale(locale);
return FreeLocaleResult();
}
double strtod_l(const char *nptr, char **endptr, LocaleType locale) {
double strtod_l(const char *nptr, char **endptr, LocaleType locale) FMT_LOCALE_THROW {
return LocaleMock::instance->strtod_l(nptr, endptr, locale);
}
#undef FMT_LOCALE_THROW
TEST(LocaleTest, LocaleMock) {
ScopedMock<LocaleMock> mock;
LocaleType locale = reinterpret_cast<LocaleType>(11);