From 2805bc3faa8f8fb7ce80ec518158563c5fcf26f6 Mon Sep 17 00:00:00 2001 From: Robert Ramey Date: Mon, 8 Jan 2024 22:20:18 -0800 Subject: [PATCH] removed test dependency on lexical cast --- build/Jamfile.v2 | 1 + include/boost/archive/iterators/escape.hpp | 2 +- .../extended_type_info_no_rtti.hpp | 1 - .../extended_type_info_typeid.hpp | 1 - include/boost/serialization/std_variant.hpp | 2 +- include/boost/serialization/variant2.hpp | 4 +- test/test_p_helper.cpp | 5 +- test/test_variant.cpp | 74 ++++++++++++------- 8 files changed, 53 insertions(+), 37 deletions(-) diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index 33964a3080..2ad5754d3b 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -107,6 +107,7 @@ WSOURCES = xml_woarchive polymorphic_xml_wiarchive polymorphic_xml_woarchive + codecvt_null ; lib boost_serialization diff --git a/include/boost/archive/iterators/escape.hpp b/include/boost/archive/iterators/escape.hpp index b40914410a..832720c69e 100644 --- a/include/boost/archive/iterators/escape.hpp +++ b/include/boost/archive/iterators/escape.hpp @@ -82,7 +82,7 @@ class escape : } void increment(){ - if(m_bnext != NULL && ++m_bnext < m_bend){ + if(m_bnext != m_bend && ++m_bnext < m_bend){ m_current_value = *m_bnext; return; } diff --git a/include/boost/serialization/extended_type_info_no_rtti.hpp b/include/boost/serialization/extended_type_info_no_rtti.hpp index 68df0eef52..9e56974a1a 100644 --- a/include/boost/serialization/extended_type_info_no_rtti.hpp +++ b/include/boost/serialization/extended_type_info_no_rtti.hpp @@ -130,7 +130,6 @@ class extended_type_info_no_rtti : void * construct(unsigned int count, ...) const BOOST_OVERRIDE { // count up the arguments std::va_list ap; - va_start(ap, count); switch(count){ case 0: return factory::type, 0>(ap); diff --git a/include/boost/serialization/extended_type_info_typeid.hpp b/include/boost/serialization/extended_type_info_typeid.hpp index 656950a693..65285644c3 100644 --- a/include/boost/serialization/extended_type_info_typeid.hpp +++ b/include/boost/serialization/extended_type_info_typeid.hpp @@ -113,7 +113,6 @@ class extended_type_info_typeid : void * construct(unsigned int count, ...) const BOOST_OVERRIDE { // count up the arguments std::va_list ap; - va_start(ap, count); switch(count){ case 0: return factory::type, 0>(ap); diff --git a/include/boost/serialization/std_variant.hpp b/include/boost/serialization/std_variant.hpp index cd927072e6..c02309b48e 100644 --- a/include/boost/serialization/std_variant.hpp +++ b/include/boost/serialization/std_variant.hpp @@ -176,7 +176,7 @@ inline void serialize( // Specialization for std::monostate template -void serialize(Archive &ar, std::monostate &, const unsigned int /*version*/) +void serialize(Archive &, std::monostate &, const unsigned int /*version*/) {} } // namespace serialization diff --git a/include/boost/serialization/variant2.hpp b/include/boost/serialization/variant2.hpp index da899ffc8c..32deffd6af 100644 --- a/include/boost/serialization/variant2.hpp +++ b/include/boost/serialization/variant2.hpp @@ -7,7 +7,7 @@ #endif /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 -// variant.hpp - non-intrusive serialization of variant types +// variant2.hpp - non-intrusive serialization of variant types // // copyright (c) 2019 Samuel Debionne, ESRF // @@ -22,8 +22,6 @@ #include -#include - #include #include diff --git a/test/test_p_helper.cpp b/test/test_p_helper.cpp index a4404e89a5..e6a385e9e0 100644 --- a/test/test_p_helper.cpp +++ b/test/test_p_helper.cpp @@ -33,7 +33,6 @@ namespace std{ #include #include "test_tools.hpp" -#include #include #include #include @@ -121,7 +120,9 @@ int test_main(int /* argc */, char * /* argv */ []) std::vector v1; for(int i=0; i<1000; ++i){ - v1.push_back(my_string(boost::lexical_cast(i % 100))); + char sbuffer[10]; + std::snprintf(sbuffer, sizeof(sbuffer), "%i", i % 100); + v1.push_back(my_string(sbuffer)); } // test using using polymorphic implementation. diff --git a/test/test_variant.cpp b/test/test_variant.cpp index 17234545bd..3de1afd336 100644 --- a/test/test_variant.cpp +++ b/test/test_variant.cpp @@ -160,40 +160,58 @@ void test(Variant & v) #include -int test_main( int /* argc */, char* /* argv */[] ){ +#include - // boost::variant - compatible with C++03 - { - boost::variant v; - test(v); - const A a; - boost::variant v1 = & a; - test_type(v1); - } +#include + +int test_boost_variant(){ + std::cerr << "Testing boost_variant\n"; + boost::variant v; + test(v); + const A a; + boost::variant v1 = & a; + test_type(v1); + return EXIT_SUCCESS; +} + +// boost::variant2/variant requires C++ 11 +#if BOOST_CXX_VERSION >= 201103L +#include + +int test_boost_variant2(){ + std::cerr << "Testing boost_variant2\n"; + boost::variant2::variant v; + test(v); + const A a; + boost::variant2::variant v1 = & a; + test_type(v1); + return EXIT_SUCCESS; +} +#endif + +// std::variant reqires C++ 17 or more +#ifndef BOOST_NO_CXX17_HDR_VARIANT +#include +int test_std_variant(){ + std::cerr << "Testing Std Variant\n"; + std::variant v; + test(v); + const A a; + std::variant v1 = & a; + test_type(v1); + return EXIT_SUCCESS; +} +#endif - // boost::variant2/variant requires C++ 11 +int test_main( int /* argc */, char* /* argv */[] ){ + return test_boost_variant() #if BOOST_CXX_VERSION >= 201103L - { - boost::variant2::variant v; - test(v); - const A a; - boost::variant2::variant v1 = & a; - test_type(v1); - } + || test_boost_variant2() #endif - - // std::variant reqires C++ 17 or more #ifndef BOOST_NO_CXX17_HDR_VARIANT - { - std::variant v; - test(v); - const A a; - std::variant v1 = & a; - test_type(v1); - } + || test_std_variant() #endif - - return EXIT_SUCCESS; + ; } // EOF