mirror of
https://github.com/nlohmann/json.git
synced 2026-07-30 14:24:53 +00:00
Fix CI failures in from_chars locale handling (PR #5237)
Three issues in the extended-locale number parsing were breaking CI:
- On Windows, _create_locale() was called with LC_ALL_MASK, a POSIX-only
constant that doesn't exist in the Windows CRT; it needs LC_ALL there.
- `::isspace_l`/`::_isspace_l` were called with a leading `::`, but on
glibc, mingw-w64 and some other C libraries these are macros that expand
to a parenthesized expression, so `::` followed by the expansion is a
syntax error ("expected unqualified-id"). Dropping the `::` fixes this
on all affected toolchains (gcc/clang on Linux, nvcc, mingw).
- The Windows implementation assumed the full `_<funcname>_l` family is
always available, but some MinGW toolchains only provide a subset
(e.g. missing `_strtoll_l`/`_strtoull_l`/`_strtof_l`/`_strtold_l`).
The extended-locale fast path is now only used for genuine MSVC
(including clang-cl, which mimics the MSVC ABI/CRT); other Windows
toolchains fall back to the locale-dependent standard functions.
Also fixes a clang-tidy hicpp-named-parameter/readability-named-parameter
warning-as-error on two unnamed `init_val_t` test parameters.
Verified locally with gcc/clang on Linux, clang++ in C++20 mode, and
mingw-w64 (both g++ and clang targeting x86_64-w64-mingw32).
This commit is contained in:
@@ -79,7 +79,7 @@ check(std::string str, T expected_value, std::ptrdiff_t expected_ptr_offset, std
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::is_integral<T>::value, void>::type
|
||||
check(std::string str, init_val_t, std::ptrdiff_t expected_ptr_offset, std::errc expected_ec)
|
||||
check(std::string str, init_val_t /*unused*/, std::ptrdiff_t expected_ptr_offset, std::errc expected_ec)
|
||||
{
|
||||
T const init_value = 42;
|
||||
T value = init_value;
|
||||
@@ -89,7 +89,7 @@ check(std::string str, init_val_t, std::ptrdiff_t expected_ptr_offset, std::errc
|
||||
|
||||
template <typename T>
|
||||
typename std::enable_if<std::is_floating_point<T>::value, void>::type
|
||||
check(std::string str, init_val_t, std::ptrdiff_t expected_ptr_offset, std::errc expected_ec)
|
||||
check(std::string str, init_val_t /*unused*/, std::ptrdiff_t expected_ptr_offset, std::errc expected_ec)
|
||||
{
|
||||
{
|
||||
T const init_value = 42;
|
||||
|
||||
Reference in New Issue
Block a user