Skip to content

Commit

Permalink
removed test dependency on lexical cast
Browse files Browse the repository at this point in the history
  • Loading branch information
robertramey committed Jan 9, 2024
1 parent a20c4d9 commit 2805bc3
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 37 deletions.
1 change: 1 addition & 0 deletions build/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ WSOURCES =
xml_woarchive
polymorphic_xml_wiarchive
polymorphic_xml_woarchive
codecvt_null
;

lib boost_serialization
Expand Down
2 changes: 1 addition & 1 deletion include/boost/archive/iterators/escape.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 0 additions & 1 deletion include/boost/serialization/extended_type_info_no_rtti.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

This comment has been minimized.

Copy link
@pdimov

pdimov Mar 14, 2024

Member

Why has this been removed?

switch(count){
case 0:
return factory<typename boost::remove_const< T >::type, 0>(ap);
Expand Down
1 change: 0 additions & 1 deletion include/boost/serialization/extended_type_info_typeid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

This comment has been minimized.

Copy link
@pdimov

pdimov Mar 14, 2024

Member

Here as well... why this removal? It causes warnings that ap is used uninitialized - which it is.

switch(count){
case 0:
return factory<typename boost::remove_const< T >::type, 0>(ap);
Expand Down
2 changes: 1 addition & 1 deletion include/boost/serialization/std_variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ inline void serialize(

// Specialization for std::monostate
template<class Archive>
void serialize(Archive &ar, std::monostate &, const unsigned int /*version*/)
void serialize(Archive &, std::monostate &, const unsigned int /*version*/)
{}

} // namespace serialization
Expand Down
4 changes: 1 addition & 3 deletions include/boost/serialization/variant2.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
//
Expand All @@ -22,8 +22,6 @@

#include <boost/serialization/throw_exception.hpp>

#include <variant>

#include <boost/archive/archive_exception.hpp>

#include <boost/mp11/list.hpp>
Expand Down
5 changes: 3 additions & 2 deletions test/test_p_helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ namespace std{
#include <vector>

#include "test_tools.hpp"
#include <boost/lexical_cast.hpp>
#include <boost/serialization/split_free.hpp>
#include <boost/serialization/vector.hpp>
#include <boost/serialization/nvp.hpp>
Expand Down Expand Up @@ -121,7 +120,9 @@ int test_main(int /* argc */, char * /* argv */ [])

std::vector<my_string> v1;
for(int i=0; i<1000; ++i){
v1.push_back(my_string(boost::lexical_cast<std::string>(i % 100)));
char sbuffer[10];
std::snprintf(sbuffer, sizeof(sbuffer), "%i", i % 100);
v1.push_back(my_string(sbuffer));
}

// test using using polymorphic implementation.
Expand Down
74 changes: 46 additions & 28 deletions test/test_variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,40 +160,58 @@ void test(Variant & v)

#include <boost/serialization/variant.hpp>

int test_main( int /* argc */, char* /* argv */[] ){
#include <boost/variant/variant.hpp>

// boost::variant - compatible with C++03
{
boost::variant<bool, int, float, double, A, std::string> v;
test(v);
const A a;
boost::variant<bool, int, float, double, const A *, std::string> v1 = & a;
test_type(v1);
}
#include <cstdio>

int test_boost_variant(){
std::cerr << "Testing boost_variant\n";
boost::variant<bool, int, float, double, A, std::string> v;
test(v);
const A a;
boost::variant<bool, int, float, double, const A *, std::string> v1 = & a;
test_type(v1);
return EXIT_SUCCESS;
}

// boost::variant2/variant requires C++ 11
#if BOOST_CXX_VERSION >= 201103L
#include <boost/variant2/variant.hpp>

int test_boost_variant2(){
std::cerr << "Testing boost_variant2\n";
boost::variant2::variant<bool, int, float, double, A, std::string> v;
test(v);
const A a;
boost::variant2::variant<bool, int, float, double, const A *, std::string> v1 = & a;
test_type(v1);
return EXIT_SUCCESS;
}
#endif

// std::variant reqires C++ 17 or more
#ifndef BOOST_NO_CXX17_HDR_VARIANT
#include <variant>
int test_std_variant(){
std::cerr << "Testing Std Variant\n";
std::variant<bool, int, float, double, A, std::string> v;
test(v);
const A a;
std::variant<bool, int, float, double, const A *, std::string> 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<bool, int, float, double, A, std::string> v;
test(v);
const A a;
boost::variant2::variant<bool, int, float, double, const A *, std::string> v1 = & a;
test_type(v1);
}
|| test_boost_variant2()
#endif

// std::variant reqires C++ 17 or more
#ifndef BOOST_NO_CXX17_HDR_VARIANT
{
std::variant<bool, int, float, double, A, std::string> v;
test(v);
const A a;
std::variant<bool, int, float, double, const A *, std::string> v1 = & a;
test_type(v1);
}
|| test_std_variant()
#endif

return EXIT_SUCCESS;
;
}

// EOF

0 comments on commit 2805bc3

Please sign in to comment.