diff options
| author | Andrew Geissler <geissonator@yahoo.com> | 2020-05-17 11:54:15 -0500 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2020-05-17 10:23:33 -0700 |
| commit | 12b707c52de60f1cb4a0b4af8c379d4a11dfba35 (patch) | |
| tree | d481dc1171db94282d2a5e5c5b96d7a71dec7e74 | |
| parent | 5c6f6797047d5d3fdf6d84c2d7fe441ed8eb89b6 (diff) | |
| download | meta-openembedded-12b707c52de60f1cb4a0b4af8c379d4a11dfba35.tar.gz | |
nlohmann-json: backport gcc10 fix
The following issue and PR describe an issue with nlohmann-json and
GCC10.
https://github.com/nlohmann/json/issues/1920
https://github.com/nlohmann/json/pull/2034
Confirmed that this fixed the issue seen in OpenBMC when pulling in the
latest upstream meta-openembedded.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
3 files changed, 146 insertions, 1 deletions
diff --git a/meta-oe/recipes-devtools/nlohmann-json/nlohmann-json/0001-Templatize-basic_json-ctor-from-json_ref.patch b/meta-oe/recipes-devtools/nlohmann-json/nlohmann-json/0001-Templatize-basic_json-ctor-from-json_ref.patch new file mode 100644 index 0000000000..aea48b60a5 --- /dev/null +++ b/meta-oe/recipes-devtools/nlohmann-json/nlohmann-json/0001-Templatize-basic_json-ctor-from-json_ref.patch | |||
| @@ -0,0 +1,99 @@ | |||
| 1 | From ec955f08b47ab7cb81f6e4a4c3e7b331ddf50f71 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: =?UTF-8?q?Art=C3=B6m=20Bakri=20Al-Sarmini?= <3sz3tt+git@gmail.com> | ||
| 3 | Date: Sun, 12 Apr 2020 22:32:39 +0300 | ||
| 4 | Subject: [PATCH] Templatize basic_json ctor from json_ref | ||
| 5 | |||
| 6 | Upstream-Status: Backport [https://github.com/nlohmann/json/commit/ec955f08b47ab7cb81f6e4a4c3e7b331ddf50f71] | ||
| 7 | Signed-off-by: Andrew Geissler <geissonator@gmail.com> | ||
| 8 | |||
| 9 | --- | ||
| 10 | include/nlohmann/detail/meta/type_traits.hpp | 13 ++++++++++++ | ||
| 11 | include/nlohmann/json.hpp | 8 ++++---- | ||
| 12 | single_include/nlohmann/json.hpp | 21 ++++++++++++++++---- | ||
| 13 | 3 files changed, 34 insertions(+), 8 deletions(-) | ||
| 14 | |||
| 15 | diff --git a/include/nlohmann/detail/meta/type_traits.hpp b/include/nlohmann/detail/meta/type_traits.hpp | ||
| 16 | index 280f6953..dd0b3084 100644 | ||
| 17 | --- a/include/nlohmann/detail/meta/type_traits.hpp | ||
| 18 | +++ b/include/nlohmann/detail/meta/type_traits.hpp | ||
| 19 | @@ -41,6 +41,19 @@ template<typename> struct is_basic_json : std::false_type {}; | ||
| 20 | NLOHMANN_BASIC_JSON_TPL_DECLARATION | ||
| 21 | struct is_basic_json<NLOHMANN_BASIC_JSON_TPL> : std::true_type {}; | ||
| 22 | |||
| 23 | +////////////////////// | ||
| 24 | +// jspn_ref helpers // | ||
| 25 | +////////////////////// | ||
| 26 | + | ||
| 27 | +template <typename> | ||
| 28 | +class json_ref; | ||
| 29 | + | ||
| 30 | +template<typename> | ||
| 31 | +struct is_json_ref : std::false_type {}; | ||
| 32 | + | ||
| 33 | +template <typename T> | ||
| 34 | +struct is_json_ref<json_ref<T>> : std::true_type {}; | ||
| 35 | + | ||
| 36 | ////////////////////////// | ||
| 37 | // aliases for detected // | ||
| 38 | ////////////////////////// | ||
| 39 | diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp | ||
| 40 | index 336d69fe..0598efc8 100644 | ||
| 41 | --- a/include/nlohmann/json.hpp | ||
| 42 | +++ b/include/nlohmann/json.hpp | ||
| 43 | @@ -1773,10 +1773,10 @@ class basic_json | ||
| 44 | // other constructors and destructor // | ||
| 45 | /////////////////////////////////////// | ||
| 46 | |||
| 47 | - /// @private | ||
| 48 | - basic_json(const detail::json_ref<basic_json>& ref) | ||
| 49 | - : basic_json(ref.moved_or_copied()) | ||
| 50 | - {} | ||
| 51 | + template <typename JsonRef, | ||
| 52 | + detail::enable_if_t<detail::conjunction<detail::is_json_ref<JsonRef>, | ||
| 53 | + std::is_same<typename JsonRef::value_type, basic_json>>::value, int> = 0 > | ||
| 54 | + basic_json(const JsonRef& ref) : basic_json(ref.moved_or_copied()) {} | ||
| 55 | |||
| 56 | /*! | ||
| 57 | @brief copy constructor | ||
| 58 | diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp | ||
| 59 | index 09464f3b..8927180e 100644 | ||
| 60 | --- a/single_include/nlohmann/json.hpp | ||
| 61 | +++ b/single_include/nlohmann/json.hpp | ||
| 62 | @@ -2794,6 +2794,19 @@ template<typename> struct is_basic_json : std::false_type {}; | ||
| 63 | NLOHMANN_BASIC_JSON_TPL_DECLARATION | ||
| 64 | struct is_basic_json<NLOHMANN_BASIC_JSON_TPL> : std::true_type {}; | ||
| 65 | |||
| 66 | +////////////////////// | ||
| 67 | +// jspn_ref helpers // | ||
| 68 | +////////////////////// | ||
| 69 | + | ||
| 70 | +template <typename> | ||
| 71 | +class json_ref; | ||
| 72 | + | ||
| 73 | +template<typename> | ||
| 74 | +struct is_json_ref : std::false_type {}; | ||
| 75 | + | ||
| 76 | +template <typename T> | ||
| 77 | +struct is_json_ref<json_ref<T>> : std::true_type {}; | ||
| 78 | + | ||
| 79 | ////////////////////////// | ||
| 80 | // aliases for detected // | ||
| 81 | ////////////////////////// | ||
| 82 | @@ -16632,10 +16645,10 @@ class basic_json | ||
| 83 | // other constructors and destructor // | ||
| 84 | /////////////////////////////////////// | ||
| 85 | |||
| 86 | - /// @private | ||
| 87 | - basic_json(const detail::json_ref<basic_json>& ref) | ||
| 88 | - : basic_json(ref.moved_or_copied()) | ||
| 89 | - {} | ||
| 90 | + template <typename JsonRef, | ||
| 91 | + detail::enable_if_t<detail::conjunction<detail::is_json_ref<JsonRef>, | ||
| 92 | + std::is_same<typename JsonRef::value_type, basic_json>>::value, int> = 0 > | ||
| 93 | + basic_json(const JsonRef& ref) : basic_json(ref.moved_or_copied()) {} | ||
| 94 | |||
| 95 | /*! | ||
| 96 | @brief copy constructor | ||
| 97 | -- | ||
| 98 | 2.21.0 (Apple Git-122) | ||
| 99 | |||
diff --git a/meta-oe/recipes-devtools/nlohmann-json/nlohmann-json/0001-typo-fix.patch b/meta-oe/recipes-devtools/nlohmann-json/nlohmann-json/0001-typo-fix.patch new file mode 100644 index 0000000000..6af4e97403 --- /dev/null +++ b/meta-oe/recipes-devtools/nlohmann-json/nlohmann-json/0001-typo-fix.patch | |||
| @@ -0,0 +1,43 @@ | |||
| 1 | From 70be9751cd60e622ce6463f41d47c02fc2d83cbc Mon Sep 17 00:00:00 2001 | ||
| 2 | From: =?UTF-8?q?Art=C3=B6m=20Bakri=20Al-Sarmini?= <3sz3tt+git@gmail.com> | ||
| 3 | Date: Sun, 12 Apr 2020 23:42:26 +0300 | ||
| 4 | Subject: [PATCH] typo fix | ||
| 5 | |||
| 6 | Upstream-Status: Backport [https://github.com/nlohmann/json/commit/70be9751cd60e622ce6463f41d47c02fc2d83cbc] | ||
| 7 | |||
| 8 | Signed-off-by: Andrew Geissler <geissonator@gmail.com> | ||
| 9 | |||
| 10 | --- | ||
| 11 | include/nlohmann/detail/meta/type_traits.hpp | 2 +- | ||
| 12 | single_include/nlohmann/json.hpp | 2 +- | ||
| 13 | 2 files changed, 2 insertions(+), 2 deletions(-) | ||
| 14 | |||
| 15 | diff --git a/include/nlohmann/detail/meta/type_traits.hpp b/include/nlohmann/detail/meta/type_traits.hpp | ||
| 16 | index dd0b3084..13e92cb4 100644 | ||
| 17 | --- a/include/nlohmann/detail/meta/type_traits.hpp | ||
| 18 | +++ b/include/nlohmann/detail/meta/type_traits.hpp | ||
| 19 | @@ -42,7 +42,7 @@ NLOHMANN_BASIC_JSON_TPL_DECLARATION | ||
| 20 | struct is_basic_json<NLOHMANN_BASIC_JSON_TPL> : std::true_type {}; | ||
| 21 | |||
| 22 | ////////////////////// | ||
| 23 | -// jspn_ref helpers // | ||
| 24 | +// json_ref helpers // | ||
| 25 | ////////////////////// | ||
| 26 | |||
| 27 | template <typename> | ||
| 28 | diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp | ||
| 29 | index 8927180e..294e7509 100644 | ||
| 30 | --- a/single_include/nlohmann/json.hpp | ||
| 31 | +++ b/single_include/nlohmann/json.hpp | ||
| 32 | @@ -2795,7 +2795,7 @@ NLOHMANN_BASIC_JSON_TPL_DECLARATION | ||
| 33 | struct is_basic_json<NLOHMANN_BASIC_JSON_TPL> : std::true_type {}; | ||
| 34 | |||
| 35 | ////////////////////// | ||
| 36 | -// jspn_ref helpers // | ||
| 37 | +// json_ref helpers // | ||
| 38 | ////////////////////// | ||
| 39 | |||
| 40 | template <typename> | ||
| 41 | -- | ||
| 42 | 2.21.0 (Apple Git-122) | ||
| 43 | |||
diff --git a/meta-oe/recipes-devtools/nlohmann-json/nlohmann-json_3.7.3.bb b/meta-oe/recipes-devtools/nlohmann-json/nlohmann-json_3.7.3.bb index 86fe673b47..5766194d26 100644 --- a/meta-oe/recipes-devtools/nlohmann-json/nlohmann-json_3.7.3.bb +++ b/meta-oe/recipes-devtools/nlohmann-json/nlohmann-json_3.7.3.bb | |||
| @@ -4,7 +4,10 @@ SECTION = "libs" | |||
| 4 | LICENSE = "MIT" | 4 | LICENSE = "MIT" |
| 5 | LIC_FILES_CHKSUM = "file://LICENSE.MIT;md5=f5f7c71504da070bcf4f090205ce1080" | 5 | LIC_FILES_CHKSUM = "file://LICENSE.MIT;md5=f5f7c71504da070bcf4f090205ce1080" |
| 6 | 6 | ||
| 7 | SRC_URI = "git://github.com/nlohmann/json.git;nobranch=1" | 7 | SRC_URI = "git://github.com/nlohmann/json.git;nobranch=1 \ |
| 8 | file://0001-Templatize-basic_json-ctor-from-json_ref.patch \ | ||
| 9 | file://0001-typo-fix.patch \ | ||
| 10 | " | ||
| 8 | 11 | ||
| 9 | SRCREV = "e7b3b40b5a95bc74b9a7f662830a27c49ffc01b4" | 12 | SRCREV = "e7b3b40b5a95bc74b9a7f662830a27c49ffc01b4" |
| 10 | 13 | ||
