commit msgpack-cxx for openSUSE:Factory
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package msgpack-cxx for openSUSE:Factory checked in at 2023-11-30 21:59:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/msgpack-cxx (Old) and /work/SRC/openSUSE:Factory/.msgpack-cxx.new.25432 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "msgpack-cxx" Thu Nov 30 21:59:57 2023 rev:4 rq:1122999 version:6.1.0 Changes: -------- --- /work/SRC/openSUSE:Factory/msgpack-cxx/msgpack-cxx.changes 2022-12-05 18:00:51.476469442 +0100 +++ /work/SRC/openSUSE:Factory/.msgpack-cxx.new.25432/msgpack-cxx.changes 2023-11-30 22:00:52.280065330 +0100 @@ -1,0 +2,7 @@ +Thu Nov 2 21:44:34 UTC 2023 - Jan Engelhardt <jengelh@inai.de> + +- Update to release 6.1.0 + * Remove dependency on boost in chrono.hpp + * Add support for std::variant behavior + +------------------------------------------------------------------- Old: ---- msgpack-cxx-4.1.3.tar.gz New: ---- msgpack-cxx-6.1.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ msgpack-cxx.spec ++++++ --- /var/tmp/diff_new_pack.NiDkUr/_old 2023-11-30 22:00:53.280102169 +0100 +++ /var/tmp/diff_new_pack.NiDkUr/_new 2023-11-30 22:00:53.280102169 +0100 @@ -1,7 +1,7 @@ # # spec file for package msgpack-cxx # -# Copyright (c) 2022 SUSE LLC +# Copyright (c) 2023 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: msgpack-cxx -Version: 4.1.3 +Version: 6.1.0 Release: 0 Summary: Object serialization library for cross-language communication (C++ interface) License: BSL-1.0 @@ -27,6 +27,7 @@ BuildRequires: boost-devel BuildRequires: c++_compiler BuildRequires: cmake +BuildRequires: fdupes BuildRequires: pkg-config %description @@ -37,9 +38,9 @@ Summary: Development headers for libmsgpack C++ library Group: Development/Libraries/C and C++ Requires: libboost_headers-devel -Requires: msgpack-c-devel >= 4 +Requires: msgpack-c-devel >= 6 Provides: libmsgpack-devel = %{version}-%{release} -Conflicts: msgpack-devel < 4 +Conflicts: msgpack-devel < 6 %description devel MessagePack is a binary-based object serialization library. It enables to @@ -52,10 +53,11 @@ %build %cmake -%make_jobs +%cmake_build %install %cmake_install +%fdupes %buildroot/%_prefix %files devel %license COPYING ++++++ msgpack-cxx-4.1.3.tar.gz -> msgpack-cxx-6.1.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/CMakeLists.txt new/msgpack-cxx-6.1.0/CMakeLists.txt --- old/msgpack-cxx-4.1.3/CMakeLists.txt 2022-09-07 05:49:03.000000000 +0200 +++ new/msgpack-cxx-6.1.0/CMakeLists.txt 2023-07-08 05:21:22.000000000 +0200 @@ -2,9 +2,9 @@ CMAKE_POLICY (SET CMP0054 NEW) -PROJECT (msgpack LANGUAGES CXX) +PROJECT (msgpack-cxx LANGUAGES CXX) -ADD_LIBRARY (msgpackc-cxx INTERFACE) +ADD_LIBRARY (msgpack-cxx INTERFACE) FILE (READ ${CMAKE_CURRENT_SOURCE_DIR}/include/msgpack/version_master.hpp contents) STRING (REGEX MATCH "#define MSGPACK_VERSION_MAJOR *([0-9a-zA-Z_]*)" NULL_OUT ${contents}) @@ -23,16 +23,17 @@ OPTION (MSGPACK_CXX17 "Using c++17 compiler" OFF) OPTION (MSGPACK_CXX20 "Using c++20 compiler" OFF) -OPTION (MSGPACK_32BIT "32bit compile" OFF) -OPTION (MSGPACK_USE_BOOST "Use Boost libraried" ON) -OPTION (MSGPACK_USE_X3_PARSE "Use Boost X3 parse" OFF) -OPTION (MSGPACK_BUILD_TESTS "Build tests" OFF) -OPTION (MSGPACK_BUILD_DOCS "Build Doxygen documentation" ON) -OPTION (MSGPACK_FUZZ_REGRESSION "Enable regression testing" OFF) -OPTION (MSGPACK_BUILD_EXAMPLES "Build msgpack examples" OFF) -OPTION (MSGPACK_GEN_COVERAGE "Generate coverage report" OFF) -OPTION (MSGPACK_USE_STATIC_BOOST "Statically link with boost libraries" OFF) -OPTION (MSGPACK_CHAR_SIGN "Char sign to use (signed or unsigned)") +OPTION (MSGPACK_32BIT "32bit compile" OFF) +OPTION (MSGPACK_USE_BOOST "Use Boost libraried" ON) +OPTION (MSGPACK_USE_X3_PARSE "Use Boost X3 parse" OFF) +OPTION (MSGPACK_BUILD_TESTS "Build tests" OFF) +OPTION (MSGPACK_BUILD_DOCS "Build Doxygen documentation" ON) +OPTION (MSGPACK_FUZZ_REGRESSION "Enable regression testing" OFF) +OPTION (MSGPACK_BUILD_EXAMPLES "Build msgpack examples" OFF) +OPTION (MSGPACK_GEN_COVERAGE "Generate coverage report" OFF) +OPTION (MSGPACK_USE_STATIC_BOOST "Statically link with boost libraries" OFF) +OPTION (MSGPACK_CHAR_SIGN "Char sign to use (signed or unsigned)") +OPTION (MSGPACK_USE_STD_VARIANT_ADAPTOR "Enable the adaptor for std::variant" OFF) SET (CMAKE_CXX_STANDARD_REQUIRED ON) @@ -57,11 +58,11 @@ IF (MSGPACK_32BIT) IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - TARGET_COMPILE_OPTIONS(msgpackc-cxx INTERFACE -m32) - TARGET_LINK_OPTIONS(msgpackc-cxx INTERFACE -m32) + TARGET_COMPILE_OPTIONS(msgpack-cxx INTERFACE -m32) + TARGET_LINK_OPTIONS(msgpack-cxx INTERFACE -m32) ELSEIF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") - TARGET_COMPILE_OPTIONS(msgpackc-cxx INTERFACE -m32) - TARGET_LINK_OPTIONS(msgpackc-cxx INTERFACE -m32) + TARGET_COMPILE_OPTIONS(msgpack-cxx INTERFACE -m32) + TARGET_LINK_OPTIONS(msgpack-cxx INTERFACE -m32) ENDIF () ENDIF () @@ -78,18 +79,22 @@ FIND_PACKAGE (Boost REQUIRED) ELSE () - TARGET_COMPILE_DEFINITIONS(msgpackc-cxx INTERFACE MSGPACK_NO_BOOST) + TARGET_COMPILE_DEFINITIONS(msgpack-cxx INTERFACE MSGPACK_NO_BOOST) ENDIF () IF (MSGPACK_CHAR_SIGN) - TARGET_COMPILE_OPTIONS(msgpackc-cxx INTERFACE -f${MSGPACK_CHAR_SIGN}-char) + TARGET_COMPILE_OPTIONS(msgpack-cxx INTERFACE -f${MSGPACK_CHAR_SIGN}-char) ENDIF () IF (MSGPACK_DEFAULT_API_VERSION) - TARGET_COMPILE_DEFINITIONS(msgpackc-cxx INTERFACE MSGPACK_DEFAULT_API_VERSION=${MSGPACK_DEFAULT_API_VERSION}) + TARGET_COMPILE_DEFINITIONS(msgpack-cxx INTERFACE MSGPACK_DEFAULT_API_VERSION=${MSGPACK_DEFAULT_API_VERSION}) ELSE () SET (MSGPACK_DEFAULT_API_VERSION 3) - TARGET_COMPILE_DEFINITIONS(msgpackc-cxx INTERFACE MSGPACK_DEFAULT_API_VERSION=3) + TARGET_COMPILE_DEFINITIONS(msgpack-cxx INTERFACE MSGPACK_DEFAULT_API_VERSION=3) +ENDIF () + +IF (MSGPACK_USE_STD_VARIANT_ADAPTOR) + TARGET_COMPILE_DEFINITIONS(msgpack-cxx INTERFACE MSGPACK_USE_STD_VARIANT_ADAPTOR) ENDIF () IF ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") @@ -112,7 +117,7 @@ INCLUDE (Files.cmake) -TARGET_INCLUDE_DIRECTORIES (msgpackc-cxx +TARGET_INCLUDE_DIRECTORIES (msgpack-cxx INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include> @@ -120,7 +125,7 @@ ) IF (MSGPACK_USE_BOOST) - TARGET_LINK_LIBRARIES (msgpackc-cxx INTERFACE Boost::boost) + TARGET_LINK_LIBRARIES (msgpack-cxx INTERFACE Boost::boost) ENDIF () IF (MSGPACK_GEN_COVERAGE) @@ -156,7 +161,7 @@ ENDIF () IF ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "sparc") - TARGET_COMPILE_DEFINITIONS(msgpackc-cxx INTERFACE MSGPACK_ZONE_ALIGN=8) + TARGET_COMPILE_DEFINITIONS(msgpack-cxx INTERFACE MSGPACK_ZONE_ALIGN=8) ENDIF () IF (MSGPACK_BUILD_EXAMPLES) @@ -193,9 +198,9 @@ include (GNUInstallDirs) # Install library. -INSTALL (TARGETS msgpackc-cxx - EXPORT msgpackc-cxx-targets - COMPONENT msgpackc-cxx +INSTALL (TARGETS msgpack-cxx + EXPORT msgpack-cxx-targets + COMPONENT msgpack-cxx # This provides include directory in exported target # relative to prefix in single directory we've put everything in. INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" @@ -204,7 +209,7 @@ # Install headers from source tree. INSTALL (DIRECTORY include/ DESTINATION include - COMPONENT msgpackc-cxx + COMPONENT msgpack-cxx ) INCLUDE (CMakePackageConfigHelpers) @@ -212,18 +217,18 @@ IF (NOT (CMAKE_VERSION VERSION_LESS 3.14)) SET (extra_version_file_args ARCH_INDEPENDENT) ENDIF () -SET (cmake_config_path "${CMAKE_INSTALL_LIBDIR}/cmake/msgpackc-cxx") +SET (cmake_config_path "${CMAKE_INSTALL_LIBDIR}/cmake/msgpack-cxx") # Configure the main package file from source tree. CONFIGURE_PACKAGE_CONFIG_FILE ( - msgpack-config.cmake.in - "${CMAKE_CURRENT_BINARY_DIR}/msgpack-config.cmake" + msgpack-cxx-config.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/msgpack-cxx-config.cmake" INSTALL_DESTINATION "${cmake_config_path}" ) # Write package version file. WRITE_BASIC_PACKAGE_VERSION_FILE ( - msgpack-config-version.cmake + msgpack-cxx-config-version.cmake VERSION ${VERSION} COMPATIBILITY SameMajorVersion ${extra_version_file_args} @@ -231,16 +236,16 @@ # Install the generated package version file and the main package file. INSTALL (FILES - "${CMAKE_CURRENT_BINARY_DIR}/msgpack-config.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/msgpack-config-version.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/msgpack-cxx-config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/msgpack-cxx-config-version.cmake" DESTINATION "${cmake_config_path}" - COMPONENT msgpackc-cxx + COMPONENT msgpack-cxx ) # This installs package in install tree for using installed targets. INSTALL ( - EXPORT msgpackc-cxx-targets - FILE msgpackc-cxx-targets.cmake + EXPORT msgpack-cxx-targets + FILE msgpack-cxx-targets.cmake DESTINATION "${cmake_config_path}" - COMPONENT msgpackc-cxx + COMPONENT msgpack-cxx ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/ChangeLog new/msgpack-cxx-6.1.0/ChangeLog --- old/msgpack-cxx-4.1.3/ChangeLog 2022-11-02 05:47:51.000000000 +0100 +++ new/msgpack-cxx-6.1.0/ChangeLog 2023-03-04 14:47:52.000000000 +0100 @@ -1,3 +1,13 @@ +# 2023-03-02 version 6.0.0 +## << breaking changes >> + * Change CMake package name of C++ library to msgpack-cxx (#1054) + Unified all C++ package, library, cmake, tarball name become msgpack-cxx. + +# 2023-01-10 version 5.0.0 for C++ + * Fix config for new MSVC preprocessor (#1040) +## << breaking changes >> + * Change CMake package name of C++ library to msgpackc-cxx (#1045, #1048) + # 2022-11-02 version 4.1.3 for C++ * Fix compile error that direct inclusion of chrono with `MSGPACK_NO_BOOST` (#1038)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/Files.cmake new/msgpack-cxx-6.1.0/Files.cmake --- old/msgpack-cxx-4.1.3/Files.cmake 2022-09-07 06:25:24.000000000 +0200 +++ new/msgpack-cxx-6.1.0/Files.cmake 2023-07-08 05:28:00.000000000 +0200 @@ -1,4 +1,4 @@ -SET (msgpackc_HEADERS +SET (msgpack-cxx_HEADERS include/msgpack.hpp include/msgpack/adaptor/adaptor_base.hpp include/msgpack/adaptor/adaptor_base_decl.hpp @@ -33,6 +33,7 @@ include/msgpack/adaptor/cpp17/carray_byte.hpp include/msgpack/adaptor/cpp17/optional.hpp include/msgpack/adaptor/cpp17/string_view.hpp + include/msgpack/adaptor/cpp17/variant.hpp include/msgpack/adaptor/cpp17/vector_byte.hpp include/msgpack/adaptor/cpp20/span.hpp include/msgpack/adaptor/define.hpp @@ -542,6 +543,7 @@ include/msgpack/v1/adaptor/cpp17/carray_byte.hpp include/msgpack/v1/adaptor/cpp17/optional.hpp include/msgpack/v1/adaptor/cpp17/string_view.hpp + include/msgpack/v1/adaptor/cpp17/variant.hpp include/msgpack/v1/adaptor/cpp17/vector_byte.hpp include/msgpack/v1/adaptor/cpp20/span.hpp include/msgpack/v1/adaptor/define.hpp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/README new/msgpack-cxx-6.1.0/README --- old/msgpack-cxx-4.1.3/README 2022-11-02 05:47:51.000000000 +0100 +++ new/msgpack-cxx-6.1.0/README 2023-03-04 14:47:52.000000000 +0100 @@ -1,7 +1,7 @@ `msgpack` for C++ =================== -Version 4.1.3 [![Build Status](https://github.com/msgpack/msgpack-c/workflows/CI/badge.svg?branch=cpp_master)](https://github.com/msgpack/msgpack-c/actions) [![Build status](https://ci.appveyor.com/api/projects/status/8kstcgt79qj123mw/branch/cpp_master?svg=true)](https://ci.appveyor.com/project/redboltz/msgpack-c/branch/cpp_master) +Version 6.0.0 [![Build Status](https://github.com/msgpack/msgpack-c/workflows/CI/badge.svg?branch=cpp_master)](https://github.com/msgpack/msgpack-c/actions) [![Build status](https://ci.appveyor.com/api/projects/status/8kstcgt79qj123mw/branch/cpp_master?svg=true)](https://ci.appveyor.com/project/redboltz/msgpack-c/branch/cpp_master) [![codecov](https://codecov.io/gh/msgpack/msgpack-c/branch/cpp_master/graph/badge.svg)](https://codecov.io/gh/msgpack/msgpack-c/branch/cpp_master) It's like JSON but smaller and faster. @@ -98,7 +98,7 @@ # ... find_package(msgpack REQUIRED) # ... - target_link_libraries(your_target_name <PRIVATE/PUBLIC/INTERFACE> msgpackc-cxx) + target_link_libraries(your_target_name <PRIVATE/PUBLIC/INTERFACE> msgpack-cxx) # ... ``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/README.md new/msgpack-cxx-6.1.0/README.md --- old/msgpack-cxx-4.1.3/README.md 2022-11-02 05:47:31.000000000 +0100 +++ new/msgpack-cxx-6.1.0/README.md 2023-07-08 06:16:09.000000000 +0200 @@ -1,7 +1,7 @@ `msgpack` for C++ =================== -Version 4.1.3 [![Build Status](https://github.com/msgpack/msgpack-c/workflows/CI/badge.svg?branch=cpp_master)](https://github.com/msgpack/msgpack-c/actions) [![Build status](https://ci.appveyor.com/api/projects/status/8kstcgt79qj123mw/branch/cpp_master?svg=true)](https://ci.appveyor.com/project/redboltz/msgpack-c/branch/cpp_master) +Version 6.1.0 [![Build Status](https://github.com/msgpack/msgpack-c/workflows/CI/badge.svg?branch=cpp_master)](https://github.com/msgpack/msgpack-c/actions) [![Build status](https://ci.appveyor.com/api/projects/status/8kstcgt79qj123mw/branch/cpp_master?svg=true)](https://ci.appveyor.com/project/redboltz/msgpack-c/branch/cpp_master) [![codecov](https://codecov.io/gh/msgpack/msgpack-c/branch/cpp_master/graph/badge.svg)](https://codecov.io/gh/msgpack/msgpack-c/branch/cpp_master) It's like JSON but smaller and faster. @@ -98,7 +98,7 @@ # ... find_package(msgpack REQUIRED) # ... - target_link_libraries(your_target_name <PRIVATE/PUBLIC/INTERFACE> msgpackc-cxx) + target_link_libraries(your_target_name <PRIVATE/PUBLIC/INTERFACE> msgpack-cxx) # ... ``` diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/example/boost/CMakeLists.txt new/msgpack-cxx-6.1.0/example/boost/CMakeLists.txt --- old/msgpack-cxx-4.1.3/example/boost/CMakeLists.txt 2022-08-25 11:56:15.000000000 +0200 +++ new/msgpack-cxx-6.1.0/example/boost/CMakeLists.txt 2023-07-08 05:21:22.000000000 +0200 @@ -21,7 +21,7 @@ ${source_file} ) TARGET_LINK_LIBRARIES (${source_file_we} PRIVATE - msgpackc-cxx + msgpack-cxx Boost::system Threads::Threads ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/example/cpp03/CMakeLists.txt new/msgpack-cxx-6.1.0/example/cpp03/CMakeLists.txt --- old/msgpack-cxx-4.1.3/example/cpp03/CMakeLists.txt 2022-08-25 11:56:15.000000000 +0200 +++ new/msgpack-cxx-6.1.0/example/cpp03/CMakeLists.txt 2023-07-08 05:21:22.000000000 +0200 @@ -43,7 +43,7 @@ ${source_file} ) TARGET_LINK_LIBRARIES (${source_file_we} PRIVATE - msgpackc-cxx + msgpack-cxx ) IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra") @@ -64,7 +64,7 @@ ${source_file} ) TARGET_LINK_LIBRARIES (${source_file_we} PRIVATE - msgpackc-cxx + msgpack-cxx Threads::Threads ) IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") @@ -86,7 +86,7 @@ ${source_file} ) TARGET_LINK_LIBRARIES (${source_file_we} PRIVATE - msgpackc-cxx + msgpack-cxx Boost::timer ) IF (NOT MSVC AND NOT APPLE) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/example/cpp11/CMakeLists.txt new/msgpack-cxx-6.1.0/example/cpp11/CMakeLists.txt --- old/msgpack-cxx-4.1.3/example/cpp11/CMakeLists.txt 2022-08-25 11:56:15.000000000 +0200 +++ new/msgpack-cxx-6.1.0/example/cpp11/CMakeLists.txt 2023-07-08 05:21:22.000000000 +0200 @@ -17,7 +17,7 @@ ${source_file} ) TARGET_LINK_LIBRARIES (${source_file_we} PRIVATE - msgpackc-cxx + msgpack-cxx ) IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/example/x3/CMakeLists.txt new/msgpack-cxx-6.1.0/example/x3/CMakeLists.txt --- old/msgpack-cxx-4.1.3/example/x3/CMakeLists.txt 2022-08-25 11:56:15.000000000 +0200 +++ new/msgpack-cxx-6.1.0/example/x3/CMakeLists.txt 2023-07-08 05:21:22.000000000 +0200 @@ -15,7 +15,7 @@ ${source_file_we} ${source_file} ) - TARGET_LINK_LIBRARIES (${source_file_we} PRIVATE msgpackc-cxx) + TARGET_LINK_LIBRARIES (${source_file_we} PRIVATE msgpack-cxx) IF ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") SET_PROPERTY (TARGET ${source_file_we} APPEND_STRING PROPERTY COMPILE_FLAGS " -Wall -Wextra") @@ -40,7 +40,7 @@ ${source_file} ) TARGET_LINK_LIBRARIES (${source_file_we} PRIVATE - msgpackc-cxx + msgpack-cxx Boost::context Boost::system Threads::Threads diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/fuzz/CMakeLists.txt new/msgpack-cxx-6.1.0/fuzz/CMakeLists.txt --- old/msgpack-cxx-4.1.3/fuzz/CMakeLists.txt 2022-08-25 11:56:15.000000000 +0200 +++ new/msgpack-cxx-6.1.0/fuzz/CMakeLists.txt 2023-07-08 05:21:22.000000000 +0200 @@ -16,7 +16,7 @@ $<IF:$<BOOL:${MSGPACK_USE_STATIC_BOOST}>,,BOOST_TEST_DYN_LINK>) TARGET_LINK_LIBRARIES (${source_file_we} - msgpackc-cxx + msgpack-cxx Threads::Threads Boost::filesystem Boost::system diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/include/msgpack/adaptor/cpp17/variant.hpp new/msgpack-cxx-6.1.0/include/msgpack/adaptor/cpp17/variant.hpp --- old/msgpack-cxx-4.1.3/include/msgpack/adaptor/cpp17/variant.hpp 1970-01-01 01:00:00.000000000 +0100 +++ new/msgpack-cxx-6.1.0/include/msgpack/adaptor/cpp17/variant.hpp 2023-07-08 05:21:22.000000000 +0200 @@ -0,0 +1,16 @@ +// +// MessagePack for C++ static resolution routine +// +// Copyright (C) 2023 Uy Ha +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef MSGPACK_TYPE_CPP17_VARIANT_HPP +#define MSGPACK_TYPE_CPP17_VARIANT_HPP + +#include "msgpack/v1/adaptor/cpp17/variant.hpp" + +#endif // MSGPACK_TYPE_CPP17_VARIANT_HPP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/include/msgpack/preprocessor/config/config.hpp new/msgpack-cxx-6.1.0/include/msgpack/preprocessor/config/config.hpp --- old/msgpack-cxx-4.1.3/include/msgpack/preprocessor/config/config.hpp 2022-08-25 11:56:15.000000000 +0200 +++ new/msgpack-cxx-6.1.0/include/msgpack/preprocessor/config/config.hpp 2023-07-08 05:21:22.000000000 +0200 @@ -24,16 +24,22 @@ # define MSGPACK_PP_CONFIG_EDG() 0x0020 # define MSGPACK_PP_CONFIG_DMC() 0x0040 # +# if !defined(__clang__) && (!defined(_MSVC_TRADITIONAL) || _MSVC_TRADITIONAL) +# define MSGPACK_TRADITIONAL_MSVC 1 +# else +# define MSGPACK_TRADITIONAL_MSVC 0 +# endif +# # ifndef MSGPACK_PP_CONFIG_FLAGS # if defined(__GCCXML__) || defined(__WAVE__) || defined(__MWERKS__) && __MWERKS__ >= 0x3200 # define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_STRICT()) # elif defined(__EDG__) || defined(__EDG_VERSION__) -# if defined(_MSC_VER) && !defined(__clang__) && (defined(__INTELLISENSE__) || __EDG_VERSION__ >= 308) +# if defined(_MSC_VER) && MSGPACK_TRADITIONAL_MSVC && (defined(__INTELLISENSE__) || __EDG_VERSION__ >= 308) # define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_MSVC()) # else # define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_EDG() | MSGPACK_PP_CONFIG_STRICT()) # endif -# elif defined(_MSC_VER) && defined(__clang__) +# elif defined(_MSC_VER) && !MSGPACK_TRADITIONAL_MSVC # define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_STRICT()) # elif defined(__MWERKS__) # define MSGPACK_PP_CONFIG_FLAGS() (MSGPACK_PP_CONFIG_MWCC()) @@ -75,7 +81,7 @@ # define MSGPACK_PP_VARIADICS 0 # elif defined(__CUDACC__) # define MSGPACK_PP_VARIADICS 1 -# elif defined(_MSC_VER) && defined(__clang__) +# elif defined(_MSC_VER) && !MSGPACK_TRADITIONAL_MSVC # define MSGPACK_PP_VARIADICS 1 # /* VC++ (C/C++) and Intel C++ Compiler >= 17.0 with MSVC */ # elif defined _MSC_VER && _MSC_VER >= 1400 && (!defined __EDG__ || defined(__INTELLISENSE__) || defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1700) @@ -94,7 +100,7 @@ # elif !MSGPACK_PP_VARIADICS + 1 < 2 # undef MSGPACK_PP_VARIADICS # define MSGPACK_PP_VARIADICS 1 -# if defined _MSC_VER && _MSC_VER >= 1400 && !defined(__clang__) && (defined(__INTELLISENSE__) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1700) || !(defined __EDG__ || defined __GCCXML__ || defined __CUDACC__ || defined __PATHSCALE__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || defined __SUNPRO_CC || defined __HP_aCC || defined __MRC__ || defined __SC__ || defined __IBMCPP__ || defined __PGI)) +# if defined _MSC_VER && _MSC_VER >= 1400 && MSGPACK_TRADITIONAL_MSVC && (defined(__INTELLISENSE__) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1700) || !(defined __EDG__ || defined __GCCXML__ || defined __CUDACC__ || defined __PATHSCALE__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || defined __SUNPRO_CC || defined __HP_aCC || defined __MRC__ || defined __SC__ || defined __IBMCPP__ || defined __PGI)) # undef MSGPACK_PP_VARIADICS_MSVC # define MSGPACK_PP_VARIADICS_MSVC 1 # endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/include/msgpack/type.hpp new/msgpack-cxx-6.1.0/include/msgpack/type.hpp --- old/msgpack-cxx-4.1.3/include/msgpack/type.hpp 2022-08-25 11:56:15.000000000 +0200 +++ new/msgpack-cxx-6.1.0/include/msgpack/type.hpp 2023-07-08 05:21:22.000000000 +0200 @@ -37,9 +37,7 @@ #include "adaptor/cpp11/array_char.hpp" #include "adaptor/cpp11/array_unsigned_char.hpp" -#if !defined(MSGPACK_NO_BOOST) #include "adaptor/cpp11/chrono.hpp" -#endif // !defined(MSGPACK_NO_BOOST) #include "adaptor/cpp11/forward_list.hpp" #include "adaptor/cpp11/reference_wrapper.hpp" @@ -63,6 +61,10 @@ #include "adaptor/cpp17/carray_byte.hpp" #include "adaptor/cpp17/vector_byte.hpp" +#if MSGPACK_HAS_INCLUDE(<variant>) +#include "adaptor/cpp17/variant.hpp" +#endif // MSGPACK_HAS_INCLUDE(<variant>) + #if MSGPACK_HAS_INCLUDE(<span>) #include "adaptor/cpp20/span.hpp" #endif // MSGPACK_HAS_INCLUDE(<span>) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/include/msgpack/v1/adaptor/boost/msgpack_variant.hpp new/msgpack-cxx-6.1.0/include/msgpack/v1/adaptor/boost/msgpack_variant.hpp --- old/msgpack-cxx-4.1.3/include/msgpack/v1/adaptor/boost/msgpack_variant.hpp 2022-08-25 11:56:15.000000000 +0200 +++ new/msgpack-cxx-6.1.0/include/msgpack/v1/adaptor/boost/msgpack_variant.hpp 2023-07-08 05:21:22.000000000 +0200 @@ -122,6 +122,12 @@ int_init(v); } basic_variant(unsigned long long v):base(uint64_t(v)) {} + basic_variant(float v) { + double_init(v); + } + basic_variant(double v) { + double_init(v); + } bool is_nil() const { return boost::get<msgpack::type::nil_t>(this) != MSGPACK_NULLPTR; @@ -177,71 +183,50 @@ int64_t as_int64_t() const { return boost::get<int64_t>(*this); } - int64_t& as_int64_t() { - return boost::get<int64_t>(*this); - } uint64_t as_uint64_t() const { return boost::get<uint64_t>(*this); } - uint64_t& as_uint64_t() { - return boost::get<uint64_t>(*this); - } double as_double() const { - return boost::get<double>(*this); - } - double& as_double() { - return boost::get<double>(*this); + if (is_double()) { + return boost::get<double>(*this); + } + if (is_int64_t()) { + return static_cast<double>(boost::get<int64_t>(*this)); + } + if (is_uint64_t()) { + return static_cast<double>(boost::get<uint64_t>(*this)); + } + throw msgpack::type_error(); } std::string const& as_string() const { return boost::get<std::string>(*this); } - std::string& as_string() { - return boost::get<std::string>(*this); - } #if (BOOST_VERSION / 100000) >= 1 && ((BOOST_VERSION / 100) % 1000) >= 53 boost::string_ref const& as_boost_string_ref() const { return boost::get<boost::string_ref>(*this); } - boost::string_ref& as_boost_string_ref() { - return boost::get<boost::string_ref>(*this); - } #endif // (BOOST_VERSION / 100000) >= 1 && ((BOOST_VERSION / 100) % 1000) >= 53 std::vector<char> const& as_vector_char() const { return boost::get<std::vector<char> >(*this); } - std::vector<char>& as_vector_char() { - return boost::get<std::vector<char> >(*this); - } raw_ref const& as_raw_ref() const { return boost::get<raw_ref>(*this); } ext const& as_ext() const { return boost::get<ext>(*this); } - ext& as_ext() { - return boost::get<ext>(*this); - } ext_ref const& as_ext_ref() const { return boost::get<ext_ref>(*this); } std::vector<basic_variant<STR, BIN, EXT> > const& as_vector() const { return boost::get<std::vector<basic_variant<STR, BIN, EXT> > >(*this); } - std::vector<basic_variant<STR, BIN, EXT> >& as_vector() { - return boost::get<std::vector<basic_variant<STR, BIN, EXT> > >(*this); - } std::map<basic_variant<STR, BIN, EXT>, basic_variant<STR, BIN, EXT> > const& as_map() const { return boost::get<std::map<basic_variant<STR, BIN, EXT>, basic_variant<STR, BIN, EXT> > >(*this); } - std::map<basic_variant<STR, BIN, EXT>, basic_variant<STR, BIN, EXT> >& as_map() { - return boost::get<std::map<basic_variant<STR, BIN, EXT>, basic_variant<STR, BIN, EXT> > >(*this); - } std::multimap<basic_variant<STR, BIN, EXT>, basic_variant<STR, BIN, EXT> > const& as_multimap() const { return boost::get<std::multimap<basic_variant<STR, BIN, EXT>, basic_variant<STR, BIN, EXT> > >(*this); } - std::multimap<basic_variant<STR, BIN, EXT>, basic_variant<STR, BIN, EXT> >& as_multimap() { - return boost::get<std::multimap<basic_variant<STR, BIN, EXT>, basic_variant<STR, BIN, EXT> > >(*this); - } private: template <typename T> void int_init(T v) { @@ -252,6 +237,19 @@ static_cast<base&>(*this) = uint64_t(v); } } + void double_init(double v) { + if (v == v) { // check for nan + if (v >= 0 && v <= double(std::numeric_limits<uint64_t>::max()) && v == double(uint64_t(v))) { + static_cast<base&>(*this) = uint64_t(v); + return; + } + else if (v < 0 && v >= double(std::numeric_limits<int64_t>::min()) && v == double(int64_t(v))) { + static_cast<base&>(*this) = int64_t(v); + return; + } + } + static_cast<base&>(*this) = v; + } }; template <typename STR, typename BIN, typename EXT> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/include/msgpack/v1/adaptor/cpp11/chrono.hpp new/msgpack-cxx-6.1.0/include/msgpack/v1/adaptor/cpp11/chrono.hpp --- old/msgpack-cxx-4.1.3/include/msgpack/v1/adaptor/cpp11/chrono.hpp 2022-11-02 04:53:39.000000000 +0100 +++ new/msgpack-cxx-6.1.0/include/msgpack/v1/adaptor/cpp11/chrono.hpp 2023-07-08 05:21:22.000000000 +0200 @@ -11,17 +11,14 @@ #ifndef MSGPACK_V1_TYPE_CPP11_CHRONO_HPP #define MSGPACK_V1_TYPE_CPP11_CHRONO_HPP -#if !defined(MSGPACK_NO_BOOST) - #include "msgpack/versioning.hpp" #include "msgpack/adaptor/adaptor_base.hpp" #include "msgpack/object.hpp" #include "msgpack/adaptor/check_container_size.hpp" +#include <limits> #include <chrono> -#include <boost/numeric/conversion/cast.hpp> - namespace msgpack { /// @cond @@ -30,6 +27,113 @@ namespace adaptor { +namespace detail { +template < + typename Target, + typename Source, + bool target_is_signed = std::is_signed<Target>::value, + bool source_is_signed = std::is_signed<Source>::value, + typename = typename std::enable_if< + std::is_integral<Target>::value && + std::is_integral<Source>::value + >::type +> +struct would_underflow { + // The default case includes the cases that Source being unsigned, and since Source + // is unsigned, no underflow can happen + would_underflow(Source) : value{false} {} + bool value; +}; + +template <typename Target, typename Source> +struct would_underflow<Target, Source, false, true> { + // When Source is signed and Target is unsigned, we only need to compare with 0 to + // detect underflow, this works correctly and also avoids warnings from the compiler + would_underflow(Source source) : value{source < 0} {} + bool value; +}; +template <typename Target, typename Source> +struct would_underflow<Target, Source, true, true> { + // When Source and Target are signed, the promotion rules apply sensibly so we do + // not need to do anything + would_underflow(Source source) + : value{source < std::numeric_limits<Target>::min()} {} + bool value; +}; + +template < + typename Target, + typename Source, + bool target_is_signed = std::is_signed<Target>::value, + bool source_is_signed = std::is_signed<Source>::value, + typename = typename std::enable_if< + std::is_integral<Target>::value && + std::is_integral<Source>::value + >::type +> +struct would_overflow { + // The default case is Source and Target having the same signedness, the promotion + // rule also apply sensibly here so nothing special needs to be done + would_overflow(Source source) + : value{source > std::numeric_limits<Target>::max()} {} + bool value; +}; +template <typename Target, typename Source> +struct would_overflow <Target, Source, false, true> { + // When Target is unsigned and Source is signed, we cannot rely on the promotion + // rule. + would_overflow(Source source) + : value{ + sizeof(Target) >= sizeof(Source) + // Given Source is signed, Target being unsigned and having at least the + // same size makes impossible to overflow + ? false + // Source being larger than Target makes it safe to cast the maximum value + // of Target to Source + : source > static_cast<Source>(std::numeric_limits<Target>::max()) + } {} + bool value; +}; +template <typename Target, typename Source> +struct would_overflow <Target, Source, true, false> { + // When Target is signed and Source is unsigned, we cannot rely on the promotion + // rule. + would_overflow(Source source) + : value{ + sizeof(Target) > sizeof(Source) + // Target being larger than Source makes it impossible to overflow + ? false + // Source being unsigned and having at least the size of Target makes it + // safe to cast the maximum value of Target to Source + : source > static_cast<Source>(std::numeric_limits<Target>::max()) + } {} + bool value; +}; + +template < + typename Target, + typename Source, + typename = typename std::enable_if< + std::is_integral<Target>::value && + std::is_integral<Source>::value + >::type +> +Target integral_cast(Source source) { + if (would_underflow<Target, Source>(source).value) { + throw std::underflow_error{ + "casting from Source to Target causes an underflow error" + }; + } + if(would_overflow<Target, Source>(source).value) { + throw std::overflow_error{ + "casting from Source to Target causes an overflow error" + }; + } + + return static_cast<Target>(source); +} +} // namespace detail + template <typename Clock, typename Duration> struct as<std::chrono::time_point<Clock, Duration>> { typename std::chrono::time_point<Clock, Duration> operator()(msgpack::object const& o) const { @@ -45,7 +149,7 @@ case 8: { uint64_t value; _msgpack_load64(uint64_t, o.via.ext.data(), &value); - uint32_t nanosec = boost::numeric_cast<uint32_t>(value >> 34); + uint32_t nanosec = detail::integral_cast<uint32_t>(value >> 34); uint64_t sec = value & 0x00000003ffffffffLL; tp += std::chrono::duration_cast<Duration>( std::chrono::nanoseconds(nanosec)); @@ -69,7 +173,7 @@ else { ++sec; tp += std::chrono::seconds(sec); - int64_t ns = boost::numeric_cast<int64_t>(nanosec) - 1000000000L; + int64_t ns = detail::integral_cast<int64_t>(nanosec) - 1000000000L; tp += std::chrono::duration_cast<Duration>( std::chrono::nanoseconds(ns)); } @@ -98,7 +202,7 @@ case 8: { uint64_t value; _msgpack_load64(uint64_t, o.via.ext.data(), &value); - uint32_t nanosec = boost::numeric_cast<uint32_t>(value >> 34); + uint32_t nanosec = detail::integral_cast<uint32_t>(value >> 34); uint64_t sec = value & 0x00000003ffffffffLL; tp += std::chrono::duration_cast<Duration>( std::chrono::nanoseconds(nanosec)); @@ -123,7 +227,7 @@ else { ++sec; tp += std::chrono::seconds(sec); - int64_t ns = boost::numeric_cast<int64_t>(nanosec) - 1000000000L; + int64_t ns = detail::integral_cast<int64_t>(nanosec) - 1000000000L; tp += std::chrono::duration_cast<Duration>( std::chrono::nanoseconds(ns)); } @@ -142,7 +246,7 @@ struct pack<std::chrono::time_point<Clock, Duration>> { template <typename Stream> msgpack::packer<Stream>& operator()(msgpack::packer<Stream>& o, std::chrono::time_point<Clock, Duration> const& v) const { - int64_t count = boost::numeric_cast<int64_t>(v.time_since_epoch().count()); + int64_t count = detail::integral_cast<int64_t>(v.time_since_epoch().count()); int64_t nano_num = Duration::period::ratio::num * (1000000000L / Duration::period::ratio::den); @@ -158,11 +262,11 @@ / Duration::period::ratio::den; if ((sec >> 34) == 0) { - uint64_t data64 = (boost::numeric_cast<uint64_t>(nanosec) << 34) | boost::numeric_cast<uint64_t>(sec); + uint64_t data64 = (detail::integral_cast<uint64_t>(nanosec) << 34) | detail::integral_cast<uint64_t>(sec); if ((data64 & 0xffffffff00000000L) == 0) { // timestamp 32 o.pack_ext(4, -1); - uint32_t data32 = boost::numeric_cast<uint32_t>(data64); + uint32_t data32 = detail::integral_cast<uint32_t>(data64); char buf[4]; _msgpack_store32(buf, data32); o.pack_ext_body(buf, 4); @@ -181,7 +285,7 @@ char buf[12]; - _msgpack_store32(&buf[0], boost::numeric_cast<uint32_t>(nanosec)); + _msgpack_store32(&buf[0], detail::integral_cast<uint32_t>(nanosec)); _msgpack_store64(&buf[4], sec); o.pack_ext_body(buf, 12); } @@ -192,7 +296,7 @@ template <typename Clock, typename Duration> struct object_with_zone<std::chrono::time_point<Clock, Duration>> { void operator()(msgpack::object::with_zone& o, const std::chrono::time_point<Clock, Duration>& v) const { - int64_t count = boost::numeric_cast<int64_t>(v.time_since_epoch().count()); + int64_t count = detail::integral_cast<int64_t>(v.time_since_epoch().count()); int64_t nano_num = Duration::period::ratio::num * @@ -208,14 +312,14 @@ * Duration::period::ratio::num / Duration::period::ratio::den; if ((sec >> 34) == 0) { - uint64_t data64 = (boost::numeric_cast<uint64_t>(nanosec) << 34) | boost::numeric_cast<uint64_t>(sec); + uint64_t data64 = (detail::integral_cast<uint64_t>(nanosec) << 34) | detail::integral_cast<uint64_t>(sec); if ((data64 & 0xffffffff00000000L) == 0) { // timestamp 32 o.type = msgpack::type::EXT; o.via.ext.size = 4; char* p = static_cast<char*>(o.zone.allocate_no_align(o.via.ext.size + 1)); p[0] = static_cast<char>(-1); - uint32_t data32 = boost::numeric_cast<uint32_t>(data64); + uint32_t data32 = detail::integral_cast<uint32_t>(data64); _msgpack_store32(&p[1], data32); o.via.ext.ptr = p; } @@ -235,7 +339,7 @@ o.via.ext.size = 12; char* p = static_cast<char*>(o.zone.allocate_no_align(o.via.ext.size + 1)); p[0] = static_cast<char>(-1); - _msgpack_store32(&p[1], boost::numeric_cast<uint32_t>(nanosec)); + _msgpack_store32(&p[1], detail::integral_cast<uint32_t>(nanosec)); _msgpack_store64(&p[1 + 4], sec); o.via.ext.ptr = p; } @@ -250,6 +354,4 @@ } // namespace msgpack -#endif // !defined(MSGPACK_NO_BOOST) - #endif // MSGPACK_V1_TYPE_CPP11_CHRONO_HPP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/include/msgpack/v1/adaptor/cpp17/variant.hpp new/msgpack-cxx-6.1.0/include/msgpack/v1/adaptor/cpp17/variant.hpp --- old/msgpack-cxx-4.1.3/include/msgpack/v1/adaptor/cpp17/variant.hpp 1970-01-01 01:00:00.000000000 +0100 +++ new/msgpack-cxx-6.1.0/include/msgpack/v1/adaptor/cpp17/variant.hpp 2023-07-08 05:21:22.000000000 +0200 @@ -0,0 +1,151 @@ +// +// MessagePack for C++ static resolution routine +// +// Copyright (C) 2023 Uy Ha +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// + +#ifndef MSGPACK_V1_TYPE_VARIANT_HPP +#define MSGPACK_V1_TYPE_VARIANT_HPP + +#if defined(MSGPACK_USE_STD_VARIANT_ADAPTOR) + +#include "msgpack/cpp_version.hpp" + +#if MSGPACK_CPP_VERSION >= 201703 + +#include "msgpack/adaptor/adaptor_base.hpp" +#include "msgpack/object.hpp" +#include "msgpack/versioning.hpp" + +#include <variant> + +namespace msgpack { +MSGPACK_API_VERSION_NAMESPACE(v1) { +namespace adaptor { +namespace detail { +template < + typename Variant, + typename T, + typename... Ts, + std::size_t current_index, + std::size_t... indices +> +Variant construct_variant( + std::size_t index, + msgpack::object& object, + std::index_sequence<current_index, indices...> +) { + if constexpr(sizeof...(Ts) == 0) { + return object.as<T>(); + } + else { + if (index == current_index) { + return object.as<T>(); + } + return construct_variant<Variant, Ts...>( + index, + object, + std::index_sequence<indices...>() + ); + } +} + +struct object_variant_overload { + object_variant_overload(msgpack::object& obj, msgpack::zone& zone) + : obj{obj} + , zone{zone} {} + + template<typename T> + void operator()(T const& value) { + obj = msgpack::object(value, zone); + } + + msgpack::object& obj; + msgpack::zone& zone; +}; +} // namespace detail + +template <typename... Ts> +struct as<std::variant<Ts...>, typename std::enable_if<(msgpack::has_as<Ts>::value && ...)>::type> { + std::variant<Ts...> operator()(msgpack::object const& o) const { + if ( o.type != msgpack::type::ARRAY + || o.via.array.size != 2 + || o.via.array.ptr[0].type != msgpack::type::POSITIVE_INTEGER + || o.via.array.ptr[0].via.u64 >= sizeof...(Ts)) { + throw msgpack::type_error{}; + } + + return detail::construct_variant<std::variant<Ts...>, Ts...>( + o.via.array.ptr[0].as<std::size_t>(), + o.via.array.ptr[1], + std::make_index_sequence<sizeof...(Ts)>() + ); + } +}; + +template<typename... Ts> +struct convert<std::variant<Ts...>> { + msgpack::object const& operator()(msgpack::object const& o, std::variant<Ts...>& v) const { + if ( o.type != msgpack::type::ARRAY + || o.via.array.size != 2 + || o.via.array.ptr[0].type != msgpack::type::POSITIVE_INTEGER + || o.via.array.ptr[0].via.u64 >= sizeof...(Ts)) { + throw msgpack::type_error{}; + } + + v = detail::construct_variant<std::variant<Ts...>, Ts...>( + o.via.array.ptr[0].as<std::size_t>(), + o.via.array.ptr[1], + std::make_index_sequence<sizeof...(Ts)>() + ); + return o; + } +}; + +template <typename... Ts> +struct pack<std::variant<Ts...>>{ + template<typename Stream> + msgpack::packer<Stream>& operator()( + msgpack::packer<Stream>& o, + std::variant<Ts...> const& v + ) const { + o.pack_array(2); + o.pack_uint64(v.index()); + std::visit([&o](auto const& value){o.pack(value);}, v); + return o; + } +}; + + +template<typename... Ts> +struct object_with_zone<std::variant<Ts...>> { + void operator()( + msgpack::object::with_zone& o, + std::variant<Ts...> const& v + ) const { + msgpack::object *p = + static_cast<msgpack::object *>( + o.zone.allocate_align( + sizeof(msgpack::object) * 2, + MSGPACK_ZONE_ALIGNOF(msgpack::object) + ) + ); + + o.type = msgpack::type::ARRAY; + o.via.array.size = 2; + o.via.array.ptr = p; + o.via.array.ptr[0]= msgpack::object(v.index(), o.zone); + std::visit(detail::object_variant_overload(o.via.array.ptr[1], o.zone), v); + } +}; +} // namespace adaptor +} +} // namespace msgpack + +#endif // MSGPACK_CPP_VERSION >= 201703 +#endif // defined(MSGPACK_USE_STD_VARIANT_ADAPTOR) +#endif // MSGPACK_V1_TYPE_VARIANT_HPP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/include/msgpack/v1/pack.hpp new/msgpack-cxx-6.1.0/include/msgpack/v1/pack.hpp --- old/msgpack-cxx-4.1.3/include/msgpack/v1/pack.hpp 2022-08-25 11:56:15.000000000 +0200 +++ new/msgpack-cxx-6.1.0/include/msgpack/v1/pack.hpp 2023-07-08 05:21:22.000000000 +0200 @@ -1138,11 +1138,11 @@ template <typename Stream> inline packer<Stream>& packer<Stream>::pack_float(float d) { - if(d == d) { // check for nan + if(d == d) { // check for nan // compare d to limits to avoid undefined behaviour if(d >= 0 && d <= float(std::numeric_limits<uint64_t>::max()) && d == float(uint64_t(d))) { pack_imp_uint64(uint64_t(d)); - return *this; + return *this; } else if(d < 0 && d >= float(std::numeric_limits<int64_t>::min()) && d == float(int64_t(d))) { pack_imp_int64(int64_t(d)); return *this; @@ -1160,11 +1160,11 @@ template <typename Stream> inline packer<Stream>& packer<Stream>::pack_double(double d) { - if(d == d) { // check for nan + if(d == d) { // check for nan // compare d to limits to avoid undefined behaviour if(d >= 0 && d <= double(std::numeric_limits<uint64_t>::max()) && d == double(uint64_t(d))) { pack_imp_uint64(uint64_t(d)); - return *this; + return *this; } else if(d < 0 && d >= double(std::numeric_limits<int64_t>::min()) && d == double(int64_t(d))) { pack_imp_int64(int64_t(d)); return *this; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/include/msgpack/version_master.hpp new/msgpack-cxx-6.1.0/include/msgpack/version_master.hpp --- old/msgpack-cxx-4.1.3/include/msgpack/version_master.hpp 2022-11-02 05:47:31.000000000 +0100 +++ new/msgpack-cxx-6.1.0/include/msgpack/version_master.hpp 2023-07-08 06:16:09.000000000 +0200 @@ -1,3 +1,3 @@ -#define MSGPACK_VERSION_MAJOR 4 +#define MSGPACK_VERSION_MAJOR 6 #define MSGPACK_VERSION_MINOR 1 -#define MSGPACK_VERSION_REVISION 3 +#define MSGPACK_VERSION_REVISION 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/msgpack-config.cmake.in new/msgpack-cxx-6.1.0/msgpack-config.cmake.in --- old/msgpack-cxx-4.1.3/msgpack-config.cmake.in 2022-09-07 05:49:03.000000000 +0200 +++ new/msgpack-cxx-6.1.0/msgpack-config.cmake.in 1970-01-01 01:00:00.000000000 +0100 @@ -1,11 +0,0 @@ -@PACKAGE_INIT@ - -include(CMakeFindDependencyMacro) - -IF (@MSGPACK_USE_BOOST@) - find_dependency(Boost REQUIRED) -ENDIF () - -include("${CMAKE_CURRENT_LIST_DIR}/msgpackc-cxx-targets.cmake") - -check_required_components(msgpackc-cxx) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/msgpack-cxx-config.cmake.in new/msgpack-cxx-6.1.0/msgpack-cxx-config.cmake.in --- old/msgpack-cxx-4.1.3/msgpack-cxx-config.cmake.in 1970-01-01 01:00:00.000000000 +0100 +++ new/msgpack-cxx-6.1.0/msgpack-cxx-config.cmake.in 2023-07-08 05:21:22.000000000 +0200 @@ -0,0 +1,11 @@ +@PACKAGE_INIT@ + +include(CMakeFindDependencyMacro) + +IF (@MSGPACK_USE_BOOST@) + find_dependency(Boost REQUIRED) +ENDIF () + +include("${CMAKE_CURRENT_LIST_DIR}/msgpack-cxx-targets.cmake") + +check_required_components(msgpack-cxx) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/test/CMakeLists.txt new/msgpack-cxx-6.1.0/test/CMakeLists.txt --- old/msgpack-cxx-4.1.3/test/CMakeLists.txt 2022-08-25 11:56:15.000000000 +0200 +++ new/msgpack-cxx-6.1.0/test/CMakeLists.txt 2023-07-08 05:21:22.000000000 +0200 @@ -78,7 +78,7 @@ $<IF:$<BOOL:${MSGPACK_USE_STATIC_BOOST}>,,BOOST_TEST_DYN_LINK>) TARGET_LINK_LIBRARIES (${source_file_we} - msgpackc-cxx + msgpack-cxx Boost::system Boost::unit_test_framework Threads::Threads @@ -109,7 +109,7 @@ ) TARGET_LINK_LIBRARIES (multi_file - msgpackc-cxx + msgpack-cxx ) ADD_TEST (multi_file multi_file) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/test/boost_variant.cpp new/msgpack-cxx-6.1.0/test/boost_variant.cpp --- old/msgpack-cxx-4.1.3/test/boost_variant.cpp 2022-08-25 11:56:15.000000000 +0200 +++ new/msgpack-cxx-6.1.0/test/boost_variant.cpp 2023-07-08 05:21:22.000000000 +0200 @@ -264,7 +264,7 @@ BOOST_CHECK(val2.is_double()); BOOST_CHECK(fabs(12.34 - val2.as_double()) <= kEPS); BOOST_CHECK_NO_THROW(boost::get<double>(val2)); - BOOST_CHECK(fabs(val2.as_double() - val2.as_double()) <= kEPS); + BOOST_CHECK(fabs(val1.as_double() - val2.as_double()) <= kEPS); } BOOST_AUTO_TEST_CASE(object_variant_float) @@ -277,7 +277,8 @@ BOOST_CHECK(val2.is_double()); BOOST_CHECK(fabs(12.34 - val2.as_double()) <= kEPS); BOOST_CHECK_NO_THROW(boost::get<double>(val2)); - BOOST_CHECK(fabs(val2.as_double() - val2.as_double()) <= kEPS); + BOOST_CHECK(fabs(val1.as_double() - val2.as_double()) <= kEPS); + BOOST_CHECK(val1 == val2); } BOOST_AUTO_TEST_CASE(object_with_zone_variant_float) @@ -291,7 +292,116 @@ BOOST_CHECK(val2.is_double()); BOOST_CHECK(fabs(12.34 - val2.as_double()) <= kEPS); BOOST_CHECK_NO_THROW(boost::get<double>(val2)); - BOOST_CHECK(fabs(val2.as_double() - val2.as_double()) <= kEPS); + BOOST_CHECK(fabs(val1.as_double() - val2.as_double()) <= kEPS); + BOOST_CHECK(val1 == val2); +} + +BOOST_AUTO_TEST_CASE(pack_convert_variant_float_zero_atdp_positive) +{ + std::stringstream ss; + msgpack::type::variant val1 = 12.0; + BOOST_CHECK(val1.is_uint64_t()); + BOOST_CHECK_EQUAL(val1.as_uint64_t(), 12); + BOOST_CHECK(fabs(12.0 - val1.as_double()) <= kEPS); + + msgpack::pack(ss, val1); + + std::string const& str = ss.str(); + msgpack::object_handle oh = + msgpack::unpack(str.data(), str.size()); + msgpack::type::variant val2 = oh.get().as<msgpack::type::variant>(); + BOOST_CHECK(val2.is_uint64_t()); + BOOST_CHECK_EQUAL(val2.as_uint64_t(), 12); + BOOST_CHECK_NO_THROW(boost::get<uint64_t>(val2)); + BOOST_CHECK(fabs(12.0 - val2.as_double()) <= kEPS); + BOOST_CHECK_EQUAL(val1.as_uint64_t(), val2.as_uint64_t()); +} + +BOOST_AUTO_TEST_CASE(object_variant_float_zero_atdp_positive) +{ + msgpack::type::variant val1 = 12.0; + BOOST_CHECK(val1.is_uint64_t()); + BOOST_CHECK_EQUAL(val1.as_uint64_t(), 12); + BOOST_CHECK(fabs(12.0 - val1.as_double()) <= kEPS); + msgpack::object obj(val1); + msgpack::type::variant val2 = obj.as<msgpack::type::variant>(); + BOOST_CHECK(val2.is_uint64_t()); + BOOST_CHECK_EQUAL(val2.as_uint64_t(), 12); + BOOST_CHECK_NO_THROW(boost::get<uint64_t>(val2)); + BOOST_CHECK(fabs(12.0 - val2.as_double()) <= kEPS); + BOOST_CHECK_EQUAL(val1.as_uint64_t(), val2.as_uint64_t()); + BOOST_CHECK(val1 == val2); +} + +BOOST_AUTO_TEST_CASE(object_with_zone_variant_float_zero_atdp_positive) +{ + msgpack::zone z; + msgpack::type::variant val1 = 12.0; + BOOST_CHECK(val1.is_uint64_t()); + BOOST_CHECK_EQUAL(val1.as_uint64_t(), 12); + BOOST_CHECK(fabs(12.0 - val1.as_double()) <= kEPS); + msgpack::object obj(val1, z); + msgpack::type::variant val2 = obj.as<msgpack::type::variant>(); + BOOST_CHECK(val2.is_uint64_t()); + BOOST_CHECK_EQUAL(val2.as_uint64_t(), 12); + BOOST_CHECK_NO_THROW(boost::get<uint64_t>(val2)); + BOOST_CHECK_EQUAL(val1.as_uint64_t(), val2.as_uint64_t()); + BOOST_CHECK(fabs(12.0 - val2.as_double()) <= kEPS); + BOOST_CHECK(val1 == val2); +} + +BOOST_AUTO_TEST_CASE(pack_convert_variant_float_zero_atdp_negative) +{ + std::stringstream ss; + msgpack::type::variant val1 = -12.0; + BOOST_CHECK(val1.is_int64_t()); + BOOST_CHECK_EQUAL(val1.as_int64_t(), -12); + BOOST_CHECK(fabs(-12.0 - val1.as_double()) <= kEPS); + + msgpack::pack(ss, val1); + + std::string const& str = ss.str(); + msgpack::object_handle oh = + msgpack::unpack(str.data(), str.size()); + msgpack::type::variant val2 = oh.get().as<msgpack::type::variant>(); + BOOST_CHECK(val2.is_int64_t()); + BOOST_CHECK_EQUAL(val2.as_int64_t(), -12); + BOOST_CHECK_NO_THROW(boost::get<int64_t>(val2)); + BOOST_CHECK(fabs(-12.0 - val2.as_double()) <= kEPS); + BOOST_CHECK_EQUAL(val1.as_int64_t(), val2.as_int64_t()); +} + +BOOST_AUTO_TEST_CASE(object_variant_float_zero_atdp_negative) +{ + msgpack::type::variant val1 = -12.0; + BOOST_CHECK(val1.is_int64_t()); + BOOST_CHECK_EQUAL(val1.as_int64_t(), -12); + BOOST_CHECK(fabs(-12.0 - val1.as_double()) <= kEPS); + msgpack::object obj(val1); + msgpack::type::variant val2 = obj.as<msgpack::type::variant>(); + BOOST_CHECK(val2.is_int64_t()); + BOOST_CHECK_EQUAL(val2.as_int64_t(), -12); + BOOST_CHECK_NO_THROW(boost::get<int64_t>(val2)); + BOOST_CHECK(fabs(-12.0 - val2.as_double()) <= kEPS); + BOOST_CHECK_EQUAL(val1.as_int64_t(), val2.as_int64_t()); + BOOST_CHECK(val1 == val2); +} + +BOOST_AUTO_TEST_CASE(object_with_zone_variant_float_zero_atdp_negative) +{ + msgpack::zone z; + msgpack::type::variant val1 = -12.0; + BOOST_CHECK(val1.is_int64_t()); + BOOST_CHECK_EQUAL(val1.as_int64_t(), -12); + BOOST_CHECK(fabs(-12.0 - val1.as_double()) <= kEPS); + msgpack::object obj(val1, z); + msgpack::type::variant val2 = obj.as<msgpack::type::variant>(); + BOOST_CHECK(val2.is_int64_t()); + BOOST_CHECK_EQUAL(val2.as_int64_t(), -12); + BOOST_CHECK_NO_THROW(boost::get<int64_t>(val2)); + BOOST_CHECK(fabs(-12.0 - val2.as_double()) <= kEPS); + BOOST_CHECK_EQUAL(val1.as_int64_t(), val2.as_int64_t()); + BOOST_CHECK(val1 == val2); } // str diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/test/msgpack_cpp11.cpp new/msgpack-cxx-6.1.0/test/msgpack_cpp11.cpp --- old/msgpack-cxx-4.1.3/test/msgpack_cpp11.cpp 2022-08-25 11:56:15.000000000 +0200 +++ new/msgpack-cxx-6.1.0/test/msgpack_cpp11.cpp 2023-07-08 05:21:22.000000000 +0200 @@ -252,6 +252,9 @@ template <class Key> struct set_allocator : std::allocator<Key> { using std::allocator<Key>::allocator; + + template<class U> + struct rebind { using other = set_allocator<U>; }; }; // C++ named requirement Allocator implies that the first template type @@ -262,6 +265,9 @@ template <typename KeyValuePair> struct map_allocator_impl : std::allocator<KeyValuePair> { using std::allocator<KeyValuePair>::allocator; + + template<class U> + struct rebind { using other = map_allocator_impl<U>; }; }; template <class Key, class T> @@ -270,6 +276,9 @@ template <class T> struct allocator : std::allocator<T> { using std::allocator<T>::allocator; + + template<class U> + struct rebind { using other = allocator<U>; }; }; } // namespace test @@ -861,8 +870,6 @@ BOOST_CHECK(val1 == val2); } -#if !defined(MSGPACK_NO_BOOST) - BOOST_AUTO_TEST_CASE(system_clock) { std::chrono::system_clock::time_point val1; @@ -1428,8 +1435,6 @@ BOOST_CHECK(val1 == val3); } -#endif // !defined(MSGPACK_NO_BOOST) - BOOST_AUTO_TEST_CASE(timespec_pack_convert_zero) { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/msgpack-cxx-4.1.3/test/msgpack_cpp17.cpp new/msgpack-cxx-6.1.0/test/msgpack_cpp17.cpp --- old/msgpack-cxx-4.1.3/test/msgpack_cpp17.cpp 2022-08-25 11:56:15.000000000 +0200 +++ new/msgpack-cxx-6.1.0/test/msgpack_cpp17.cpp 2023-07-08 05:21:22.000000000 +0200 @@ -461,4 +461,30 @@ } } +#if defined(MSGPACK_USE_STD_VARIANT_ADAPTOR) + +BOOST_AUTO_TEST_CASE(variant_pack_unpack_as) { + std::stringstream ss; + std::variant<bool, int, float, double> val1{1.0}; + msgpack::pack(ss, val1); + std::string const& str = ss.str(); + msgpack::object_handle oh = + msgpack::unpack(str.data(), str.size()); + std::variant<bool, int, float, double> val2 = + oh.get().as<std::variant<bool, int, float, double> >(); + BOOST_CHECK(val1 == val2); + BOOST_CHECK_THROW((oh.get().as<std::variant<bool>>()), msgpack::type_error); +} + +BOOST_AUTO_TEST_CASE(variant_with_zone) { + msgpack::zone z; + std::variant<bool, int, float, double> val1{1.0}; + msgpack::object obj(val1, z); + std::variant<bool, int, float, double> val2 = obj.as<std::variant<bool, int, float, double>>(); + BOOST_CHECK(val1 == val2); + BOOST_CHECK_THROW((obj.as<std::variant<bool>>()), msgpack::type_error); +} + +#endif // defined(MSGPACK_USE_STD_VARIANT_ADAPTOR) + #endif // MSGPACK_CPP_VERSION >= 201703
participants (1)
-
Source-Sync