USCiLab / cereal

A C++11 library for serialization
BSD 3-Clause "New" or "Revised" License
4.23k stars 761 forks source link

Update RapidJSON to fix deprecation errors #456

Open Enhex opened 6 years ago

Enhex commented 6 years ago

see: https://github.com/Tencent/rapidjson/issues/1131

tl;dr: Since Visual Studio 15.5 some(?) deprecated standard features result errors.

RapidJSON used to use std::iterator which is deprecated and results errors. It was already fixed in RapidJSON (see linked issue), just need to update.

AzothAmmo commented 6 years ago

Definitely want to do this ASAP since we have several issues related to having an older version of rapid json.

furkanusta commented 6 years ago

Do you apply any modifications to RapidJSON or RapidXML? If not maybe we can add an option to CMake to use the system installed version if it exists and download from Github if it doesn't

AzothAmmo commented 6 years ago

There are a few changes we make such as adding a CEREAL_ prefix to all macros and nesting it within a cereal namespace.

The namespace part makes this a bit tricky to use scripting to make these changes automatically if we were to pull the latest from github, for example. A potential alternative is that we could have a CMake flag to use the system rapidjson and then have appropriate macros so that the JSON archive interfaces with the correct rapidjson.

rcdailey commented 6 years ago

Have these been fixed yet? Hitting lots of warnings using C++17 on MSVC 15.8

EDIT: Looks like these warnings originate from rapidjson:

8>e:\code\frontend2\source\core\thirdparty\cereal\cereal\include\cereal\external\rapidjson\document.h(115): warning C4996: 'std::iterator<std::random_access_iterator_tag,internal::MaybeAddConst<Const,cereal_rapidjson::GenericMember<Encoding,Allocator>>::Type,ptrdiff_t,_Ty*,_Ty&>': warning STL4015: The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. (The header is NOT deprecated.) The C++ Standard has never required user-defined iterators to derive from std::iterator. To fix this warning, stop deriving from std::iterator and start providing publicly accessible typedefs named iterator_category, value_type, difference_type, pointer, and reference. Note that value_type is required to be non-const, even for constant iterators. You can define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning.

Zingam commented 5 years ago

In Visual Studio 2019, Preview 2 I get:

C:\SDKs\vcpkg\installed\x64-windows\include\rapidjson\document.h(110):` warning C4996: 'std::iterator<std::random_access_iterator_tag,internal::MaybeAddConst<Const,rapidjson::GenericMember<Encoding,Allocator>>::Type,ptrdiff_t,_Ty,_Ty&>': warning STL4015: The std::iterator class template (used as a base class to provide typedefs) is deprecated in C++17. (The header is NOT deprecated.) The C++ Standard has never required user-defined iterators to derive from std::iterator. To fix this warning, stop deriving from std::iterator and start providing publicly accessible typedefs named iterator_category, value_type, difference_type, pointer, and reference. Note that value_type is required to be non-const, even for constant iterators. You can define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING or _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS to acknowledge that you have received this warning. with [ _Ty=internal::MaybeAddConst<Const,rapidjson::GenericMember<Encoding,Allocator>>::Type ] C:\SDKs\vcpkg\installed\x64-windows\include\rapidjson/document.h(102): note: see declaration of 'std::iterator<std::random_access_iterator_tag,internal::MaybeAddConst<Const,rapidjson::GenericMember<Encoding,Allocator>>::Type,ptrdiff_t,_Ty,_Ty&>' with [ _Ty=internal::MaybeAddConst<Const,rapidjson::GenericMember<Encoding,Allocator>>::Type ]

rcdailey commented 5 years ago

My gut feel is that this project is dead. Commit activity seems to dying down.

trashuj commented 5 years ago

hmm. i just copy/pasted the latest rapidjson sources in cereal externals, and changed CEREAL_RAPIDJSON_NAMESPACE for RAPIDJSON_NAMESPACE in cereal\archives\json.hpp and it seems to work fine with vs 2017 and C++17. i'll keep you posted if i run in any issues.