[fmt] chrono.h, color.h: Suppress some MSVC warnings.

These warnings (now handled as errors) appeared in the AppVeyor build
with MSVC 2015:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\algorithm(1669): error C2220: warning treated as error - no 'object' file generated [build\src\amiibo-data\amiiboc.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\algorithm(1669): warning C4996: 'std::reverse_copy::_Unchecked_iterators::_Deprecate': Call to 'std::reverse_copy' with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators' [build\src\amiibo-data\amiiboc.vcxproj]
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\algorithm(1669): note: see declaration of 'std::reverse_copy::_Unchecked_iterators::_Deprecate'
  extlib\fmt\include\fmt/chrono.h(659): note: see reference to function template instantiation '_OutIt *std::reverse_copy<char*,char*>(_BidIt,_BidIt,_OutIt)' being compiled
          with
          [
              _OutIt=char *,
              _BidIt=char *
          ]
extlib\fmt\include\fmt\color.h(410): warning C4800: 'int': forcing value to bool 'true' or 'false' (performance warning) [build\src\amiibo-data\amiiboc.vcxproj]
  extlib\fmt\include\fmt\color.h(409): note: while compiling class template member function 'bool fmt::v11::detail::ansi_color_escape<Char>::has_emphasis(fmt::v11::emphasis,fmt::v11::emphasis) noexcept'
          with
          [
              Char=wchar_t
          ]
  extlib\fmt\include\fmt\color.h(371): note: see reference to function template instantiation 'bool fmt::v11::detail::ansi_color_escape<Char>::has_emphasis(fmt::v11::emphasis,fmt::v11::emphasis) noexcept' being compiled
          with
          [
              Char=wchar_t
          ]
  extlib\fmt\include\fmt\color.h(450): note: see reference to class template instantiation 'fmt::v11::detail::ansi_color_escape<Char>' being compiled
          with
          [
              Char=wchar_t
          ]
  extlib\fmt\include\fmt/xchar.h(328): note: see reference to function template instantiation 'void fmt::v11::detail::vformat_to<T>(fmt::v11::detail::buffer<T> &,const fmt::v11::text_style &,fmt::v11::basic_string_view<wchar_t>,fmt::v11::basic_format_args<fmt::v11::wformat_context>)' being compiled
          with
          [
              T=wchar_t
          ]
This commit is contained in:
David Korth 2025-03-31 23:58:10 -04:00
parent f6398a63ee
commit 119de9f956
2 changed files with 14 additions and 0 deletions

View File

@ -656,7 +656,14 @@ inline void write_digit2_separated(char* buf, unsigned a, unsigned b,
if (const_check(is_big_endian())) {
char tmp[len];
std::memcpy(tmp, &digits, len);
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4996)
#endif /* _MSC_VER */
std::reverse_copy(tmp, tmp + len, buf);
#ifdef _MSC_VER
# pragma warning(pop)
#endif /* _MSC_VER */
} else {
std::memcpy(buf, &digits, len);
}

View File

@ -405,10 +405,17 @@ template <typename Char> struct ansi_color_escape {
out[2] = static_cast<Char>('0' + c % 10);
out[3] = static_cast<Char>(delimiter);
}
#ifdef _MSC_VER
# pragma warning(push)
# pragma warning(disable: 4800)
#endif /* _MSC_VER */
static FMT_CONSTEXPR auto has_emphasis(emphasis em, emphasis mask) noexcept
-> bool {
return static_cast<uint8_t>(em) & static_cast<uint8_t>(mask);
}
#ifdef _MSC_VER
# pragma warning(pop)
#endif /* _MSC_VER */
};
template <typename Char>