diff --git a/0001-sync-Fix-c-20-compilation-problem-for-clang10-1228.patch b/0001-sync-Fix-c-20-compilation-problem-for-clang10-1228.patch new file mode 100644 index 0000000000000000000000000000000000000000..a5107b54dadfb08f5aa1d6aa2cf272bb06d4ee06 --- /dev/null +++ b/0001-sync-Fix-c-20-compilation-problem-for-clang10-1228.patch @@ -0,0 +1,32 @@ +From a73d35d61b5a0f41c30b85a4b00a7f10786e5a5d Mon Sep 17 00:00:00 2001 +From: zhangzhangxin +Date: Tue, 25 Apr 2023 20:29:33 +0800 +Subject: [PATCH] sync:Fix c++20 compilation problem for clang10 #1228 + +Signed-off-by: zhangzhangxin +--- + jsoncpp-1.9.4/include/json/allocator.h | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/jsoncpp-1.9.4/include/json/allocator.h b/jsoncpp-1.9.4/include/json/allocator.h +index 0f5c224..95ef8a5 100644 +--- a/jsoncpp-1.9.4/include/json/allocator.h ++++ b/jsoncpp-1.9.4/include/json/allocator.h +@@ -35,11 +35,10 @@ public: + * Release memory which was allocated for N items at pointer P. + * + * The memory block is filled with zeroes before being released. +- * The pointer argument is tagged as "volatile" to prevent the +- * compiler optimizing out this critical step. + */ +- void deallocate(volatile pointer p, size_type n) { +- std::memset(p, 0, n * sizeof(T)); ++ void deallocate(pointer p, size_type n) { ++ // memset_s is used because memset may be optimized away by the compiler ++ memset_s(p, n * sizeof(T), 0, n * sizeof(T)); + // free using "global operator delete" + ::operator delete(p); + } +-- +2.40.0.windows.1 + diff --git a/jsoncpp.spec b/jsoncpp.spec index b8af95796b93dbcf65611df26e5068ef9345d176..79fe06014325f6ae31bfec76263aca913055b826 100644 --- a/jsoncpp.spec +++ b/jsoncpp.spec @@ -1,11 +1,12 @@ Name: jsoncpp Version: 1.9.4 -Release: 1 +Release: 2 Summary: JSON C++ library License: Public Domain or MIT URL: https://github.com/open-source-parsers/jsoncpp Source0: https://github.com/open-source-parsers/jsoncpp/archive/%{version}/%{name}-%{version}.tar.gz BuildRequires: gcc-c++ cmake >= 3.1 python3-devel +Patch0: 0001-sync-Fix-c-20-compilation-problem-for-clang10-1228.patch %description JsonCpp is a C++ library that allows manipulating JSON values, @@ -88,6 +89,9 @@ hardlink -cfv %{buildroot}%{_docdir}/%{name} %changelog +* Tue Apr 25 2023 zhangxin - 1.9.4-2 +- sync:Fix c++20 compilation problem for clang10 + * Wed Feb 3 2021 liudabo - 1.9.4-1 - upgrade version to 1.9.4