forked from mpusz/mp-units
[msvc][fmt] diable warning in smalest scope
This commit is contained in:
@@ -48,12 +48,6 @@ import std;
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(push)
|
|
||||||
#pragma warning(disable : 4702)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// most of the below code is based on/copied from fmtlib
|
// most of the below code is based on/copied from fmtlib
|
||||||
|
|
||||||
namespace mp_units::detail {
|
namespace mp_units::detail {
|
||||||
@@ -195,6 +189,10 @@ constexpr void handle_dynamic_spec(int& value, fmt_arg_ref<typename Context::cha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning(push)
|
||||||
|
#pragma warning(disable : 4702)
|
||||||
|
#endif
|
||||||
struct width_checker {
|
struct width_checker {
|
||||||
template<typename T>
|
template<typename T>
|
||||||
[[nodiscard]] constexpr unsigned long long operator()(T value) const
|
[[nodiscard]] constexpr unsigned long long operator()(T value) const
|
||||||
@@ -205,10 +203,13 @@ struct width_checker {
|
|||||||
return static_cast<unsigned long long>(value);
|
return static_cast<unsigned long long>(value);
|
||||||
}
|
}
|
||||||
MP_UNITS_THROW(MP_UNITS_STD_FMT::format_error("width is not integer"));
|
MP_UNITS_THROW(MP_UNITS_STD_FMT::format_error("width is not integer"));
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma warning( pop )
|
||||||
|
#endif
|
||||||
|
|
||||||
MP_UNITS_EXPORT_END
|
MP_UNITS_EXPORT_END
|
||||||
|
|
||||||
// Parses the range [begin, end) as an unsigned integer. This function assumes
|
// Parses the range [begin, end) as an unsigned integer. This function assumes
|
||||||
@@ -259,7 +260,6 @@ template<typename Char, typename Handler>
|
|||||||
if (c == '%') return begin; // mp-units extension
|
if (c == '%') return begin; // mp-units extension
|
||||||
if (!::mp_units::detail::is_name_start(c)) {
|
if (!::mp_units::detail::is_name_start(c)) {
|
||||||
MP_UNITS_THROW(MP_UNITS_STD_FMT::format_error("invalid format string"));
|
MP_UNITS_THROW(MP_UNITS_STD_FMT::format_error("invalid format string"));
|
||||||
return begin;
|
|
||||||
}
|
}
|
||||||
auto it = begin;
|
auto it = begin;
|
||||||
do {
|
do {
|
||||||
@@ -378,7 +378,6 @@ template<typename Char, typename Specs>
|
|||||||
if (c == '}') return begin;
|
if (c == '}') return begin;
|
||||||
if (c == '{') {
|
if (c == '{') {
|
||||||
MP_UNITS_THROW(MP_UNITS_STD_FMT::format_error("invalid fill character '{'"));
|
MP_UNITS_THROW(MP_UNITS_STD_FMT::format_error("invalid fill character '{'"));
|
||||||
return begin;
|
|
||||||
}
|
}
|
||||||
specs.fill = {begin, to_unsigned(p - begin)};
|
specs.fill = {begin, to_unsigned(p - begin)};
|
||||||
begin = p + 1;
|
begin = p + 1;
|
||||||
@@ -396,9 +395,4 @@ template<typename Char, typename Specs>
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // namespace mp_units::detail
|
} // namespace mp_units::detail
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning( pop )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// NOLINTEND(cppcoreguidelines-pro-bounds-pointer-arithmetic, cppcoreguidelines-pro-type-union-access)
|
// NOLINTEND(cppcoreguidelines-pro-bounds-pointer-arithmetic, cppcoreguidelines-pro-type-union-access)
|
||||||
|
Reference in New Issue
Block a user