| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
Broaden JSON_HEDLEY_WARN_UNUSED_RESULT coverage to pure query functions (#5477) * Broaden JSON_HEDLEY_WARN_UNUSED_RESULT coverage to pure query functions Add JSON_HEDLEY_WARN_UNUSED_RESULT to the unambiguous, const, side-effect-free observer functions whose return value is the entire purpose of the call: - dump() - type(), type_name() - all is_* predicates (is_primitive, is_structured, is_null, is_boolean, is_number, is_number_integer, is_number_unsigned, is_number_float, is_object, is_array, is_string, is_binary, is_discarded) - empty(), size(), max_size() - count(...) (both overloads) and contains(...) (all overloads, including the deprecated json_pointer<BasicJsonType> overload) This mirrors the direction the standard library has taken with [[nodiscard]] on the analogous std::vector/std::map members, and catches real bugs such as `j.empty();` (meant `j.clear();`) or `j.contains(k);` with the result thrown away. Deliberately out of scope (left for a separate, later policy decision, per the issue): at(), value(), get*(), flatten(), unflatten(), patch(), merge_patch(), begin()/end(), comparison operators, erase(), and emplace(). Compiling the full test suite (tests/src/unit-*.cpp) with -Wunused-result -Werror uncovered one real hit: a regression test in unit-regression2.cpp called dump() purely to check it does not throw, discarding the result. Fixed by explicitly casting to void, since the call is intentionally result-less there. Fixes #5410 Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix discarded nodiscard results across the test suite for GCC's warn_unused_result A plain (void) cast on a call expression suppresses the C++17 [[nodiscard]] warning but not GCC's warning for functions annotated via the GNU __attribute__((warn_unused_result)) form -- which is what JSON_HEDLEY_WARN_UNUSED_RESULT expands to on GCC. Several existing tests that call a newly-annotated function (dump(), empty()) purely to check that it throws/does not throw, discarding the result via (void), newly warned (and failed -Werror builds) once the annotation was broadened. Route those discards through a small ignore_return_value() helper instead, which actually consumes the value and suppresses the warning on both attribute forms. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Use utils::ignore_return_value() for the issue #1445 dump() discard too Addresses review feedback from @gregmarr on PR #5477: this call site was still using the older "capture in a variable, then (void) it" pattern from before this PR introduced utils::ignore_return_value(), instead of the helper now used at every other discarded-nodiscard-result call site this PR touches. Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 13 小时前 | |
reject CBOR array/map length equal to the indefinite-length marker (#5274) * reject CBOR array/map length equal to the indefinite-length marker Signed-off-by: Angadi Yashaswini <angadi@digiscrypt.com> * reject CBOR lengths that do not fit in std::size_t via value_in_range_of Signed-off-by: Angadi Yashaswini <angadi@digiscrypt.com> --------- Signed-off-by: Angadi Yashaswini <angadi@digiscrypt.com> | 1 个月前 | |
:lock: fix security findings (#5245) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 2 个月前 | |
Fix stale Clang -Weverything suppression comments; drop -Wno-missing-noreturn (#5250) * Fix stale Clang -Weverything suppression comments; eliminate -Wno-missing-noreturn cmake/clang_flags.cmake claimed -Wno-unsafe-buffer-usage was needed only for Doctest and that -Wno-missing-noreturn had "no way to silence... otherwise" (PR #4871, which never actually attempted a source fix). Neither held up under investigation (todo 130): - -Wno-unsafe-buffer-usage is pervasive (208 distinct sites across 19 files measured with clang trunk in silkeh/clang:dev), spanning the library's own low-level numeric/buffer code (to_chars, serializer, lexer, binary reader/writer, input adapters, json_pointer) as well as vendored Doctest itself (96 of the 208 sites). A source-level fix is not feasible at this scale; the comment now says so instead of blaming Doctest alone. - -Wno-missing-noreturn had exactly two real trigger sites, both genuinely and unconditionally non-returning: a test-only throwing allocator (tests/src/unit-allocator.cpp) and, previously undiscovered, wide_string_input_adapter::get_elements<T>() in include/nlohmann/detail/input/input_adapters.hpp. Verified this isn't a wider pattern by checking all 160 JSON_THROW call sites in the library for functions whose entire body is an unconditional throw. Annotated both ([[noreturn]] in the test file, since JSON_HEDLEY_NO_RETURN is #undef'd by the time test code runs; JSON_HEDLEY_NO_RETURN in the library file, its first real use anywhere in the codebase) and dropped the suppression entirely. single_include/nlohmann/json.hpp regenerated via `make amalgamate`; `make check-amalgamation` passes. Verified in Docker (silkeh/clang:dev, matching the ci_static_analysis_clang CI job): baseline builds clean, and the full 194-target test suite builds with zero warnings under the corrected CLANG_CXXFLAGS (-Wno-missing-noreturn no longer in the list). Also sanity-compiled and ran unit-allocator.cpp and unit-wstring.cpp on host Apple Clang to confirm behavior is unchanged. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix MSVC C4702 warning caused by JSON_HEDLEY_NO_RETURN on get_elements() PR #5250 annotated wide_string_input_adapter::get_elements<T>() with JSON_HEDLEY_NO_RETURN (it unconditionally throws). On MSVC this expands to __declspec(noreturn), and MSVC correctly determined that the code following its call in binary_reader.hpp is unreachable for that instantiation, firing C4702 under /W4 /WX in the msvc, msvc-vs2026, and msvc-arm64 Debug jobs. Clang doesn't flag this case, so the Docker verification for #5250 (which only checked Clang -Weverything) didn't catch it. This is the same warning class already tolerated for Release builds since PR #5216, where MSVC's optimizer independently found the same dead code after /Od was removed. Extend that existing /wd4702 suppression to Debug builds too, instead of reverting the noreturn annotation. Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 2 个月前 | |
:memo: Document cross-basic_json conversion limitation (#3425) (#5249) When converting objects or strings between different basic_json specializations, the target's object_t::key_type or string_t must be directly constructible from the source's corresponding type. If this requirement is not met, the conversion silently falls back to the array-conversion path, producing incorrect results. This documents the limitation and provides references to issue #3425, which tracks this behavior. The comment in unit-alt-string.cpp is clarified to reference the known limitation with a link to the issue, and suggests the parse() workaround. Fixes #3425 (documentation; full fix deferred pending type-trait redesign) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 2 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
Fix to_bjdata() emitting unparsable output when _ArraySize_ is not an array (#5455) * Fix to_bjdata() emitting unparsable output when _ArraySize_ is not an array write_bjdata_ndarray() never checked that _ArraySize_ is an array. The shape is written verbatim as the header length, so a null shape emitted 'Z' and an object shape emitted '{' after the '#', neither of which from_bjdata() accepts, and the round-trip guarantee in the BJData docs was broken. Both slipped through the existing validation: for null, empty() is true so the element count starts at 0 and the per-dimension loop never runs, and for an object the loop walks its values, which can satisfy the non-negative integer check. When _ArrayData_ then matched that count, the writer took the ndarray path. Require the shape to be an array, so anything else falls back to a plain object encoding that round-trips, as the fallback rule in the docs already specifies. Signed-off-by: qatcod <79017227+qatcod@users.noreply.github.com> * Document that _ArraySize_ must be an array in the ndarray requirements The list at bjdata.md is the exhaustive set of conditions for the ndarray encoding, but it only implied this one through 'every entry of'. Signed-off-by: qatcod <79017227+qatcod@users.noreply.github.com> --------- Signed-off-by: qatcod <79017227+qatcod@users.noreply.github.com> | 4 天前 | |
Add test coverage for documented lenient BSON input handling (#5478) * Add test coverage for documented lenient BSON input handling Issue #5333 documented three intentionally-lenient behaviors of the BSON reader (any non-zero byte accepted as a boolean `true`, BSON array element keys not validated against the required decimal sequence, and the payload of binary subtype 0x02 "old binary" returned as-is including its inner length prefix), but none of them was pinned by a test, so a future change could silently regress the documented behavior. Also add coverage for the out_of_range.412 length-overflow check (shared by binary, string, and (sub-)document BSON length fields) for the string and document cases; only the binary case was previously tested. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix 32-bit overflow in huge_string_t BSON length-overflow tests huge_string_t doubles as basic_json's StringType, so it is used not only for the JSON string value under test but also for object keys (e.g. "s", "nested"). Making size() unconditionally lie about being huge therefore inflated the keys' reported sizes as well, pushing the running totals computed while walking the BSON document (calc_bson_object_size and friends in binary_writer.hpp) past what a 32-bit std::size_t can hold. On 64-bit platforms this happens to still produce a working (if needlessly large) result, but on 32-bit platforms (e.g. the mingw x86 CI job) the size_t arithmetic silently wraps around: for the "document" test this merely surfaces the wrong number in the exception message, but for the "string" test the wrapped total happens to fall back under INT32_MAX, so the intended out_of_range.412 guard is skipped entirely and the code goes on to actually write ~2 GiB worth of characters from the key's real, tiny buffer - which is what raised the reported "vector::_M_range_insert" exception instead of a controlled 412. Make the fake-huge size opt-in via huge_string_t::as_huge() and only apply it to the string value under test, leaving keys at their real (small) size. This keeps every intermediate size well within 32-bit size_t range on any platform, matching how huge_binary_t already avoids the same trap (it is only ever used as the BSON value type, never as a key). Expected out_of_range.412 messages are updated accordingly. Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 13 小时前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
Fix CBOR tag handlers not recognizing tags 0-5 and 21-23 (#5331) * Fix CBOR tag handlers not recognizing tags 0-5 and 21-23 The tagged-item switch in binary_reader::parse_cbor_internal() only handled head bytes 0xC6-0xD4 and 0xD8-0xDB. Bytes 0xC0-0xC5 (tags 0-5: date/time, epoch, bignum, decimal, bigfloat) and 0xD5-0xD7 (tags 21-23: base64url, base64, base16 conversion hints) fell through to the default case and were reported as invalid bytes, even under cbor_tag_handler_t::ignore and ::store, despite being valid CBOR major-type-6 tags per RFC 8949. Add the missing case labels so the full 0xC0-0xDB range is handled uniformly. Extend the "Tagged values" test in unit-cbor.cpp to cover 0xC0-0xD7, and update the CBOR docs to state the corrected tag range. Fixes #5315 Signed-off-by: sahilkamate03 <45514385+sahilkamate03@users.noreply.github.com> * Fix stale CBOR tag docs and add store-mode binary-payload test The "Incomplete mapping" warning still listed tags 0-5 (date/time, bignum, decimal fraction, bigfloat) and 21-23 (expected conversions) as unsupported, even though they now parse correctly under cbor_tag_handler_t::ignore/store, same as 0xC6..0xD4/0xD8..0xDB. Remove those five bullets and cross-reference the "Tagged items" warning below, matching the equivalent docs fix landed independently in PR #5367. Also add a cbor_tag_handler_t::store test that wraps a binary payload (not just a string) for every byte in 0xC0..0xD7, confirming these tags are unwrapped the same way as 0xC6..0xD4 rather than mistaken for the 0xD8..0xDB binary-subtype marker syntax, per review feedback on #5331. Signed-off-by: sahilkamate03 <45514385+sahilkamate03@users.noreply.github.com> --------- Signed-off-by: sahilkamate03 <45514385+sahilkamate03@users.noreply.github.com> | 21 天前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
Broaden JSON_HEDLEY_WARN_UNUSED_RESULT coverage to pure query functions (#5477) * Broaden JSON_HEDLEY_WARN_UNUSED_RESULT coverage to pure query functions Add JSON_HEDLEY_WARN_UNUSED_RESULT to the unambiguous, const, side-effect-free observer functions whose return value is the entire purpose of the call: - dump() - type(), type_name() - all is_* predicates (is_primitive, is_structured, is_null, is_boolean, is_number, is_number_integer, is_number_unsigned, is_number_float, is_object, is_array, is_string, is_binary, is_discarded) - empty(), size(), max_size() - count(...) (both overloads) and contains(...) (all overloads, including the deprecated json_pointer<BasicJsonType> overload) This mirrors the direction the standard library has taken with [[nodiscard]] on the analogous std::vector/std::map members, and catches real bugs such as `j.empty();` (meant `j.clear();`) or `j.contains(k);` with the result thrown away. Deliberately out of scope (left for a separate, later policy decision, per the issue): at(), value(), get*(), flatten(), unflatten(), patch(), merge_patch(), begin()/end(), comparison operators, erase(), and emplace(). Compiling the full test suite (tests/src/unit-*.cpp) with -Wunused-result -Werror uncovered one real hit: a regression test in unit-regression2.cpp called dump() purely to check it does not throw, discarding the result. Fixed by explicitly casting to void, since the call is intentionally result-less there. Fixes #5410 Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix discarded nodiscard results across the test suite for GCC's warn_unused_result A plain (void) cast on a call expression suppresses the C++17 [[nodiscard]] warning but not GCC's warning for functions annotated via the GNU __attribute__((warn_unused_result)) form -- which is what JSON_HEDLEY_WARN_UNUSED_RESULT expands to on GCC. Several existing tests that call a newly-annotated function (dump(), empty()) purely to check that it throws/does not throw, discarding the result via (void), newly warned (and failed -Werror builds) once the annotation was broadened. Route those discards through a small ignore_return_value() helper instead, which actually consumes the value and suppresses the warning on both attribute forms. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Use utils::ignore_return_value() for the issue #1445 dump() discard too Addresses review feedback from @gregmarr on PR #5477: this call site was still using the older "capture in a variable, then (void) it" pattern from before this PR introduced utils::ignore_return_value(), instead of the helper now used at every other discarded-nodiscard-result call site this PR touches. Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 13 小时前 | |
Broaden JSON_HEDLEY_WARN_UNUSED_RESULT coverage to pure query functions (#5477) * Broaden JSON_HEDLEY_WARN_UNUSED_RESULT coverage to pure query functions Add JSON_HEDLEY_WARN_UNUSED_RESULT to the unambiguous, const, side-effect-free observer functions whose return value is the entire purpose of the call: - dump() - type(), type_name() - all is_* predicates (is_primitive, is_structured, is_null, is_boolean, is_number, is_number_integer, is_number_unsigned, is_number_float, is_object, is_array, is_string, is_binary, is_discarded) - empty(), size(), max_size() - count(...) (both overloads) and contains(...) (all overloads, including the deprecated json_pointer<BasicJsonType> overload) This mirrors the direction the standard library has taken with [[nodiscard]] on the analogous std::vector/std::map members, and catches real bugs such as `j.empty();` (meant `j.clear();`) or `j.contains(k);` with the result thrown away. Deliberately out of scope (left for a separate, later policy decision, per the issue): at(), value(), get*(), flatten(), unflatten(), patch(), merge_patch(), begin()/end(), comparison operators, erase(), and emplace(). Compiling the full test suite (tests/src/unit-*.cpp) with -Wunused-result -Werror uncovered one real hit: a regression test in unit-regression2.cpp called dump() purely to check it does not throw, discarding the result. Fixed by explicitly casting to void, since the call is intentionally result-less there. Fixes #5410 Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix discarded nodiscard results across the test suite for GCC's warn_unused_result A plain (void) cast on a call expression suppresses the C++17 [[nodiscard]] warning but not GCC's warning for functions annotated via the GNU __attribute__((warn_unused_result)) form -- which is what JSON_HEDLEY_WARN_UNUSED_RESULT expands to on GCC. Several existing tests that call a newly-annotated function (dump(), empty()) purely to check that it throws/does not throw, discarding the result via (void), newly warned (and failed -Werror builds) once the annotation was broadened. Route those discards through a small ignore_return_value() helper instead, which actually consumes the value and suppresses the warning on both attribute forms. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Use utils::ignore_return_value() for the issue #1445 dump() discard too Addresses review feedback from @gregmarr on PR #5477: this call site was still using the older "capture in a variable, then (void) it" pattern from before this PR introduced utils::ignore_return_value(), instead of the helper now used at every other discarded-nodiscard-result call site this PR touches. Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 13 小时前 | |
Compare integers with floats exactly instead of widening the integer (#5459) The mixed number arms of JSON_IMPLEMENT_OPERATOR cast the integer to number_float_t before comparing. Past the float's mantissa that cast is lossy: 2^63-2 and 2^63-1 both round to 2^63, so each compares equal to that float while differing from each other. Equality is therefore intransitive and the ordering is not a strict weak ordering, which makes std::sort over such values, or using them as keys in std::set or std::map, undefined behavior. Compare the two exactly instead. The integer's range is a power of two the float represents exactly, so a float outside it is ordered by magnitude alone; inside it, truncating the float is exact, and the integer parts and then any fractional part decide. The helper hands back a pair whose comparison with the original operator reproduces that ordering, which keeps every operator's return type as it was, including partial_ordering for the spaceship. A NaN operand is returned in both members, so NaN stays false for the relational operators and unordered for <=>. Values a float represents exactly still compare equal, so json(1) == json(1.0) is unchanged. Signed-off-by: qatcod <79017227+qatcod@users.noreply.github.com> | 4 天前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
Fix #3868: Remove operator!= to enable P2468R2 rewritten candidate synthesis (#5253) * Fix #3868: Remove operator!= to enable P2468R2 rewritten candidate synthesis Under C++20 P2468R2, a hand-written operator!= suppresses the compiler's rewritten-candidate synthesis for operator==, preventing heterogeneous comparisons like `std::string s; json j; s == j;` from compiling. Fix by removing the hand-written operator!=, allowing the compiler to synthesize != as !(a==b) in all language modes (C++20 member functions and pre-C++20 friend functions). Behavior change: operator!= now returns !(a==b) unconditionally, including for special values like NaN and discarded. This means: - NaN != NaN now returns true (matches IEEE-754 semantics) - discarded != x now returns true for any x (matches !(discarded == x)) This also fixes underlying defects in previously-working code: - Restores direct == comparison for views vs json (reverts std::ranges::equal workaround added in PR #3950 to dodge this bug) - Re-enables std::string == json comparisons (uncomments check in unit-constructor1.cpp) Fixes: #3868, #3979 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Niels Lohmann <mail@nlohmann.me> * :rotating_light: fix warning Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> | 2 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
Replace snprintf with a branch-free writer for \uXXXX escapes (#5235) * Replace snprintf with a branch-free writer for \uXXXX escapes dump_escaped called std::snprintf(..., "\u%04x", ...) once per escaped code point in the string serialization hot path. snprintf re-parses the format string and pulls in locale/printf machinery on every call, which is far heavier than the fixed 6-/12-byte output warrants. This is hot for any string containing control characters, and for all non-ASCII text when ensure_ascii is set. Replace it with write_u_escape, a small helper that writes the escape directly into string_buffer via a nibble-to-hex lookup table, mirroring the existing hand-rolled dump_integer fast path in the same file. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix clang-tidy avoid-c-arrays warning in write_u_escape Use a const char* rather than a char[] lookup table, matching the existing hex_bytes helper in the same file. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * :recycle: adjust write_u_escape signature Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 2 个月前 | |
Reserve capacity in from_json() object conversion when the target container supports it (#5472) * Reserve capacity in from_json() object conversion when supported The object-to-container from_json() overload filled the target container one element at a time without reserving capacity, even when the target type supports reserve() (e.g. std::unordered_map) and the number of elements is already known. This caused unnecessary rehashing while parsing large objects into such containers. Add a reserve-detecting overload (from_json_object_impl), mirroring the priority_tag-based SFINAE technique already used by the array conversion path (from_json_array_impl), so that reserve(size()) is called up front when available and the loop falls back unchanged otherwise (e.g. for std::map). Fixes #5406 Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Update doc example outputs for new object-conversion iteration order Reserving capacity in from_json()'s object-conversion path before inserting elements changes libstdc++'s std::unordered_map bucket layout, which changes the iteration order used by get__ValueType_const.cpp, get_to.cpp and operator__ValueType.cpp to print the elements of a converted std::unordered_map<std::string, json>. Verified against a clean develop checkout (built with the same GCC/libstdc++ used in CI) that the old order was produced without this PR's change and the new order is produced with it, and that the three affected examples now match their updated expected output byte-for-byte. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Factor out a reserve-dispatch helper instead of duplicating the object from_json loop Addresses review feedback from @gregmarr on PR #5472: the emplace loop no longer needs to exist twice for the reserve/no-reserve cases. A small from_json_object_reserve() overload pair (SFINAE-dispatched on whether reserve() exists, mirroring the priority_tag technique used elsewhere) either calls reserve() or is a no-op; from_json_object_impl() calls it once. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Inline from_json_object_impl into from_json now that it is called only once Addresses review feedback from @gregmarr on PR #5472: with the reserve loop de-duplicated, from_json_object_impl no longer needs to be a separate function that from_json immediately delegates to. Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 13 小时前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
avoid sign extension in char_traits<signed char>::to_int_type (#5336) * avoid sign extension in char_traits<signed char>::to_int_type Signed-off-by: Angadi Yashaswini <angadi@digiscrypt.com> * spell out-of-range signed char constants as negative values (MSVC C4309) Signed-off-by: Angadi Yashaswini <angadi@digiscrypt.com> --------- Signed-off-by: Angadi Yashaswini <angadi@digiscrypt.com> | 1 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
Fix start_pos() for strings containing escape sequences (#5361) The diagnostic position of a string value was derived by subtracting the parsed value's length from the end position. Escape sequences make the source token longer than the value it parses to, so the reported start position landed inside the string, one byte off per escape sequence: input: {"a":"\n\n\n\n\n\n"} start_pos() == 11, so the reported range covered n\n\n\n" instead of the documented "\n\n\n\n\n\n" This contradicts the documented behavior of start_pos(), which is the position of the opening quote, and it also corrupted the "(bytes N-M)" part of JSON_DIAGNOSTICS exception messages. Strings with multi-byte UTF-8 but no escapes were unaffected, which is why this went unnoticed. Record the offset of the token in the lexer when it starts scanning and use that, instead of reconstructing it from the parsed value. Booleans, null and numbers already reported correct positions and are unchanged. The new lexer member and accessor are compiled only when JSON_DIAGNOSTIC_POSITIONS is enabled, which is already part of the ABI tag, so the default build is unaffected. Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 1 个月前 | |
Fix: update() parent pointers not updated after recursive merge with JSON_DIAGNOSTICS (#5187) * added fix for issue 4813 Signed-off-by: VasuBhakt <cpswastik31@gmail.com> * added regression test for 4813 Signed-off-by: VasuBhakt <cpswastik31@gmail.com> * moved test from unit-regression2 to unit-diagnostics Signed-off-by: VasuBhakt <cpswastik31@gmail.com> --------- Signed-off-by: VasuBhakt <cpswastik31@gmail.com> | 3 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
Extend value to arrays when using JSON pointers (#5223) * :sparkles: extend value to arrays when using JSON pointers Signed-off-by: Niels Lohmann <mail@nlohmann.me> * :green_heart: avoid exceptions Signed-off-by: Niels Lohmann <mail@nlohmann.me> * :green_heart: avoid exceptions Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 2 个月前 | |
Add std::format and fmt support (#5224) * :sparkles: add std::format and fmt support Signed-off-by: Niels Lohmann <mail@nlohmann.me> * :recycle: reorganize PR Signed-off-by: Niels Lohmann <mail@nlohmann.me> * :green_heart: fix build Signed-off-by: Niels Lohmann <mail@nlohmann.me> * :green_heart: fix build Signed-off-by: Niels Lohmann <mail@nlohmann.me> * :green_heart: fix build Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 2 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
Reduce test-suite compile time: extract tiny per-standard test content; drop redundant legacy-comparison CI job (#5481) * Extract C++17-only content from unit-items.cpp into its own test file unit-items.cpp is a 1433-line file that was being compiled twice per CI configuration (once for C++11, once for C++17) purely because it contained a single, small JSON_HAS_CPP_17-gated SECTION ("structured bindings", 14 lines). Move that SECTION into a new, dedicated file (tests/src/unit-items-cpp17.cpp) so only that tiny file needs a second build; unit-items.cpp itself now builds/tests only once. No tests/CMakeLists.txt changes are needed since the existing file(GLOB ... src/unit-*.cpp) plus json_test_add_test_for() already auto-register and standard-gate any new unit-*.cpp file based on whether it textually contains JSON_HAS_CPP_<N> (the same mechanism already used for the existing unit-iterators3.cpp file, which follows the identical pattern). Verified with plain clang++ under -std=c++11/14/17/20 and via a local CMake configure+build that: - unit-items.cpp now only produces a test-items_cpp11 target (the former test-items_cpp17 target is gone) and its assertion/test-case counts are unchanged (2 test cases / 222 assertions) for every standard. - The new unit-items-cpp17.cpp produces test-items-cpp17_cpp11 (an intentionally empty translation unit under C++11 that reports 0 tests, 0 assertions, SUCCESS) and test-items-cpp17_cpp17 (1 test case / 1 assertion, identical to what "structured bindings" ran as before it was moved). Separately, unit-regression1.cpp (1530 lines) was also being built twice per CI configuration because it contained the substring JSON_HAS_CPP_17 -- but on inspection this was dead code: an orphaned "#ifdef JSON_HAS_CPP_17 / #include <variant> / #endif" left over from when the actual std::variant-based regression test (issue #1292) was relocated to unit-regression2.cpp. Nothing in unit-regression1.cpp uses <variant>, so there is no SECTION/TEST_CASE to preserve here; the dead include is simply removed. This was verified by grepping the file for any other use of "variant" (none) and confirming issue #1292 is still covered by unit-regression2.cpp. Compiled and ran under -std=c++11/14/17/20 and via CMake: unit-regression1.cpp now only produces a test-regression1_cpp11 target (test-regression1_cpp17 is gone) with an unchanged test-case count (3) under every standard. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix astyle indentation of #include inside #ifdef in unit-items-cpp17.cpp This repo's astyle style keeps preprocessor directives at column 0 even inside #ifdef blocks. The new tests/src/unit-items-cpp17.cpp had its #include <map>/#include <string> indented, which made the 'check' CI job's amalgamation/formatting diff non-empty and failed the aggregate check. Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 13 小时前 | |
Reduce test-suite compile time: extract tiny per-standard test content; drop redundant legacy-comparison CI job (#5481) * Extract C++17-only content from unit-items.cpp into its own test file unit-items.cpp is a 1433-line file that was being compiled twice per CI configuration (once for C++11, once for C++17) purely because it contained a single, small JSON_HAS_CPP_17-gated SECTION ("structured bindings", 14 lines). Move that SECTION into a new, dedicated file (tests/src/unit-items-cpp17.cpp) so only that tiny file needs a second build; unit-items.cpp itself now builds/tests only once. No tests/CMakeLists.txt changes are needed since the existing file(GLOB ... src/unit-*.cpp) plus json_test_add_test_for() already auto-register and standard-gate any new unit-*.cpp file based on whether it textually contains JSON_HAS_CPP_<N> (the same mechanism already used for the existing unit-iterators3.cpp file, which follows the identical pattern). Verified with plain clang++ under -std=c++11/14/17/20 and via a local CMake configure+build that: - unit-items.cpp now only produces a test-items_cpp11 target (the former test-items_cpp17 target is gone) and its assertion/test-case counts are unchanged (2 test cases / 222 assertions) for every standard. - The new unit-items-cpp17.cpp produces test-items-cpp17_cpp11 (an intentionally empty translation unit under C++11 that reports 0 tests, 0 assertions, SUCCESS) and test-items-cpp17_cpp17 (1 test case / 1 assertion, identical to what "structured bindings" ran as before it was moved). Separately, unit-regression1.cpp (1530 lines) was also being built twice per CI configuration because it contained the substring JSON_HAS_CPP_17 -- but on inspection this was dead code: an orphaned "#ifdef JSON_HAS_CPP_17 / #include <variant> / #endif" left over from when the actual std::variant-based regression test (issue #1292) was relocated to unit-regression2.cpp. Nothing in unit-regression1.cpp uses <variant>, so there is no SECTION/TEST_CASE to preserve here; the dead include is simply removed. This was verified by grepping the file for any other use of "variant" (none) and confirming issue #1292 is still covered by unit-regression2.cpp. Compiled and ran under -std=c++11/14/17/20 and via CMake: unit-regression1.cpp now only produces a test-regression1_cpp11 target (test-regression1_cpp17 is gone) with an unchanged test-case count (3) under every standard. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix astyle indentation of #include inside #ifdef in unit-items-cpp17.cpp This repo's astyle style keeps preprocessor directives at column 0 even inside #ifdef blocks. The new tests/src/unit-items-cpp17.cpp had its #include <map>/#include <string> indented, which made the 'check' CI job's amalgamation/formatting diff non-empty and failed the aggregate check. Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 13 小时前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
Fix #3868: Remove operator!= to enable P2468R2 rewritten candidate synthesis (#5253) * Fix #3868: Remove operator!= to enable P2468R2 rewritten candidate synthesis Under C++20 P2468R2, a hand-written operator!= suppresses the compiler's rewritten-candidate synthesis for operator==, preventing heterogeneous comparisons like `std::string s; json j; s == j;` from compiling. Fix by removing the hand-written operator!=, allowing the compiler to synthesize != as !(a==b) in all language modes (C++20 member functions and pre-C++20 friend functions). Behavior change: operator!= now returns !(a==b) unconditionally, including for special values like NaN and discarded. This means: - NaN != NaN now returns true (matches IEEE-754 semantics) - discarded != x now returns true for any x (matches !(discarded == x)) This also fixes underlying defects in previously-working code: - Restores direct == comparison for views vs json (reverts std::ranges::equal workaround added in PR #3950 to dodge this bug) - Re-enables std::string == json comparisons (uncomments check in unit-constructor1.cpp) Fixes: #3868, #3979 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Signed-off-by: Niels Lohmann <mail@nlohmann.me> * :rotating_light: fix warning Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com> | 2 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
Reject JSON Patch move when from is a proper prefix of path (#5497) * Reject JSON Patch move when from is a proper prefix of path RFC 6902 (section 4.4) forbids "from" from being a proper prefix of "path" for a "move" operation: "a location cannot be moved into one of its children." "move" is implemented as remove-then-add with no check for this. For object targets, the subsequent "add" happened to throw as a side effect of resolving through the now-removed parent, but for array targets, removing the "from" element shifts subsequent indices, so "path" silently re-resolves to a different element and the operation "succeeds" with a silently corrupted document. Add a check, before performing the remove/add, for whether "from" is a proper prefix of "path" at the reference-token level. This compares json_pointer's already-unescaped reference_tokens vectors (basic_json is a friend of json_pointer) rather than the raw pointer strings, so that tokens containing escaped '/' or '~' characters are compared correctly, and a token that merely looks like a string prefix (e.g. "/ab" vs "/abc/x") is not mistaken for a pointer-token prefix. When "from" is a proper prefix of "path", throw out_of_range.414. Fixes #5397. Stacked on top of the fix for #5396 (branch issue-5396-patch-remove-primitive-parent), since both touch the same patch_inplace move/remove handling in include/nlohmann/json.hpp. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Add root-pointer and array-append-token edge case tests for the move prefix check Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Replace std::equal with an explicitly-bounded loop in the move prefix check The three-iterator std::equal(first1, last1, first2) form has no explicit end iterator for the second range, which a static analyzer (Flawfinder, CWE-126) flags as a potential over-read even though the preceding size comparison already guarantees the second range is long enough. Rather than argue the point, make the bound visible in the code itself via an explicit loop -- every access to ptr.reference_tokens is now guarded by the same index the loop condition bounds against from_size. (The C++14 four-iterator std::equal(first1, last1, first2, last2) form was tried first as a more minimal fix, but this codebase targets C++11 and that overload is not safely usable under -std=c++11 with all supported standard library implementations.) Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Extract the move prefix check into a named helper lambda Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Account for JSON_DIAGNOSTIC_POSITIONS in the move-prefix-check error messages out_of_range::create() includes a "(bytes X-Y)" position annotation when JSON_DIAGNOSTIC_POSITIONS is enabled, which the ci_test_diagnostic_positions CI job builds the whole suite with. The five new out_of_range.414 assertions only checked the annotation-free message. Confirmed JSON_DIAGNOSTICS produces the same (annotation-free) message as the default build for this particular throw site (its path-based annotation is empty at the root, where &result always points here), so only two message variants are needed, not three. Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 13 小时前 | |
Make contains(json_pointer) return false instead of throwing on unrepresentable array-index tokens (#5495) contains(const json_pointer&) is documented to never throw, but a purely numeric reference token that is syntactically a valid array index yet numerically too large to be represented (exceeding size_type's max, or exceeding ULLONG_MAX and causing strtoull() to set errno to ERANGE) made it fall through to array_index(), which throws out_of_range.410/404. Pre-check the token's magnitude the same way array_index() does, but return false instead of throwing, mirroring how the surrounding code already rejects other malformed tokens (leading zero, non-digit characters, "-") without throwing. operator[]/at() are untouched and keep throwing for these inputs. Fixes #5395 Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 13 小时前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
Fix update(merge_objects=true) throwing on primitive-to-object merge (#5414) When merge_objects is true, recurse only if the existing value is an object. Otherwise overwrite, matching the documented "all other values are overwritten as usual" behavior. Fixes #5402 Signed-off-by: elix3r <157088510+22elix3r@users.noreply.github.com> | 12 天前 | |
Add iterator+sentinel tests and docs for binary deserializers (#5265) * Add iterator+sentinel tests and docs for binary deserializers This commit extends the C++20 ranges support (iterator+sentinel pairs) to the binary format deserializers from_cbor, from_msgpack, from_ubjson, from_bjdata, and from_bson, matching what was already done for parse(), accept(), and sax_parse(). Changes: - Add istreambuf_sentinel helper to test_utils.hpp for EOF detection in tests - Add 5 new test cases that read binary files directly via std::istreambuf_iterator<char> + sentinel, without pre-buffering - Update documentation for all 5 from_* functions to document overload (3) with SentinelType parameter - All tests pass; verified against existing test suite data - Fix potential buffer over-read warning in heterogeneous iterator test Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Merge iterator+sentinel overloads and fix ambiguity/CI issues Address PR review feedback and CI failures: - Merge the separate same-type and sentinel-type iterator overloads of parse(), accept(), sax_parse(), and the five from_* binary deserializers into a single overload with SentinelType defaulted to IteratorType, as suggested in review. Applied the same simplification to the detail::input_adapter() free functions. - Fix a latent ambiguity: some compilers (e.g. GCC 4.8) unreliably SFINAE the operator!= detection for std::nullptr_t against container/string types, making calls like parse(s, nullptr, ...) ambiguous with the compatible-input overload. can_compare_ne now explicitly excludes std::nullptr_t as a SentinelType. - Use a named enable_if_t template parameter instead of an unnamed function parameter for the SFINAE guard, fixing a clang-tidy hicpp-named-parameter/readability-named-parameter failure. - Update parse.md, accept.md, sax_parse.md, and the five from_*.md pages to document the merged overload instead of separate (2)/(3) overloads, also fixing an over-160-char line that broke the documentation style_check CI job. - Rework the BSON iterator+sentinel test to parse a BSON file already present in the test suite instead of writing/deleting a temp file. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix -Wunneeded-internal-declaration for CustomSentinel in test CustomSentinel lives in an anonymous namespace (internal linkage), and the library's parse loop only ever evaluates the iterator-first direction (it != last), so the reversed-order friend operator!= was never referenced. Clang's -Weverything flags such unused internal declarations as an error. Drop the unused overload; the used direction is enough to satisfy can_compare_ne's either-order detection. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix clang-tidy hicpp-named-parameter and misc-const-correctness - Drop the unused reversed-order operator!= overload from utils::istreambuf_sentinel (only iterator != sentinel is ever evaluated) and name the remaining friend's sentinel parameter, fixing hicpp-named-parameter/readability-named-parameter. - Mark the istreambuf_iterator first/last helper variable const in the five binary-format sentinel tests, fixing misc-const-correctness. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix clang-tidy misc-const-correctness in heterogeneous sentinel test json_str is only read via .data()/.size() and never reassigned, so clang-tidy correctly flags it as const-able. Verified against the exact CI job (silkeh/clang:dev, ci_clang_tidy target) by running clang-tidy directly on this file plus the five binary-format sentinel tests touched by prior commits; all are now clean. Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 1 个月前 | |
Undefine the four JSON_HEDLEY_* macros that leak after including json.hpp (#5475) * Undefine the four JSON_HEDLEY_* macros that leak after including json.hpp include/nlohmann/detail/macro_unscope.hpp includes hedley_undef.hpp to #undef every JSON_HEDLEY_* macro so none of them leak into the including translation unit. Four macros were missing from that list and therefore stayed defined after #include <nlohmann/json.hpp>: - JSON_HEDLEY_PRAGMA - JSON_HEDLEY_PREDICT_TRUE - JSON_HEDLEY_PREDICT_FALSE - JSON_HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE hedley_undef.hpp is generated (via `make update_hedley`) by grepping hedley.hpp for its own internal `#undef JSON_HEDLEY_X` redefinition guards. JSON_HEDLEY_PRAGMA/PREDICT_TRUE/PREDICT_FALSE have no such guard in upstream Hedley, so they were never picked up. The guard for JSON_HEDLEY_CLANG_HAS_DECLSPEC_ATTRIBUTE also has an upstream typo (`JSON_HEDLEY_CLANG_HAS_DECLSPEC_DECLSPEC_ATTRIBUTE`), so hedley_undef.hpp was undefining the wrong (never-defined) name. Fixes: - include/nlohmann/thirdparty/hedley/hedley_undef.hpp: corrected the DECLSPEC_ATTRIBUTE typo and added the three missing #undef lines, keeping the file's alphabetical ordering. - Makefile (update_hedley target): changed hedley_undef.hpp generation to extract macro names directly from every `#define JSON_HEDLEY_...` in hedley.hpp instead of from existing `#undef` guards, so a future `make update_hedley` run undefines every macro Hedley actually defines, even ones without a pre-existing redefinition guard. This was not run in this PR (it would also pull in an unrelated upstream Hedley sync); hedley_undef.hpp was hand-patched instead and single_include was regenerated with `make amalgamate`. - tests/src/unit-no-macro-leak.cpp: new regression test (picked up automatically by tests/CMakeLists.txt's existing unit-*.cpp glob) that includes json.hpp and then #ifdef/#error-checks every JSON_HEDLEY_* macro name, so any future leak of any of the 151 vendored macros fails the build, not just the four fixed here. Fixes #5408. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Derive the JSON_HEDLEY_* leak-check test from hedley.hpp at build time tests/src/unit-no-macro-leak.cpp previously hardcoded a static list of ~151 #ifdef/#error checks, one per JSON_HEDLEY_* macro name known at the time it was written. That list would silently go stale the next time `make update_hedley` pulls in a vendor update that adds, removes, or renames a macro, since nothing would force it to be regenerated. Add cmake/scripts/gen_hedley_undef_check.cmake, which derives the full list of JSON_HEDLEY_* macro names directly from include/nlohmann/thirdparty/hedley/hedley.hpp: - tests/CMakeLists.txt uses it (MODE=checks) to (re)generate hedley_undef_checks.inc at configure and build time, and wires the generating custom target as a dependency of the test-no-macro-leak_cpp* targets so it can never build against a stale copy. unit-no-macro-leak.cpp now just #include-s the generated file inside its TEST_CASE instead of carrying the checks itself. - The Makefile's `update_hedley` target now delegates hedley_undef.hpp generation to the same script (MODE=undef, new `update_hedley_undef` target), so the vendored header, the generated #undef list, and the generated test checks are all derived from the same extraction logic and cannot drift apart. This mirrors the approach taken independently in #5415 for the same issue (#5408), credited there to a self-regenerating mechanism that "can never drift again" -- ported into this branch instead of the static list originally proposed here. Verified with a local CMake configure + build + ctest, both against include/ (JSON_MultipleHeaders=ON) and against the amalgamated single_include/nlohmann/json.hpp (JSON_MultipleHeaders=OFF), and by temporarily deleting a #undef line from hedley_undef.hpp to confirm the generated test actually fails on a real leak. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix REUSE compliance failure in gen_hedley_undef_check.cmake The generated file's embedded banner contains the literal text 'SPDX-License-Identifier: MIT' as part of the *content* being written to hedley_undef.hpp, not as this .cmake script's own REUSE header (it is already covered by the blanket 'Files: *' rule in .reuse/dep5). The reuse tool matched that embedded line as an SPDX tag for the script itself and failed to parse the trailing 'MIT\n")' as a valid SPDX License Expression, breaking ci_reuse_compliance. Wrap the embedded banner in REUSE-IgnoreStart/REUSE-IgnoreEnd comments, as recommended by the tool's own diagnostic output. Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 13 小时前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
:rotating_light: fix warning (#5169) | 3 个月前 | |
Add missing overload to ordered_map::find (#5171) * :bug: add missing overload Signed-off-by: Niels Lohmann <mail@nlohmann.me> * :art: fix amalgamation Signed-off-by: Niels Lohmann <mail@nlohmann.me> * :bug: fix typo Signed-off-by: Niels Lohmann <mail@nlohmann.me> * :rotating_light: fix warning Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 3 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
Reduce test-suite compile time: extract tiny per-standard test content; drop redundant legacy-comparison CI job (#5481) * Extract C++17-only content from unit-items.cpp into its own test file unit-items.cpp is a 1433-line file that was being compiled twice per CI configuration (once for C++11, once for C++17) purely because it contained a single, small JSON_HAS_CPP_17-gated SECTION ("structured bindings", 14 lines). Move that SECTION into a new, dedicated file (tests/src/unit-items-cpp17.cpp) so only that tiny file needs a second build; unit-items.cpp itself now builds/tests only once. No tests/CMakeLists.txt changes are needed since the existing file(GLOB ... src/unit-*.cpp) plus json_test_add_test_for() already auto-register and standard-gate any new unit-*.cpp file based on whether it textually contains JSON_HAS_CPP_<N> (the same mechanism already used for the existing unit-iterators3.cpp file, which follows the identical pattern). Verified with plain clang++ under -std=c++11/14/17/20 and via a local CMake configure+build that: - unit-items.cpp now only produces a test-items_cpp11 target (the former test-items_cpp17 target is gone) and its assertion/test-case counts are unchanged (2 test cases / 222 assertions) for every standard. - The new unit-items-cpp17.cpp produces test-items-cpp17_cpp11 (an intentionally empty translation unit under C++11 that reports 0 tests, 0 assertions, SUCCESS) and test-items-cpp17_cpp17 (1 test case / 1 assertion, identical to what "structured bindings" ran as before it was moved). Separately, unit-regression1.cpp (1530 lines) was also being built twice per CI configuration because it contained the substring JSON_HAS_CPP_17 -- but on inspection this was dead code: an orphaned "#ifdef JSON_HAS_CPP_17 / #include <variant> / #endif" left over from when the actual std::variant-based regression test (issue #1292) was relocated to unit-regression2.cpp. Nothing in unit-regression1.cpp uses <variant>, so there is no SECTION/TEST_CASE to preserve here; the dead include is simply removed. This was verified by grepping the file for any other use of "variant" (none) and confirming issue #1292 is still covered by unit-regression2.cpp. Compiled and ran under -std=c++11/14/17/20 and via CMake: unit-regression1.cpp now only produces a test-regression1_cpp11 target (test-regression1_cpp17 is gone) with an unchanged test-case count (3) under every standard. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix astyle indentation of #include inside #ifdef in unit-items-cpp17.cpp This repo's astyle style keeps preprocessor directives at column 0 even inside #ifdef blocks. The new tests/src/unit-items-cpp17.cpp had its #include <map>/#include <string> indented, which made the 'check' CI job's amalgamation/formatting diff non-empty and failed the aggregate check. Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 13 小时前 | |
Broaden JSON_HEDLEY_WARN_UNUSED_RESULT coverage to pure query functions (#5477) * Broaden JSON_HEDLEY_WARN_UNUSED_RESULT coverage to pure query functions Add JSON_HEDLEY_WARN_UNUSED_RESULT to the unambiguous, const, side-effect-free observer functions whose return value is the entire purpose of the call: - dump() - type(), type_name() - all is_* predicates (is_primitive, is_structured, is_null, is_boolean, is_number, is_number_integer, is_number_unsigned, is_number_float, is_object, is_array, is_string, is_binary, is_discarded) - empty(), size(), max_size() - count(...) (both overloads) and contains(...) (all overloads, including the deprecated json_pointer<BasicJsonType> overload) This mirrors the direction the standard library has taken with [[nodiscard]] on the analogous std::vector/std::map members, and catches real bugs such as `j.empty();` (meant `j.clear();`) or `j.contains(k);` with the result thrown away. Deliberately out of scope (left for a separate, later policy decision, per the issue): at(), value(), get*(), flatten(), unflatten(), patch(), merge_patch(), begin()/end(), comparison operators, erase(), and emplace(). Compiling the full test suite (tests/src/unit-*.cpp) with -Wunused-result -Werror uncovered one real hit: a regression test in unit-regression2.cpp called dump() purely to check it does not throw, discarding the result. Fixed by explicitly casting to void, since the call is intentionally result-less there. Fixes #5410 Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix discarded nodiscard results across the test suite for GCC's warn_unused_result A plain (void) cast on a call expression suppresses the C++17 [[nodiscard]] warning but not GCC's warning for functions annotated via the GNU __attribute__((warn_unused_result)) form -- which is what JSON_HEDLEY_WARN_UNUSED_RESULT expands to on GCC. Several existing tests that call a newly-annotated function (dump(), empty()) purely to check that it throws/does not throw, discarding the result via (void), newly warned (and failed -Werror builds) once the annotation was broadened. Route those discards through a small ignore_return_value() helper instead, which actually consumes the value and suppresses the warning on both attribute forms. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Use utils::ignore_return_value() for the issue #1445 dump() discard too Addresses review feedback from @gregmarr on PR #5477: this call site was still using the older "capture in a variable, then (void) it" pattern from before this PR introduced utils::ignore_return_value(), instead of the helper now used at every other discarded-nodiscard-result call site this PR touches. Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 13 小时前 | |
Broaden JSON_HEDLEY_WARN_UNUSED_RESULT coverage to pure query functions (#5477) * Broaden JSON_HEDLEY_WARN_UNUSED_RESULT coverage to pure query functions Add JSON_HEDLEY_WARN_UNUSED_RESULT to the unambiguous, const, side-effect-free observer functions whose return value is the entire purpose of the call: - dump() - type(), type_name() - all is_* predicates (is_primitive, is_structured, is_null, is_boolean, is_number, is_number_integer, is_number_unsigned, is_number_float, is_object, is_array, is_string, is_binary, is_discarded) - empty(), size(), max_size() - count(...) (both overloads) and contains(...) (all overloads, including the deprecated json_pointer<BasicJsonType> overload) This mirrors the direction the standard library has taken with [[nodiscard]] on the analogous std::vector/std::map members, and catches real bugs such as `j.empty();` (meant `j.clear();`) or `j.contains(k);` with the result thrown away. Deliberately out of scope (left for a separate, later policy decision, per the issue): at(), value(), get*(), flatten(), unflatten(), patch(), merge_patch(), begin()/end(), comparison operators, erase(), and emplace(). Compiling the full test suite (tests/src/unit-*.cpp) with -Wunused-result -Werror uncovered one real hit: a regression test in unit-regression2.cpp called dump() purely to check it does not throw, discarding the result. Fixed by explicitly casting to void, since the call is intentionally result-less there. Fixes #5410 Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix discarded nodiscard results across the test suite for GCC's warn_unused_result A plain (void) cast on a call expression suppresses the C++17 [[nodiscard]] warning but not GCC's warning for functions annotated via the GNU __attribute__((warn_unused_result)) form -- which is what JSON_HEDLEY_WARN_UNUSED_RESULT expands to on GCC. Several existing tests that call a newly-annotated function (dump(), empty()) purely to check that it throws/does not throw, discarding the result via (void), newly warned (and failed -Werror builds) once the annotation was broadened. Route those discards through a small ignore_return_value() helper instead, which actually consumes the value and suppresses the warning on both attribute forms. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Use utils::ignore_return_value() for the issue #1445 dump() discard too Addresses review feedback from @gregmarr on PR #5477: this call site was still using the older "capture in a variable, then (void) it" pattern from before this PR introduced utils::ignore_return_value(), instead of the helper now used at every other discarded-nodiscard-result call site this PR touches. Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 13 小时前 | |
Add std::format and fmt support (#5224) * :sparkles: add std::format and fmt support Signed-off-by: Niels Lohmann <mail@nlohmann.me> * :recycle: reorganize PR Signed-off-by: Niels Lohmann <mail@nlohmann.me> * :green_heart: fix build Signed-off-by: Niels Lohmann <mail@nlohmann.me> * :green_heart: fix build Signed-off-by: Niels Lohmann <mail@nlohmann.me> * :green_heart: fix build Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 2 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
avoid sign extension in char_traits<signed char>::to_int_type (#5336) * avoid sign extension in char_traits<signed char>::to_int_type Signed-off-by: Angadi Yashaswini <angadi@digiscrypt.com> * spell out-of-range signed char constants as negative values (MSVC C4309) Signed-off-by: Angadi Yashaswini <angadi@digiscrypt.com> --------- Signed-off-by: Angadi Yashaswini <angadi@digiscrypt.com> | 1 个月前 | |
Throw other_error.502 when UBJSON use_type is set without use_size (#5380) * Throw other_error.502 when UBJSON use_type is set without use_size Fixes #5321 Signed-off-by: Krishnanand G <118352827+Krishnanand-G@users.noreply.github.com> * Scope UBJSON use_type check to container branches and expand tests Signed-off-by: Krishnanand G <118352827+Krishnanand-G@users.noreply.github.com> * Re-amalgamate single_include/json.hpp The previous commit updated the split headers but the amalgamated file didn't go back through astyle before I committed it, so CI's amalgamation check caught formatting drift in json_fwd.hpp and a few noexcept clauses in basic_json, plus one doc example. None of it touches the UBJSON logic. Applied the patch CI generated to bring single_include back in sync. Signed-off-by: Krishnanand G <118352827+Krishnanand-G@users.noreply.github.com> --------- Signed-off-by: Krishnanand G <118352827+Krishnanand-G@users.noreply.github.com> | 15 天前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
New macros for the named JSON convertor generation (#4563) * Add new macros for named conversions * Unit tests for the named conversion macros * Update the docs to include the new macros * Fix the documentation for the macros the correct maximum number of member variables is 63 * Fix CI tests * update the named macros * move the example files * update the explicit macros expansion * update documentation * fix documentation hiccups * astyle changes * add static analysis exceptions * change md header to explicit html to fit the length * Small corrections to docs Co-authored-by: Niels Lohmann <niels.lohmann@gmail.com> Signed-off-by: George Sedov <radist.morse@gmail.com> --------- Signed-off-by: George Sedov <radist.morse@gmail.com> Co-authored-by: Niels Lohmann <niels.lohmann@gmail.com> | 3 个月前 | |
Broaden JSON_HEDLEY_WARN_UNUSED_RESULT coverage to pure query functions (#5477) * Broaden JSON_HEDLEY_WARN_UNUSED_RESULT coverage to pure query functions Add JSON_HEDLEY_WARN_UNUSED_RESULT to the unambiguous, const, side-effect-free observer functions whose return value is the entire purpose of the call: - dump() - type(), type_name() - all is_* predicates (is_primitive, is_structured, is_null, is_boolean, is_number, is_number_integer, is_number_unsigned, is_number_float, is_object, is_array, is_string, is_binary, is_discarded) - empty(), size(), max_size() - count(...) (both overloads) and contains(...) (all overloads, including the deprecated json_pointer<BasicJsonType> overload) This mirrors the direction the standard library has taken with [[nodiscard]] on the analogous std::vector/std::map members, and catches real bugs such as `j.empty();` (meant `j.clear();`) or `j.contains(k);` with the result thrown away. Deliberately out of scope (left for a separate, later policy decision, per the issue): at(), value(), get*(), flatten(), unflatten(), patch(), merge_patch(), begin()/end(), comparison operators, erase(), and emplace(). Compiling the full test suite (tests/src/unit-*.cpp) with -Wunused-result -Werror uncovered one real hit: a regression test in unit-regression2.cpp called dump() purely to check it does not throw, discarding the result. Fixed by explicitly casting to void, since the call is intentionally result-less there. Fixes #5410 Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix discarded nodiscard results across the test suite for GCC's warn_unused_result A plain (void) cast on a call expression suppresses the C++17 [[nodiscard]] warning but not GCC's warning for functions annotated via the GNU __attribute__((warn_unused_result)) form -- which is what JSON_HEDLEY_WARN_UNUSED_RESULT expands to on GCC. Several existing tests that call a newly-annotated function (dump(), empty()) purely to check that it throws/does not throw, discarding the result via (void), newly warned (and failed -Werror builds) once the annotation was broadened. Route those discards through a small ignore_return_value() helper instead, which actually consumes the value and suppresses the warning on both attribute forms. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Use utils::ignore_return_value() for the issue #1445 dump() discard too Addresses review feedback from @gregmarr on PR #5477: this call site was still using the older "capture in a variable, then (void) it" pattern from before this PR introduced utils::ignore_return_value(), instead of the helper now used at every other discarded-nodiscard-result call site this PR touches. Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 13 小时前 | |
Broaden JSON_HEDLEY_WARN_UNUSED_RESULT coverage to pure query functions (#5477) * Broaden JSON_HEDLEY_WARN_UNUSED_RESULT coverage to pure query functions Add JSON_HEDLEY_WARN_UNUSED_RESULT to the unambiguous, const, side-effect-free observer functions whose return value is the entire purpose of the call: - dump() - type(), type_name() - all is_* predicates (is_primitive, is_structured, is_null, is_boolean, is_number, is_number_integer, is_number_unsigned, is_number_float, is_object, is_array, is_string, is_binary, is_discarded) - empty(), size(), max_size() - count(...) (both overloads) and contains(...) (all overloads, including the deprecated json_pointer<BasicJsonType> overload) This mirrors the direction the standard library has taken with [[nodiscard]] on the analogous std::vector/std::map members, and catches real bugs such as `j.empty();` (meant `j.clear();`) or `j.contains(k);` with the result thrown away. Deliberately out of scope (left for a separate, later policy decision, per the issue): at(), value(), get*(), flatten(), unflatten(), patch(), merge_patch(), begin()/end(), comparison operators, erase(), and emplace(). Compiling the full test suite (tests/src/unit-*.cpp) with -Wunused-result -Werror uncovered one real hit: a regression test in unit-regression2.cpp called dump() purely to check it does not throw, discarding the result. Fixed by explicitly casting to void, since the call is intentionally result-less there. Fixes #5410 Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix discarded nodiscard results across the test suite for GCC's warn_unused_result A plain (void) cast on a call expression suppresses the C++17 [[nodiscard]] warning but not GCC's warning for functions annotated via the GNU __attribute__((warn_unused_result)) form -- which is what JSON_HEDLEY_WARN_UNUSED_RESULT expands to on GCC. Several existing tests that call a newly-annotated function (dump(), empty()) purely to check that it throws/does not throw, discarding the result via (void), newly warned (and failed -Werror builds) once the annotation was broadened. Route those discards through a small ignore_return_value() helper instead, which actually consumes the value and suppresses the warning on both attribute forms. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Use utils::ignore_return_value() for the issue #1445 dump() discard too Addresses review feedback from @gregmarr on PR #5477: this call site was still using the older "capture in a variable, then (void) it" pattern from before this PR introduced utils::ignore_return_value(), instead of the helper now used at every other discarded-nodiscard-result call site this PR touches. Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 13 小时前 | |
Broaden JSON_HEDLEY_WARN_UNUSED_RESULT coverage to pure query functions (#5477) * Broaden JSON_HEDLEY_WARN_UNUSED_RESULT coverage to pure query functions Add JSON_HEDLEY_WARN_UNUSED_RESULT to the unambiguous, const, side-effect-free observer functions whose return value is the entire purpose of the call: - dump() - type(), type_name() - all is_* predicates (is_primitive, is_structured, is_null, is_boolean, is_number, is_number_integer, is_number_unsigned, is_number_float, is_object, is_array, is_string, is_binary, is_discarded) - empty(), size(), max_size() - count(...) (both overloads) and contains(...) (all overloads, including the deprecated json_pointer<BasicJsonType> overload) This mirrors the direction the standard library has taken with [[nodiscard]] on the analogous std::vector/std::map members, and catches real bugs such as `j.empty();` (meant `j.clear();`) or `j.contains(k);` with the result thrown away. Deliberately out of scope (left for a separate, later policy decision, per the issue): at(), value(), get*(), flatten(), unflatten(), patch(), merge_patch(), begin()/end(), comparison operators, erase(), and emplace(). Compiling the full test suite (tests/src/unit-*.cpp) with -Wunused-result -Werror uncovered one real hit: a regression test in unit-regression2.cpp called dump() purely to check it does not throw, discarding the result. Fixed by explicitly casting to void, since the call is intentionally result-less there. Fixes #5410 Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix discarded nodiscard results across the test suite for GCC's warn_unused_result A plain (void) cast on a call expression suppresses the C++17 [[nodiscard]] warning but not GCC's warning for functions annotated via the GNU __attribute__((warn_unused_result)) form -- which is what JSON_HEDLEY_WARN_UNUSED_RESULT expands to on GCC. Several existing tests that call a newly-annotated function (dump(), empty()) purely to check that it throws/does not throw, discarding the result via (void), newly warned (and failed -Werror builds) once the annotation was broadened. Route those discards through a small ignore_return_value() helper instead, which actually consumes the value and suppresses the warning on both attribute forms. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Use utils::ignore_return_value() for the issue #1445 dump() discard too Addresses review feedback from @gregmarr on PR #5477: this call site was still using the older "capture in a variable, then (void) it" pattern from before this PR introduced utils::ignore_return_value(), instead of the helper now used at every other discarded-nodiscard-result call site this PR touches. Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 13 小时前 | |
Broaden JSON_HEDLEY_WARN_UNUSED_RESULT coverage to pure query functions (#5477) * Broaden JSON_HEDLEY_WARN_UNUSED_RESULT coverage to pure query functions Add JSON_HEDLEY_WARN_UNUSED_RESULT to the unambiguous, const, side-effect-free observer functions whose return value is the entire purpose of the call: - dump() - type(), type_name() - all is_* predicates (is_primitive, is_structured, is_null, is_boolean, is_number, is_number_integer, is_number_unsigned, is_number_float, is_object, is_array, is_string, is_binary, is_discarded) - empty(), size(), max_size() - count(...) (both overloads) and contains(...) (all overloads, including the deprecated json_pointer<BasicJsonType> overload) This mirrors the direction the standard library has taken with [[nodiscard]] on the analogous std::vector/std::map members, and catches real bugs such as `j.empty();` (meant `j.clear();`) or `j.contains(k);` with the result thrown away. Deliberately out of scope (left for a separate, later policy decision, per the issue): at(), value(), get*(), flatten(), unflatten(), patch(), merge_patch(), begin()/end(), comparison operators, erase(), and emplace(). Compiling the full test suite (tests/src/unit-*.cpp) with -Wunused-result -Werror uncovered one real hit: a regression test in unit-regression2.cpp called dump() purely to check it does not throw, discarding the result. Fixed by explicitly casting to void, since the call is intentionally result-less there. Fixes #5410 Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix discarded nodiscard results across the test suite for GCC's warn_unused_result A plain (void) cast on a call expression suppresses the C++17 [[nodiscard]] warning but not GCC's warning for functions annotated via the GNU __attribute__((warn_unused_result)) form -- which is what JSON_HEDLEY_WARN_UNUSED_RESULT expands to on GCC. Several existing tests that call a newly-annotated function (dump(), empty()) purely to check that it throws/does not throw, discarding the result via (void), newly warned (and failed -Werror builds) once the annotation was broadened. Route those discards through a small ignore_return_value() helper instead, which actually consumes the value and suppresses the warning on both attribute forms. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Use utils::ignore_return_value() for the issue #1445 dump() discard too Addresses review feedback from @gregmarr on PR #5477: this call site was still using the older "capture in a variable, then (void) it" pattern from before this PR introduced utils::ignore_return_value(), instead of the helper now used at every other discarded-nodiscard-result call site this PR touches. Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 13 小时前 | |
Broaden JSON_HEDLEY_WARN_UNUSED_RESULT coverage to pure query functions (#5477) * Broaden JSON_HEDLEY_WARN_UNUSED_RESULT coverage to pure query functions Add JSON_HEDLEY_WARN_UNUSED_RESULT to the unambiguous, const, side-effect-free observer functions whose return value is the entire purpose of the call: - dump() - type(), type_name() - all is_* predicates (is_primitive, is_structured, is_null, is_boolean, is_number, is_number_integer, is_number_unsigned, is_number_float, is_object, is_array, is_string, is_binary, is_discarded) - empty(), size(), max_size() - count(...) (both overloads) and contains(...) (all overloads, including the deprecated json_pointer<BasicJsonType> overload) This mirrors the direction the standard library has taken with [[nodiscard]] on the analogous std::vector/std::map members, and catches real bugs such as `j.empty();` (meant `j.clear();`) or `j.contains(k);` with the result thrown away. Deliberately out of scope (left for a separate, later policy decision, per the issue): at(), value(), get*(), flatten(), unflatten(), patch(), merge_patch(), begin()/end(), comparison operators, erase(), and emplace(). Compiling the full test suite (tests/src/unit-*.cpp) with -Wunused-result -Werror uncovered one real hit: a regression test in unit-regression2.cpp called dump() purely to check it does not throw, discarding the result. Fixed by explicitly casting to void, since the call is intentionally result-less there. Fixes #5410 Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Fix discarded nodiscard results across the test suite for GCC's warn_unused_result A plain (void) cast on a call expression suppresses the C++17 [[nodiscard]] warning but not GCC's warning for functions annotated via the GNU __attribute__((warn_unused_result)) form -- which is what JSON_HEDLEY_WARN_UNUSED_RESULT expands to on GCC. Several existing tests that call a newly-annotated function (dump(), empty()) purely to check that it throws/does not throw, discarding the result via (void), newly warned (and failed -Werror builds) once the annotation was broadened. Route those discards through a small ignore_return_value() helper instead, which actually consumes the value and suppresses the warning on both attribute forms. Signed-off-by: Niels Lohmann <mail@nlohmann.me> * Use utils::ignore_return_value() for the issue #1445 dump() discard too Addresses review feedback from @gregmarr on PR #5477: this call site was still using the older "capture in a variable, then (void) it" pattern from before this PR introduced utils::ignore_return_value(), instead of the helper now used at every other discarded-nodiscard-result call site this PR touches. Signed-off-by: Niels Lohmann <mail@nlohmann.me> --------- Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 13 小时前 | |
Extend memcpy fast path to sized sentinels (e.g. std::counted_iterator) (#5268) | 1 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 | |
reject out-of-range code points in UTF-32 wide-string input (#5348) * reject out-of-range code points in UTF-32 wide-string input Signed-off-by: Angadi Yashaswini <angadi@digiscrypt.com> * remove useless cast to char_traits<char>::int_type Signed-off-by: Angadi Yashaswini <angadi@digiscrypt.com> --------- Signed-off-by: Angadi Yashaswini <angadi@digiscrypt.com> | 1 个月前 | |
:page_facing_up: adjust year (#5044) Signed-off-by: Niels Lohmann <mail@nlohmann.me> | 8 个月前 |
| 文件 | 最后提交记录 | 最后更新时间 |
|---|---|---|
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 13 小时前 | ||
| 1 个月前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 4 天前 | ||
| 13 小时前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 21 天前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 13 小时前 | ||
| 13 小时前 | ||
| 4 天前 | ||
| 8 个月前 | ||
| 2 个月前 | ||
| 8 个月前 | ||
| 2 个月前 | ||
| 13 小时前 | ||
| 8 个月前 | ||
| 1 个月前 | ||
| 8 个月前 | ||
| 1 个月前 | ||
| 3 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 2 个月前 | ||
| 2 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 13 小时前 | ||
| 13 小时前 | ||
| 8 个月前 | ||
| 2 个月前 | ||
| 8 个月前 | ||
| 13 小时前 | ||
| 13 小时前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 12 天前 | ||
| 1 个月前 | ||
| 13 小时前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 3 个月前 | ||
| 3 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 13 小时前 | ||
| 13 小时前 | ||
| 13 小时前 | ||
| 2 个月前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 1 个月前 | ||
| 15 天前 | ||
| 8 个月前 | ||
| 8 个月前 | ||
| 3 个月前 | ||
| 13 小时前 | ||
| 13 小时前 | ||
| 13 小时前 | ||
| 13 小时前 | ||
| 13 小时前 | ||
| 1 个月前 | ||
| 8 个月前 | ||
| 1 个月前 | ||
| 8 个月前 |