Instead of listing all enum values, turn off warning for Visual Studio

This commit is contained in:
David Connet 2022-01-03 08:55:08 -08:00
parent 66e4723eaf
commit 361f741db1
2 changed files with 14 additions and 19 deletions

View File

@ -2739,6 +2739,10 @@ FMT_CONSTEXPR auto parse_float_type_spec(const basic_format_specs<Char>& specs,
auto result = float_specs(); auto result = float_specs();
result.showpoint = specs.alt; result.showpoint = specs.alt;
result.locale = specs.localized; result.locale = specs.localized;
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4061)
#endif
switch (specs.type) { switch (specs.type) {
case presentation_type::none: case presentation_type::none:
result.format = float_format::general; result.format = float_format::general;
@ -2769,19 +2773,13 @@ FMT_CONSTEXPR auto parse_float_type_spec(const basic_format_specs<Char>& specs,
case presentation_type::hexfloat_lower: case presentation_type::hexfloat_lower:
result.format = float_format::hex; result.format = float_format::hex;
break; break;
case presentation_type::dec:
case presentation_type::oct:
case presentation_type::hex_lower:
case presentation_type::hex_upper:
case presentation_type::bin_lower:
case presentation_type::bin_upper:
case presentation_type::chr:
case presentation_type::string:
case presentation_type::pointer:
default: default:
eh.on_error("invalid type specifier"); eh.on_error("invalid type specifier");
break; break;
} }
#ifdef _MSC_VER
#pragma warning(pop)
#endif
return result; return result;
} }

View File

@ -1572,6 +1572,10 @@ FMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, write_int_arg<T> arg,
static_assert(std::is_same<T, uint32_or_64_or_128_t<T>>::value, ""); static_assert(std::is_same<T, uint32_or_64_or_128_t<T>>::value, "");
auto abs_value = arg.abs_value; auto abs_value = arg.abs_value;
auto prefix = arg.prefix; auto prefix = arg.prefix;
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4061)
#endif
switch (specs.type) { switch (specs.type) {
case presentation_type::none: case presentation_type::none:
case presentation_type::dec: { case presentation_type::dec: {
@ -1621,19 +1625,12 @@ FMT_CONSTEXPR FMT_INLINE auto write_int(OutputIt out, write_int_arg<T> arg,
} }
case presentation_type::chr: case presentation_type::chr:
return write_char(out, static_cast<Char>(abs_value), specs); return write_char(out, static_cast<Char>(abs_value), specs);
case presentation_type::hexfloat_lower:
case presentation_type::hexfloat_upper:
case presentation_type::exp_lower:
case presentation_type::exp_upper:
case presentation_type::fixed_lower:
case presentation_type::fixed_upper:
case presentation_type::general_lower:
case presentation_type::general_upper:
case presentation_type::string:
case presentation_type::pointer:
default: default:
throw_format_error("invalid type specifier"); throw_format_error("invalid type specifier");
} }
#ifdef _MSC_VER
#pragma warning(pop)
#endif
return out; return out;
} }
template <typename Char, typename OutputIt, typename T> template <typename Char, typename OutputIt, typename T>