diff --git a/stl/inc/format b/stl/inc/format index 65ee0f5b3dd..cf42efcc5cc 100644 --- a/stl/inc/format +++ b/stl/inc/format @@ -64,8 +64,7 @@ _STL_DISABLE_CLANG_WARNINGS #pragma push_macro("new") #undef new -extern "C" _NODISCARD __std_win_error __stdcall __std_get_cvt( - const __std_code_page _Codepage, _Cvtvec* const _Pcvt) noexcept; +extern "C" _NODISCARD __std_win_error __stdcall __std_get_cvt(__std_code_page _Codepage, _Cvtvec* _Pcvt) noexcept; _STD_BEGIN @@ -502,9 +501,8 @@ protected: #ifndef _FORMAT_CODEPAGE #define _FORMAT_CODEPAGE __std_code_page::_Acp #endif // _FORMAT_CODEPAGE - if (__std_get_cvt(_FORMAT_CODEPAGE, &_Cvt) != __std_win_error::_Success) { - _THROW(format_error("failed to retrieve codepage info")); - } + [[maybe_unused]] const __std_win_error _Result = __std_get_cvt(_FORMAT_CODEPAGE, &_Cvt); + _STL_INTERNAL_CHECK(_Result == __std_win_error::_Success); #undef _FORMAT_CODEPAGE } }; @@ -538,7 +536,7 @@ private: return (_Len >= 4) ? 4 : -1; } - _NODISCARD static constexpr int _Estimate_utf8_character_width(const char* const _Ptr, const int _Units) noexcept { + _NODISCARD static int _Estimate_utf8_character_width(const char* const _Ptr, const int _Units) noexcept { // Return an estimate for the width of the character composed of _Units code units, // whose first code unit is denoted by _Ptr. auto _Ch = static_cast(*_Ptr); @@ -634,7 +632,6 @@ public: template class _Fmt_codec { -private: public: _NODISCARD int _Units_in_next_character(const wchar_t* _First, const wchar_t* _Last) const noexcept { // Returns a count of the number of code units that compose the first encoded character in @@ -949,15 +946,15 @@ template _HandlerT> void _Parse_format_string(basic_string_view<_CharT> _Format_str, _HandlerT&& _Handler) { auto _Begin = _Format_str.data(); auto _End = _Begin + _Format_str.size(); - const _Fmt_codec<_CharT> _Counter{}; + const _Fmt_codec<_CharT> _Codec; while (_Begin != _End) { const _CharT* _OpeningCurl = _Begin; if (*_Begin != '{') { - _OpeningCurl = _Counter._Find_encoded(_Begin, _End, _CharT{'{'}); + _OpeningCurl = _Codec._Find_encoded(_Begin, _End, _CharT{'{'}); for (;;) { - const _CharT* _ClosingCurl = _Counter._Find_encoded(_Begin, _OpeningCurl, _CharT{'}'}); + const _CharT* _ClosingCurl = _Codec._Find_encoded(_Begin, _OpeningCurl, _CharT{'}'}); // In this case there are neither closing nor opening curls in [_Begin, _OpeningCurl) // Write the whole thing out. diff --git a/stl/msbuild/stl_base/stl.files.settings.targets b/stl/msbuild/stl_base/stl.files.settings.targets index 05ff1f5ddbb..15aa0fbc463 100644 --- a/stl/msbuild/stl_base/stl.files.settings.targets +++ b/stl/msbuild/stl_base/stl.files.settings.targets @@ -161,6 +161,7 @@ SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception (controlled by IncludeInLink and IncludeInImportLib). --> (_Codepage), _Flags, &_Info) == 0) { // NB: the only documented failure mode for GetCPInfoExW is ERROR_INVALID_PARAMETER, // so in practice it should never fail for CP_ACP. return __std_win_error{GetLastError()};