Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop: (108 commits)
  removed unordered tests
  tests have been taken over by developers of boost unordered
  uploading changes regarding unordered ... uploading tweaks to CMakeLists.txt so accommodate static linking
  imported/implemented boost/serialization/variant  and test_variant
  Remove serialization support from Boost.Unordered containers
  Fix invalid vptr access in extended_type_info_no_rtti constructor
  Fix invalid downcast in ~xml_oarchive_impl
  altered boost optional to depend only public interface functions declared in std::optional. adjusted test_optional to test serialization of both boost::optional and std::optional
  Revert "Add serialization for std::optional"
  fix new requirement - if assigment is not defaulted, copy can't be either
  Fix clang-cl regression introduced by #282
  correction in previous merge
  Remove debug output from util/test.jam
  Fix Sub::operator== signature to avoid ambiguity errors in C++20
  Remove C++03 from GHA, because Variant and LexicalCast no longer compile under C++03
  incremement archive version number fix PR 274 fix PR 283
  committing most pending PRs
  Replace static_cast with reinterpet_cast in interface_oarchive
  Update xml_escape::fill() to default assign bstart, bend to an empty string
  Use the first instance of bos during serialization (for the case when there are multiple instances)
  ...
  • Loading branch information
robertramey committed Nov 1, 2023
2 parents 90e3ce2 + e4756b7 commit e01b988
Show file tree
Hide file tree
Showing 160 changed files with 1,818 additions and 1,730 deletions.
471 changes: 428 additions & 43 deletions .github/workflows/posix.yml

Large diffs are not rendered by default.

33 changes: 26 additions & 7 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
- develop
- feature/**

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
LIBRARY: serialization

Expand All @@ -17,30 +21,45 @@ jobs:
fail-fast: false
matrix:
include:
- toolset: msvc-14.1
cxxstd: "14,17,latest"
- toolset: msvc-14.0
cxxstd: "11,14"
addrmd: 32,64
os: windows-2016
os: windows-2019
- toolset: msvc-14.2
cxxstd: "14,17,latest"
addrmd: 32,64
os: windows-2019
- toolset: msvc-14.3
cxxstd: "17,20,latest"
addrmd: 32,64
os: windows-2022
- toolset: clang-win
cxxstd: "14,17,latest"
addrmd: 32,64
os: windows-2022
- toolset: gcc
cxxstd: "03,11,14,17,2a"
cxxstd: "11,14,17,2a"
addrmd: 64
os: windows-2019

runs-on: ${{matrix.os}}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup Boost
shell: cmd
run: |
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
echo LIBRARY: %LIBRARY%
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
echo GITHUB_REF: %GITHUB_REF%
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
set BOOST_BRANCH=develop
if "%GITHUB_BASE_REF%" == "master" set BOOST_BRANCH=master
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
echo BOOST_BRANCH: %BOOST_BRANCH%
cd ..
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
cd boost-root
Expand All @@ -54,4 +73,4 @@ jobs:
shell: cmd
run: |
cd ../boost-root
b2 -j3 libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release
b2 -j3 libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=release
Empty file added .gitignore
Empty file.
36 changes: 14 additions & 22 deletions CMake/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CMake build control file for Serialization Library tests

cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.5)

if (POLICY CMP0054)
cmake_policy (SET CMP0054 NEW)
Expand All @@ -16,27 +16,28 @@ project("serialization")
# Compiler settings
#

message(STATUS "compiler is ${CMAKE_CXX_COMPILER_ID}" )
message(STATUS "C++ compiler is ${CMAKE_CXX_COMPILER_ID}" )
add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS})
message(STATUS "C compiler is ${CMAKE_C_COMPILER_ID}" )

if( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" )
add_definitions( -std=c++11 )
add_definitions( -ftemplate-depth=255 )
# we use gcc to test for C++03 compatibility
add_definitions( -std=c++03 )
message(STATUS "compiler is g++ c++03")
set(COMPILER_SUPPORTS_CXX11 FALSE)
elseif( CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" )
add_definitions( /wd4996 )
message(STATUS "compiler is MSVC")
set(COMPILER_SUPPORTS_CXX11 TRUE)
elseif( CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" )
add_definitions( -std=c++17 )
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth=300")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++03")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0" )
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-g -O3" )
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++ -dead_strip")
set(COMPILER_SUPPORTS_CXX11 FALSE)
set(COMPILER_SUPPORTS_CXX11 TRUE)
endif()

#
Expand All @@ -45,15 +46,12 @@ endif()

# Boost

# note: we're assuming that boost has been built with:
# ./b2 toolset=clang-darwin link=static,shared variant=debug,release stage

#
# Project settings
#
option(BUILD_SHARED_LIBS "Build Shared Libraries" true)

find_package(Boost 1.74 REQUIRED COMPONENTS system filesystem)
find_package(Boost 1.82 REQUIRED COMPONENTS system filesystem)

if(NOT Boost_FOUND)
message("Boost NOT Found!")
Expand Down Expand Up @@ -280,14 +278,10 @@ archive_test(test_list A)
archive_test(test_list_ptrs A)

archive_test(test_map A)
archive_test(test_map_boost_unordered A)
CHECK_INCLUDE_FILE_CXX(hash_map HASH_MAP_FOUND)
if(HASH_MAP_FOUND)
archive_test(test_map_hashed A)
endif()
if(COMPILER_SUPPORTS_CXX11)
archive_test(test_map_unordered A)
endif()
archive_test(test_mi)
archive_test(test_multiple_ptrs A)
archive_test(test_multiple_inheritance)
Expand All @@ -308,14 +302,10 @@ archive_test(test_recursion A)
archive_test(test_registered)

archive_test(test_set A)
archive_test(test_set_boost_unordered A)
CHECK_INCLUDE_FILE_CXX(hash_set HASH_SET_FOUND)
if(HASH_SET_FOUND)
archive_test(test_set_hashed A)
endif()
if(COMPILER_SUPPORTS_CXX11)
archive_test(test_set_unordered A)
endif()

archive_test(test_shared_ptr)
archive_test(test_shared_ptr_multi_base)
Expand All @@ -337,10 +327,12 @@ archive_test(test_valarray)
archive_test(test_variant A)
archive_test(test_vector A)

polymorphic_archive_test(test_dll_exported polymorphic_derived1)
foreach(test_name IN ITEMS ${test_list} )
if(BUILD_SHARED_LIBS)
polymorphic_archive_test(test_dll_exported polymorphic_derived1)
foreach(test_name IN ITEMS ${test_list} )
target_link_libraries(${test_name} dll_polymorphic_derived2 dll_polymorphic_base serialization wserialization)
endforeach()
endforeach()
endif()

polymorphic_archive_test(test_no_rtti polymorphic_base polymorphic_derived1 polymorphic_derived2)
polymorphic_archive_test(test_exported polymorphic_base polymorphic_derived1 polymorphic_derived2)
Expand Down
46 changes: 5 additions & 41 deletions build/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ project boost/serialization
<conditional>@include-spirit
;

import ../../config/checks/config : requires ;

SPIRIT_ROOT = [ modules.peek : SPIRIT_ROOT ] ;
rule include-spirit ( properties * )
{
Expand Down Expand Up @@ -88,7 +90,7 @@ SOURCES =
codecvt_null
;

SOURCES_HAS_STD_LOCALE =
SOURCES_HAS_STD_WSTREAMBUF =
xml_oarchive
utf8_codecvt_facet
;
Expand All @@ -107,49 +109,11 @@ WSOURCES =
polymorphic_xml_woarchive
;

rule has-config-flag ( flag : properties * )
{
if ( "<define>$(flag)" in $(properties) || "<define>$(flag)=1" in $(properties) )
{
return 1 ;
}
else
{
return ;
}
}

rule select-define-specific-sources ( properties * )
{
local result ;
if ! [ has-config-flag BOOST_NO_STD_LOCALE : $(properties) ]
{
result += <source>$(SOURCES_HAS_STD_LOCALE).cpp ;
}

#ECHO additional sources $(result) ;

return $(result) ;
}

rule should-build-wserialization ( properties * )
{
local result ;
if [ has-config-flag BOOST_NO_STD_LOCALE : $(properties) ]
{
result += <build>no ;
}

#ECHO should build wserialization $(result) ;

return $(result) ;
}

lib boost_serialization
: ## sources ##
$(SOURCES).cpp
: ## requirements ##
<conditional>@select-define-specific-sources
[ check-target-builds ../../config/checks//std_wstreambuf : <source>../src/$(SOURCES_HAS_STD_WSTREAMBUF).cpp ]
<toolset>msvc:<cxxflags>/Gy
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
<toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
Expand All @@ -165,7 +129,7 @@ lib boost_serialization
lib boost_wserialization
: $(WSOURCES).cpp boost_serialization
:
<conditional>@should-build-wserialization
[ requires std_wstreambuf ]
<toolset>msvc:<cxxflags>/Gy
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
<toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
Expand Down
2 changes: 1 addition & 1 deletion doc/acknowledgments.html
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ <h2 align="center">Acknowledgments</h2>
<a href="http://www.boost.org/people/beman_dawes.html">Beman Dawes</a> who got the boost
serialization ball rolling. It was one or both of these two that invented
the much beloved <code>&amp;</code> syntax used to implement both save and
load in one fuction specification.
load in one function specification.
<li><a href="http://www.boost.org/people/vladimir_prus.htm">Vladimir Prus</a> for evaluating an
early draft and contributing the diamond inheritance example.
<li><a href="http://www.boost.org/people/william_kempf.htm">William E. Kempf</a>
Expand Down
22 changes: 11 additions & 11 deletions doc/archive_reference.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ <h3><a name="trivial">Trivial Archive</a></h3>
Our discussion will focus on archives used for saving as the hierarchy is exactly analogous
for archives used for loading data.

<h4>Minimum Requirments</h4>
<h4>Minimum Requirements</h4>

The simplest class which will model the <a href="archives.html"><strong>Archive</strong></a> concept specifies the functions that a
class will look like:
Expand All @@ -58,10 +58,10 @@ <h4>Minimum Requirments</h4>
typedef boost::mpl::bool_&lt;true&gt; is_saving;
typedef boost::mpl::bool_&lt;false&gt; is_loading;
template&lt;class T&gt; void register_type(){}
template&lt;class T&gt; trivial_oarchive & operator&lt;&lt;(const T & t){
template&lt;class T&gt; trivial_oarchive &amp; operator&lt;&lt;(const T &amp; t){
return *this;
}
template&lt;class T&gt; trivial_oarchive & operator&(const T & t){
template&lt;class T&gt; trivial_oarchive &amp; operator&amp;(const T &amp; t){
return *this &lt;&lt; t;
}
void save_binary(void *address, std::size_t count){};
Expand Down Expand Up @@ -172,10 +172,10 @@ <h4>Optional Overrides</h4>
<p>
<dt><h4><code>
template&lt;class T&gt;
void save_override(T & t, int);
void save_override(T &amp; t, int);
</code></h4></dt>
<dd>
<strong>Default</strong>:Invokes <code style="white-space: normal">archive::save(Archive & ar, t)</code><br>
<strong>Default</strong>:Invokes <code style="white-space: normal">archive::save(Archive &amp; ar, t)</code><br>
This is the main entry into the serialization library.<br>
<strong>Purpose</strong>:This can be specialized in cases where the data is to be written
to the archive in some special way. For example, XML archives implement special handling for
Expand All @@ -190,7 +190,7 @@ <h4>Types used by the serialization library</h4>
The serialization library injects bookkeeping data into the serialization archive.
This data includes things like object ids, version numbers, class names etc. Each
of these objects is included in a wrapper so that the archive class can override the
implementation of <code style="white-space: normal">void save_override(T & t, int);</code>.
implementation of <code style="white-space: normal">void save_override(T &amp; t, int);</code>.
For example, in the XML archive, the override for this type renders an object_id equal to 23 as
"object_id=_23". The following table lists the types defined in the
<code style="white-space: normal">boost::archive namespace</code>
Expand Down Expand Up @@ -250,7 +250,7 @@ <h3><a name="usage">Usage</a></h3>
<ul>
<li>Instances of a derived class are serialized through a base class pointer.
<li>Such instances are not "registered" neither implicitly nor explicitly. That
is, the macro <code style="white-space: normal">BOOT_CLASS_EXPORT</code> is used
is, the macro <code style="white-space: normal">BOOST_CLASS_EXPORT</code> is used
to instantiate the serialization code for the included archives.
</ul>

Expand All @@ -271,7 +271,7 @@ <h4><a name="testing">Testing</h4>
Exhaustive testing of the library requires testing the different aspects of object
serialization with each archive. There are 46 different tests that can run with any archive.
There are 5 "standard archives" included with the system.
(3 in systems that don't support wide charactor i/o).
(3 in systems that don't support wide character i/o).
<p>
In addition, there are 28 other tests which aren't related to any particular archive class.
<p>
Expand Down Expand Up @@ -323,7 +323,7 @@ <h4>Motivation</h4>

All archives described so far are implemented as templates. Code to save and load
data to archives is regenerated for each combination of archive class and data type.
Under these cirumstances, a good optimizing compiler that can expand
Under these circumstances, a good optimizing compiler that can expand
<code>inline</code> functions to enough depth will generate fast code.
However:
<ul>
Expand Down Expand Up @@ -400,15 +400,15 @@ <h4>Usage</h4>
archive functions. This will result in a detectable degradation in performance for
saving and loading archives.
<p>
Note that the concept of polymophic archives is fundamentally incompatible with the
Note that the concept of polymorphic archives is fundamentally incompatible with the
serialization of new types that are marked "primitive" by the user with:
<pre><code>
BOOST_CLASS_IMPLEMENTATION(my_primitive_type, boost::serialization::primitive_type)
</code></pre>

Code to implement serialization for these types is instantiated "on the fly" in the user's program.
But this conflicts with the whole purpose of the polymorphic archive. An attempt to
serialize such a primitive type will result in a compilation error since the common polymorhic
serialize such a primitive type will result in a compilation error since the common polymorphic
interface is static and cannot instantiate code for a new type.

<p>
Expand Down
Loading

0 comments on commit e01b988

Please sign in to comment.