[upstream_utils] Upgrade JSON library to v3.12.0 (#8509)

Closes #7903.
This commit is contained in:
Charlotte
2026-01-02 11:51:16 -05:00
committed by GitHub
parent 44ca9e816d
commit 32fa124166
52 changed files with 1120 additions and 364 deletions

View File

@@ -51,7 +51,7 @@ def copy_upstream_src(wpilib_root: Path):
def main():
name = "json"
url = "https://github.com/nlohmann/json"
tag = "v3.11.3"
tag = "v3.12.0"
patch_options = {
"use_threeway": True,

View File

@@ -4,14 +4,14 @@ Date: Fri, 8 Sep 2023 19:21:41 -0700
Subject: [PATCH 1/5] Remove version from namespace
---
include/nlohmann/detail/abi_macros.hpp | 45 ++------------------------
1 file changed, 3 insertions(+), 42 deletions(-)
include/nlohmann/detail/abi_macros.hpp | 46 ++------------------------
1 file changed, 3 insertions(+), 43 deletions(-)
diff --git a/include/nlohmann/detail/abi_macros.hpp b/include/nlohmann/detail/abi_macros.hpp
index f48b9eb1d5f0ec15fb47072084a4452f5c39fdde..f333173d73f099b64a60ca7131a0cff7fb6b4521 100644
index 76cf336fcd14d3249b85c2e9cbfae926fe22562f..28facfc9464bcf2108f5d40fe57703cd755864b8 100644
--- a/include/nlohmann/detail/abi_macros.hpp
+++ b/include/nlohmann/detail/abi_macros.hpp
@@ -42,40 +42,6 @@
@@ -52,41 +52,6 @@
#define NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON
#endif
@@ -20,14 +20,15 @@ index f48b9eb1d5f0ec15fb47072084a4452f5c39fdde..f333173d73f099b64a60ca7131a0cff7
-#endif
-
-// Construct the namespace ABI tags component
-#define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b) json_abi ## a ## b
-#define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b) \
- NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b)
-#define NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b, c) json_abi ## a ## b ## c
-#define NLOHMANN_JSON_ABI_TAGS_CONCAT(a, b, c) \
- NLOHMANN_JSON_ABI_TAGS_CONCAT_EX(a, b, c)
-
-#define NLOHMANN_JSON_ABI_TAGS \
- NLOHMANN_JSON_ABI_TAGS_CONCAT( \
- NLOHMANN_JSON_ABI_TAG_DIAGNOSTICS, \
- NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON)
- NLOHMANN_JSON_ABI_TAG_LEGACY_DISCARDED_VALUE_COMPARISON, \
- NLOHMANN_JSON_ABI_TAG_DIAGNOSTIC_POSITIONS)
-
-// Construct the namespace version component
-#define NLOHMANN_JSON_NAMESPACE_VERSION_CONCAT_EX(major, minor, patch) \
@@ -52,7 +53,7 @@ index f48b9eb1d5f0ec15fb47072084a4452f5c39fdde..f333173d73f099b64a60ca7131a0cff7
#ifndef NLOHMANN_JSON_NAMESPACE
#define NLOHMANN_JSON_NAMESPACE \
nlohmann::NLOHMANN_JSON_NAMESPACE_CONCAT( \
@@ -84,17 +50,12 @@
@@ -95,17 +60,12 @@
#endif
#ifndef NLOHMANN_JSON_NAMESPACE_BEGIN

View File

@@ -9,7 +9,7 @@ Subject: [PATCH 2/5] Make serializer public
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/nlohmann/detail/output/serializer.hpp b/include/nlohmann/detail/output/serializer.hpp
index ed20b0d9e183b940d689d712d9e4b2de0b72017e..8bfe47a248d726e929053aa752a25d2fb4022f9b 100644
index 3137f3c3602c8aefa4a1e4947e1f17e836e91eb6..3a8e6c18f64035670886089c924bd322acc673a8 100644
--- a/include/nlohmann/detail/output/serializer.hpp
+++ b/include/nlohmann/detail/output/serializer.hpp
@@ -373,7 +373,7 @@ class serializer
@@ -38,10 +38,10 @@ index ed20b0d9e183b940d689d712d9e4b2de0b72017e..8bfe47a248d726e929053aa752a25d2f
@brief check whether a string is UTF-8 encoded
diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp
index 95d6bf1dd9d8bae1c87db8fb647c734e9c71f327..8ece57d4a0fde54b24fb6985d9b455b12df835ac 100644
index ed51cd544748c4b8ebabbd5bf32fd0bb1ef89738..491351330ba7a5994a750027c5766ae769e0b164 100644
--- a/include/nlohmann/json.hpp
+++ b/include/nlohmann/json.hpp
@@ -157,10 +157,9 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@@ -158,10 +158,9 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
using binary_reader = ::nlohmann::detail::binary_reader<basic_json, InputType>;
template<typename CharType> using binary_writer = ::nlohmann::detail::binary_writer<basic_json, CharType>;

View File

@@ -8,7 +8,7 @@ Subject: [PATCH 3/5] Make dump_escaped() take std::string_view
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/nlohmann/detail/output/serializer.hpp b/include/nlohmann/detail/output/serializer.hpp
index 8bfe47a248d726e929053aa752a25d2fb4022f9b..39f0a06d8b5725262866eefe5f22cfc3fad805cd 100644
index 3a8e6c18f64035670886089c924bd322acc673a8..359eb82071b10e45e45f73f458660c4e44dd86e8 100644
--- a/include/nlohmann/detail/output/serializer.hpp
+++ b/include/nlohmann/detail/output/serializer.hpp
@@ -388,7 +388,7 @@ class serializer

View File

@@ -10,7 +10,7 @@ Subject: [PATCH 4/5] Add llvm stream support
3 files changed, 59 insertions(+), 2 deletions(-)
diff --git a/include/nlohmann/detail/output/output_adapters.hpp b/include/nlohmann/detail/output/output_adapters.hpp
index 626f7c0c85e35ec51a90baa3bdd12cd8df7ba957..2e2e92f9718ec13aaa585955707419f27b2088c6 100644
index 60806970203b3357b76fef851043f1ec602de9df..2e221ccaffcc25e6c4347ca6a9efd81953cf63ee 100644
--- a/include/nlohmann/detail/output/output_adapters.hpp
+++ b/include/nlohmann/detail/output/output_adapters.hpp
@@ -22,6 +22,8 @@
@@ -61,7 +61,7 @@ index 626f7c0c85e35ec51a90baa3bdd12cd8df7ba957..2e2e92f9718ec13aaa585955707419f2
{
return oa;
diff --git a/include/nlohmann/detail/output/serializer.hpp b/include/nlohmann/detail/output/serializer.hpp
index 39f0a06d8b5725262866eefe5f22cfc3fad805cd..b5d4906f36702835a44d4fc567966d3064e9cbd1 100644
index 359eb82071b10e45e45f73f458660c4e44dd86e8..562dbea840527752c0e6f76a8d098ce98ce5c540 100644
--- a/include/nlohmann/detail/output/serializer.hpp
+++ b/include/nlohmann/detail/output/serializer.hpp
@@ -65,15 +65,22 @@ class serializer
@@ -90,10 +90,10 @@ index 39f0a06d8b5725262866eefe5f22cfc3fad805cd..b5d4906f36702835a44d4fc567966d30
// delete because of pointer members
serializer(const serializer&) = delete;
diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp
index 8ece57d4a0fde54b24fb6985d9b455b12df835ac..a89e2151e589663ba487a462c3d15cd247ff06cf 100644
index 491351330ba7a5994a750027c5766ae769e0b164..aa869a663906f14e28354d3af18d7528fa5a2bc0 100644
--- a/include/nlohmann/json.hpp
+++ b/include/nlohmann/json.hpp
@@ -1288,6 +1288,24 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@@ -1315,6 +1315,24 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
return result;
}
@@ -118,7 +118,7 @@ index 8ece57d4a0fde54b24fb6985d9b455b12df835ac..a89e2151e589663ba487a462c3d15cd2
/// @brief return the type of the JSON value (explicit)
/// @sa https://json.nlohmann.me/api/basic_json/type/
constexpr value_t type() const noexcept
@@ -3998,6 +4016,12 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@@ -4026,6 +4044,12 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
return o << j;
}
#endif // JSON_NO_IO

View File

@@ -8,10 +8,10 @@ Subject: [PATCH 5/5] Fix Doxygen warnings
1 file changed, 7 insertions(+), 26 deletions(-)
diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp
index a89e2151e589663ba487a462c3d15cd247ff06cf..d5d6d6d51f1df4fd030e69a54941fe0911bdba93 100644
index aa869a663906f14e28354d3af18d7528fa5a2bc0..c5829a32868c8d578cd8245d3744f63ed5fcd727 100644
--- a/include/nlohmann/json.hpp
+++ b/include/nlohmann/json.hpp
@@ -161,7 +161,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@@ -162,7 +162,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
using serializer = ::nlohmann::detail::serializer<basic_json>;
using value_t = detail::value_t;
@@ -20,7 +20,7 @@ index a89e2151e589663ba487a462c3d15cd247ff06cf..d5d6d6d51f1df4fd030e69a54941fe09
using json_pointer = ::nlohmann::json_pointer<StringType>;
template<typename T, typename SFINAE>
using json_serializer = JSONSerializer<T, SFINAE>;
@@ -173,7 +173,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@@ -176,7 +176,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
using initializer_list_t = std::initializer_list<detail::json_ref<basic_json>>;
using input_format_t = detail::input_format_t;
@@ -29,7 +29,7 @@ index a89e2151e589663ba487a462c3d15cd247ff06cf..d5d6d6d51f1df4fd030e69a54941fe09
using json_sax_t = json_sax<basic_json>;
////////////////
@@ -1606,13 +1606,6 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@@ -1633,13 +1633,6 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@throw what @ref json_serializer<ValueType> `from_json()` method throws
@@ -43,7 +43,7 @@ index a89e2151e589663ba487a462c3d15cd247ff06cf..d5d6d6d51f1df4fd030e69a54941fe09
@since version 2.1.0
*/
template < typename ValueType,
@@ -1678,7 +1671,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@@ -1705,7 +1698,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@return a copy of *this, converted into @a BasicJsonType
@@ -52,7 +52,7 @@ index a89e2151e589663ba487a462c3d15cd247ff06cf..d5d6d6d51f1df4fd030e69a54941fe09
method.
@since version 3.2.0
@@ -1702,7 +1695,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@@ -1729,7 +1722,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@return a copy of *this
@@ -61,7 +61,7 @@ index a89e2151e589663ba487a462c3d15cd247ff06cf..d5d6d6d51f1df4fd030e69a54941fe09
@since version 2.1.0
*/
@@ -1786,12 +1779,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@@ -1813,12 +1806,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@return pointer to the internally stored JSON value if the requested
pointer type @a PointerType fits to the JSON value; `nullptr` otherwise
@@ -75,7 +75,7 @@ index a89e2151e589663ba487a462c3d15cd247ff06cf..d5d6d6d51f1df4fd030e69a54941fe09
@sa see @ref get_ptr() for explicit pointer-member access
@@ -1869,7 +1857,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@@ -1896,7 +1884,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@brief get a value (implicit)
Implicit type conversion between the JSON value and a compatible value.
@@ -84,7 +84,7 @@ index a89e2151e589663ba487a462c3d15cd247ff06cf..d5d6d6d51f1df4fd030e69a54941fe09
@tparam ValueType non-pointer type compatible to the JSON value, for
instance `int` for JSON integer numbers, `bool` for JSON booleans, or
@@ -1883,14 +1871,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
@@ -1910,14 +1898,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec
to the JSON value type (e.g., the JSON value is of type boolean, but a
string is requested); see example below