diff --git a/.github/workflows/posix.yml b/.github/workflows/posix.yml index c6c35f5551..4887d0a217 100644 --- a/.github/workflows/posix.yml +++ b/.github/workflows/posix.yml @@ -1,3 +1,12 @@ +# Copyright 2020-2021 Peter Dimov +# Copyright 2021 Andrey Semashev +# Copyright 2021 Alexander Grund +# Copyright 2022 James E. King III +# Copyright 2023 Matt Borland +# +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt) + name: POSIX on: @@ -8,77 +17,453 @@ on: - develop - feature/** +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + env: LIBRARY: serialization UBSAN_OPTIONS: print_stacktrace=1 + GIT_FETCH_JOBS: 8 + NET_RETRY_COUNT: 5 + DEFAULT_BUILD_VARIANT: release jobs: CI: + defaults: + run: + shell: bash strategy: fail-fast: false matrix: include: - - toolset: gcc-4.7 - cxxstd: "03,11" - os: ubuntu-16.04 - install: g++-4.7 - toolset: gcc-4.8 - cxxstd: "03,11" - os: ubuntu-16.04 - install: g++-4.8 + cxxstd: "11" + address_model: 64 + os: ubuntu-latest + container: ubuntu:16.04 + install: + - g++-4.8 + sources: + - "ppa:ubuntu-toolchain-r/test" - toolset: gcc-4.9 - cxxstd: "03,11" - os: ubuntu-16.04 - install: g++-4.9 + cxxstd: "11" + address_model: 64 + os: ubuntu-latest + container: ubuntu:16.04 + install: + - g++-4.9 + sources: + - "ppa:ubuntu-toolchain-r/test" - toolset: gcc-5 - cxxstd: "03,11,14,1z" - os: ubuntu-16.04 + cxxstd: "11,14,1z" + address_model: 64 + os: ubuntu-latest + container: ubuntu:16.04 + install: + - g++-5-multilib + - toolset: gcc-5 + cxxstd: "11-gnu,14-gnu,1z-gnu" + address_model: 64 + os: ubuntu-latest + container: ubuntu:16.04 + install: + - g++-5-multilib - toolset: gcc-6 - cxxstd: "03,11,14,1z" - os: ubuntu-16.04 - install: g++-6 + cxxstd: "11,14,1z" + address_model: 64 + os: ubuntu-latest + container: ubuntu:18.04 + install: + - g++-6-multilib - toolset: gcc-7 - cxxstd: "03,11,14,17" - os: ubuntu-18.04 + cxxstd: "11,14,17" + address_model: 64 + os: ubuntu-latest + container: ubuntu:18.04 + install: + - g++-7-multilib - toolset: gcc-8 - cxxstd: "03,11,14,17,2a" - os: ubuntu-18.04 + cxxstd: "11,14,17,2a" + address_model: 64 + os: ubuntu-latest + container: ubuntu:18.04 + install: + - g++-8-multilib + - toolset: gcc-9 + cxxstd: "11,14,17,2a" + address_model: 64 + os: ubuntu-20.04 + install: + - g++-9-multilib - toolset: gcc-9 - cxxstd: "03,11,14,17,2a" - os: ubuntu-18.04 + cxxstd: "11-gnu,14-gnu,17-gnu,2a-gnu" + address_model: 64 + os: ubuntu-20.04 + install: + - g++-9-multilib - toolset: gcc-10 - cxxstd: "03,11,14,17,2a" - os: ubuntu-18.04 + cxxstd: "11,14,17,20" + address_model: 64 + os: ubuntu-20.04 + install: + - g++-10-multilib + - toolset: gcc-11 + cxxstd: "11,14,17,20,23" + address_model: 64 + os: ubuntu-22.04 + install: + - g++-11-multilib + - toolset: gcc-12 + cxxstd: "11,14,17,20,23" + address_model: 64 + os: ubuntu-22.04 + install: + - g++-12-multilib + - toolset: gcc-12 + cxxstd: "11-gnu,14-gnu,17-gnu,20-gnu,23-gnu" + address_model: 64 + os: ubuntu-22.04 + install: + - g++-12-multilib + - name: UBSAN + toolset: gcc-12 + cxxstd: "11,20" + address_model: 64 + ubsan: 1 + os: ubuntu-22.04 + install: + - g++-12-multilib + + # Linux, clang + - toolset: clang + compiler: clang++-3.7 + cxxstd: "11,14" + os: ubuntu-latest + container: ubuntu:16.04 + install: + - clang-3.7 + - toolset: clang + compiler: clang++-3.8 + cxxstd: "11,14" + os: ubuntu-latest + container: ubuntu:16.04 + install: + - clang-3.8 + - toolset: clang + compiler: clang++-3.9 + cxxstd: "11,14" + os: ubuntu-latest + container: ubuntu:18.04 + install: + - clang-3.9 + - toolset: clang + compiler: clang++-4.0 + cxxstd: "11,14" + os: ubuntu-latest + container: ubuntu:18.04 + install: + - clang-4.0 + - toolset: clang + compiler: clang++-5.0 + cxxstd: "11,14,1z" + os: ubuntu-latest + container: ubuntu:18.04 + install: + - clang-5.0 + - toolset: clang + compiler: clang++-6.0 + cxxstd: "11,14,17" + os: ubuntu-latest + container: ubuntu:18.04 + install: + - clang-6.0 + - toolset: clang + compiler: clang++-7 + cxxstd: "11,14,17" + os: ubuntu-latest + container: ubuntu:18.04 + install: + - clang-7 + # Note: clang-8 does not fully support C++20, so it is not compatible with libstdc++-8 in this mode + - toolset: clang + compiler: clang++-8 + cxxstd: "11,14,17,2a" + os: ubuntu-latest + container: ubuntu:18.04 + install: + - clang-8 + - g++-7 + gcc_toolchain: 7 + - toolset: clang + compiler: clang++-9 + cxxstd: "11,14,17,2a" + os: ubuntu-20.04 + install: + - clang-9 - toolset: clang - cxxstd: "03,11,14,17,2a" - os: ubuntu-18.04 + compiler: clang++-10 + cxxstd: "11,14,17,20" + os: ubuntu-20.04 + install: + - clang-10 - toolset: clang - cxxstd: "03,11,14,17,2a" - os: macos-10.15 + compiler: clang++-11 + cxxstd: "11,14,17,20" + os: ubuntu-22.04 + install: + - clang-11 + - toolset: clang + compiler: clang++-12 + cxxstd: "11,14,17,20,2b" + os: ubuntu-22.04 + install: + - clang-12 + - toolset: clang + compiler: clang++-13 + cxxstd: "11,14,17,20,2b" + os: ubuntu-22.04 + install: + - clang-13 + - toolset: clang + compiler: clang++-14 + cxxstd: "11,14,17,20,2b" + os: ubuntu-22.04 + install: + - clang-14 + - toolset: clang + compiler: clang++-14 + cxxstd: "11-gnu,14-gnu,17-gnu,20-gnu,2b-gnu" + os: ubuntu-22.04 + install: + - clang-14 + - toolset: clang + compiler: clang++-15 + cxxstd: "11,14,17,20,2b" + os: ubuntu-22.04 + install: + - clang-15 + sources: + - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" + source_keys: + - "https://apt.llvm.org/llvm-snapshot.gpg.key" + - toolset: clang + compiler: clang++-15 + cxxstd: "11,14,17,20,2b" + os: ubuntu-22.04 + install: + - clang-15 + - libc++-15-dev + - libc++abi-15-dev + sources: + - "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" + source_keys: + - "https://apt.llvm.org/llvm-snapshot.gpg.key" + cxxflags: -stdlib=libc++ + linkflags: -stdlib=libc++ + + - toolset: clang + cxxstd: "11,14,17,2a" + os: macos-11 + - toolset: clang + cxxstd: "11,14,17,20,2b" + os: macos-12 + timeout-minutes: 360 runs-on: ${{matrix.os}} + container: ${{matrix.container}} steps: - - uses: actions/checkout@v2 + - name: Setup environment + run: | + if [ -f "/etc/debian_version" ] + then + echo "DEBIAN_FRONTEND=noninteractive" >> $GITHUB_ENV + export DEBIAN_FRONTEND=noninteractive + fi + if [ -n "${{matrix.container}}" ] + then + echo "GHA_CONTAINER=${{matrix.container}}" >> $GITHUB_ENV + if [ -f "/etc/debian_version" ] + then + apt-get -o Acquire::Retries=$NET_RETRY_COUNT update + if [ "$(apt-cache search "^python-is-python3$" | wc -l)" -ne 0 ] + then + PYTHON_PACKAGE="python-is-python3" + else + PYTHON_PACKAGE="python" + fi + apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common tzdata wget curl apt-transport-https ca-certificates make build-essential g++ $PYTHON_PACKAGE python3 perl git cmake + fi + fi + git config --global pack.threads 0 + - uses: actions/checkout@v3 - name: Install packages if: matrix.install - run: sudo apt install ${{matrix.install}} - + run: | + declare -a SOURCE_KEYS SOURCES + if [ -n "${{join(matrix.source_keys, ' ')}}" ] + then + SOURCE_KEYS=("${{join(matrix.source_keys, '" "')}}") + fi + if [ -n "${{join(matrix.sources, ' ')}}" ] + then + SOURCES=("${{join(matrix.sources, '" "')}}") + fi + for key in "${SOURCE_KEYS[@]}" + do + for i in {1..$NET_RETRY_COUNT} + do + echo "Adding key: $key" + wget -O - "$key" | sudo apt-key add - && break || sleep 2 + done + done + if [ ${#SOURCES[@]} -gt 0 ] + then + APT_ADD_REPO_COMMON_ARGS=("-y") + APT_ADD_REPO_SUPPORTED_ARGS="$(apt-add-repository --help | perl -ne 'if (/^\s*-n/) { print "n"; } elsif (/^\s*-P/) { print "P"; } elsif (/^\s*-S/) { print "S"; } elsif (/^\s*-U/) { print "U"; }')" + if [ -n "$APT_ADD_REPO_SUPPORTED_ARGS" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*n*}" ] + then + APT_ADD_REPO_COMMON_ARGS+=("-n") + fi + APT_ADD_REPO_HAS_SOURCE_ARGS="$([ -n "$APT_ADD_REPO_SUPPORTED_ARGS" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*P*}" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*S*}" -a -z "${APT_ADD_REPO_SUPPORTED_ARGS##*U*}" ] && echo 1 || echo 0)" + for source in "${SOURCES[@]}" + do + for i in {1..$NET_RETRY_COUNT} + do + APT_ADD_REPO_ARGS=("${APT_ADD_REPO_COMMON_ARGS[@]}") + if [ $APT_ADD_REPO_HAS_SOURCE_ARGS -ne 0 ] + then + case "$source" in + "ppa:"*) + APT_ADD_REPO_ARGS+=("-P") + ;; + "deb "*) + APT_ADD_REPO_ARGS+=("-S") + ;; + *) + APT_ADD_REPO_ARGS+=("-U") + ;; + esac + fi + APT_ADD_REPO_ARGS+=("$source") + echo "apt-add-repository ${APT_ADD_REPO_ARGS[@]}" + sudo -E apt-add-repository "${APT_ADD_REPO_ARGS[@]}" && break || sleep 2 + done + done + fi + sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update + sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y ${{join(matrix.install, ' ')}} + - name: Setup GCC Toolchain + if: matrix.gcc_toolchain + run: | + GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain" + echo "GCC_TOOLCHAIN_ROOT=\"$GCC_TOOLCHAIN_ROOT\"" >> $GITHUB_ENV + MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" + mkdir -p "$GCC_TOOLCHAIN_ROOT" + ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include" + ln -s /usr/bin "$GCC_TOOLCHAIN_ROOT/bin" + mkdir -p "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET" + ln -s "/usr/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" "$GCC_TOOLCHAIN_ROOT/lib/gcc/$MULTIARCH_TRIPLET/${{matrix.gcc_toolchain}}" - name: Setup Boost run: | - REF=${GITHUB_BASE_REF:-$GITHUB_REF} - BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true - cd .. - git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root - cd boost-root - cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY - git submodule update --init tools/boostdep - python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY - ./bootstrap.sh - ./b2 -d0 headers - + echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY + LIBRARY=${GITHUB_REPOSITORY#*/} + echo LIBRARY: $LIBRARY + echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV + echo GITHUB_BASE_REF: $GITHUB_BASE_REF + echo GITHUB_REF: $GITHUB_REF + REF=${GITHUB_BASE_REF:-$GITHUB_REF} + REF=${REF#refs/heads/} + echo REF: $REF + BOOST_BRANCH=develop && [ "$REF" = "master" ] && BOOST_BRANCH=master || true + echo BOOST_BRANCH: $BOOST_BRANCH + BUILD_JOBS=$((nproc || sysctl -n hw.ncpu) 2> /dev/null) + echo "BUILD_JOBS=$BUILD_JOBS" >> $GITHUB_ENV + echo "CMAKE_BUILD_PARALLEL_LEVEL=$BUILD_JOBS" >> $GITHUB_ENV + DEPINST_ARGS=() + GIT_VERSION="$(git --version | sed -e 's/git version //')" + GIT_HAS_JOBS=1 + if [ -f "/etc/debian_version" ] + then + if $(dpkg --compare-versions "$GIT_VERSION" lt 2.8.0) + then + GIT_HAS_JOBS=0 + fi + else + declare -a GIT_VER=(${GIT_VERSION//./ }) + declare -a GIT_MIN_VER=(2 8 0) + for ((i=0; i<${#GIT_VER[@]}; i++)) + do + if [ -z "${GIT_MIN_VER[i]}" ] + then + GIT_MIN_VER[i]=0 + fi + if [ "${GIT_VER[i]}" -lt "${GIT_MIN_VER[i]}" ] + then + GIT_HAS_JOBS=0 + break + fi + done + fi + if [ "$GIT_HAS_JOBS" -ne 0 ] + then + DEPINST_ARGS+=("--git_args" "--jobs $GIT_FETCH_JOBS") + fi + cd .. + git clone -b "$BOOST_BRANCH" --depth 1 "https://github.com/boostorg/boost.git" "boost-root" + cd boost-root + mkdir -p libs/$LIBRARY + cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY + git submodule update --init tools/boostdep + DEPINST_ARGS+=("$LIBRARY") + python tools/boostdep/depinst/depinst.py "${DEPINST_ARGS[@]}" + if [ -z "${{matrix.cmake_tests}}" ] + then + ./bootstrap.sh + ./b2 headers + if [ -n "${{matrix.compiler}}" -o -n "$GCC_TOOLCHAIN_ROOT" ] + then + echo -n "using ${{matrix.toolset}} : : ${{matrix.compiler}}" > ~/user-config.jam + if [ -n "$GCC_TOOLCHAIN_ROOT" ] + then + echo -n " : \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\" \"--gcc-toolchain=$GCC_TOOLCHAIN_ROOT\"" >> ~/user-config.jam + fi + echo " ;" >> ~/user-config.jam + fi + fi - name: Run tests + if: matrix.cmake_tests == '' run: | - cd ../boost-root - ./b2 -j3 libs/$LIBRARY/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} variant=debug,release + cd ../boost-root + B2_ARGS=("-j" "$BUILD_JOBS" "toolset=${{matrix.toolset}}" "cxxstd=${{matrix.cxxstd}}" "link=static,shared") + if [ -n "${{matrix.build_variant}}" ] + then + B2_ARGS+=("variant=${{matrix.build_variant}}") + else + B2_ARGS+=("variant=$DEFAULT_BUILD_VARIANT") + fi + if [ -n "${{matrix.threading}}" ] + then + B2_ARGS+=("threading=${{matrix.threading}}") + fi + if [ -n "${{matrix.ubsan}}" ] + then + export UBSAN_OPTIONS="print_stacktrace=1" + B2_ARGS+=("cxxflags=-fsanitize=undefined -fno-sanitize-recover=undefined" "linkflags=-fsanitize=undefined -fuse-ld=gold" "define=UBSAN=1" "debug-symbols=on" "visibility=global") + fi + if [ -n "${{matrix.cxxflags}}" ] + then + B2_ARGS+=("cxxflags=${{matrix.cxxflags}}") + fi + if [ -n "${{matrix.linkflags}}" ] + then + B2_ARGS+=("linkflags=${{matrix.linkflags}}") + fi + if [ -n "${{matrix.address_model}}" ] + then + B2_ARGS+=("address-model=${{matrix.address_model}}") + fi + B2_ARGS+=("libs/$LIBRARY/test") + ./b2 "${B2_ARGS[@]}" diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 9942cf7163..7c2fce7fed 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -8,6 +8,10 @@ on: - develop - feature/** +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + env: LIBRARY: serialization @@ -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 @@ -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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000..e69de29bb2 diff --git a/CMake/CMakeLists.txt b/CMake/CMakeLists.txt index d740c2b4db..ddacdbd5b8 100644 --- a/CMake/CMakeLists.txt +++ b/CMake/CMakeLists.txt @@ -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) @@ -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() # @@ -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!") @@ -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) @@ -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) @@ -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) diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index 0f214e8789..33964a3080 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -12,6 +12,8 @@ project boost/serialization @include-spirit ; +import ../../config/checks/config : requires ; + SPIRIT_ROOT = [ modules.peek : SPIRIT_ROOT ] ; rule include-spirit ( properties * ) { @@ -88,7 +90,7 @@ SOURCES = codecvt_null ; -SOURCES_HAS_STD_LOCALE = +SOURCES_HAS_STD_WSTREAMBUF = xml_oarchive utf8_codecvt_facet ; @@ -107,49 +109,11 @@ WSOURCES = polymorphic_xml_woarchive ; -rule has-config-flag ( flag : properties * ) -{ - if ( "$(flag)" in $(properties) || "$(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 += $(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 += no ; - } - - #ECHO should build wserialization $(result) ; - - return $(result) ; -} - lib boost_serialization : ## sources ## $(SOURCES).cpp : ## requirements ## - @select-define-specific-sources + [ check-target-builds ../../config/checks//std_wstreambuf : ../src/$(SOURCES_HAS_STD_WSTREAMBUF).cpp ] msvc:/Gy msvc:_SCL_SECURE_NO_WARNINGS msvc:_CRT_SECURE_NO_WARNINGS @@ -165,7 +129,7 @@ lib boost_serialization lib boost_wserialization : $(WSOURCES).cpp boost_serialization : - @should-build-wserialization + [ requires std_wstreambuf ] msvc:/Gy msvc:_SCL_SECURE_NO_WARNINGS msvc:_CRT_SECURE_NO_WARNINGS diff --git a/doc/acknowledgments.html b/doc/acknowledgments.html index e482928247..c6f5fa79b6 100644 --- a/doc/acknowledgments.html +++ b/doc/acknowledgments.html @@ -53,7 +53,7 @@

Acknowledgments

Beman Dawes who got the boost serialization ball rolling. It was one or both of these two that invented the much beloved & syntax used to implement both save and - load in one fuction specification. + load in one function specification.
  • Vladimir Prus for evaluating an early draft and contributing the diamond inheritance example.
  • William E. Kempf diff --git a/doc/archive_reference.html b/doc/archive_reference.html index 24c09f9558..57acdc0636 100644 --- a/doc/archive_reference.html +++ b/doc/archive_reference.html @@ -41,7 +41,7 @@

    Trivial Archive

    Our discussion will focus on archives used for saving as the hierarchy is exactly analogous for archives used for loading data. -

    Minimum Requirments

    +

    Minimum Requirements

    The simplest class which will model the Archive concept specifies the functions that a class will look like: @@ -58,10 +58,10 @@

    Minimum Requirments

    typedef boost::mpl::bool_<true> is_saving; typedef boost::mpl::bool_<false> is_loading; template<class T> void register_type(){} - template<class T> trivial_oarchive & operator<<(const T & t){ + template<class T> trivial_oarchive & operator<<(const T & t){ return *this; } - template<class T> trivial_oarchive & operator&(const T & t){ + template<class T> trivial_oarchive & operator&(const T & t){ return *this << t; } void save_binary(void *address, std::size_t count){}; @@ -172,10 +172,10 @@

    Optional Overrides

    template<class T> -void save_override(T & t, int); +void save_override(T & t, int);

    -Default:Invokes archive::save(Archive & ar, t)
    +Default:Invokes archive::save(Archive & ar, t)
    This is the main entry into the serialization library.
    Purpose: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 @@ -190,7 +190,7 @@

    Types used by the serialization library

    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 void save_override(T & t, int);. +implementation of void save_override(T & t, int);. 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 boost::archive namespace @@ -250,7 +250,7 @@

    Usage

    • Instances of a derived class are serialized through a base class pointer.
    • Such instances are not "registered" neither implicitly nor explicitly. That - is, the macro BOOT_CLASS_EXPORT is used + is, the macro BOOST_CLASS_EXPORT is used to instantiate the serialization code for the included archives.
    @@ -271,7 +271,7 @@

    Testing

    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).

    In addition, there are 28 other tests which aren't related to any particular archive class.

    @@ -323,7 +323,7 @@

    Motivation

    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 inline functions to enough depth will generate fast code. However:
    -
    Special Considerations +
    Special Considerations
    Object Tracking
    Class Information @@ -203,7 +203,7 @@

    Contents

    DLLS - Serialization and Runtime Linking
    Plugins
    Multi-Threading -
    Optimzations +
    Optimizations
    Archive Exceptions
    unregistered_class diff --git a/doc/dataflow.html b/doc/dataflow.html index 618a5fd896..4d8d9f1f79 100644 --- a/doc/dataflow.html +++ b/doc/dataflow.html @@ -135,7 +135,7 @@

    Comparison

    code should implement our binary to base64 conversion.

    Iterators Included in the Library

    -Dataflow iterators for the serialization library are all defined in the hamespace +Dataflow iterators for the serialization library are all defined in the namespace boost::archive::iterators included here are:
    diff --git a/doc/derivation.html b/doc/derivation.html index 947ba51715..b6e7c00bea 100644 --- a/doc/derivation.html +++ b/doc/derivation.html @@ -99,7 +99,7 @@

    Log Archive

    
         // default fall through for any types not specified here
         template<class T>
    -    void save(const T & t){
    +    void save(const T & t){
             xml_oarchive_impl<derived_t>::save(t);
         }
         void save(const unsigned int t);
    @@ -127,14 +127,14 @@ 

    Log Archive

    public xml_oarchive_impl<Archive> { ... -); +}; // do not derive from this class !!! class log_archive : public log_archive_impl<log_archive> { public: - log_archive(std::ostream & os, unsigned int flags = 0) : + log_archive(std::ostream & os, unsigned int flags = 0) : log_archive_impl<xml_oarchive>(os, flags) {} }; diff --git a/doc/exceptions.html b/doc/exceptions.html index cf3007be66..3aba2a23f1 100644 --- a/doc/exceptions.html +++ b/doc/exceptions.html @@ -78,7 +78,7 @@

    Archive Exceptions

    unregistered_cast, // base - derived relationship not registered with // void_cast_register unsupported_class_version, // type saved with a version # greater than the - // one used by the program. This indicates that the proggram + // one used by the program. This indicates that the program // needs to be rebuilt. multiple_code_instantiation, // code for implementing serialization for some // type has been instantiated in more than one module. @@ -141,23 +141,23 @@

    pointer_conflic To understand what this exception means consider the following scenario
    
     template<class Archive>
    -void T::save(Archive &ar) const
    +void T::save(Archive &ar) const
     {
    -    const A * aptr = &a;
    -    ar << aptr;          // save an instance of object of class A through a pointer
    +    const A * aptr = &a;
    +    ar << aptr;          // save an instance of object of class A through a pointer
         ...
    -    ar << a;             // save an instance of an object of class A
    -    assert(aptr == &a);  // this must be true
    +    ar << a;             // save an instance of an object of class A
    +    assert(aptr == &a);  // this must be true
     }
     
     template<class Archive>
    -void T::load(Archive &ar)
    +void T::load(Archive &ar)
     {
         A * aptr;
    -    ar >> aptr;          // create and initialize a new instance of class A
    +    ar >> aptr;          // create and initialize a new instance of class A
         ...
    -    ar >> a;             // restore state of on object of class A
    -    assert(aptr == &a);  // this won't be true
    +    ar >> a;             // restore state of on object of class A
    +    assert(aptr == &a);  // this won't be true
     }
     
    An object is saved first through a pointer then directly. Upon loading back @@ -184,7 +184,7 @@


    output_stream_error

    -An error has occured during stream input or ouput. Aside from the common +An error has occurred during stream input or ouput. Aside from the common situations such as a corrupted or truncated input file, there are several less obvious ones that sometimes occur.

    diff --git a/doc/extended_type_info.html b/doc/extended_type_info.html index e60c527955..7501a605b7 100644 --- a/doc/extended_type_info.html +++ b/doc/extended_type_info.html @@ -49,7 +49,7 @@

    The problem with std::type_info

    std::typeid()
    is not available in all environments. Support for this function depends upon runtime typing(RTTI) support from the compiler. This may be non-existent - or not enabled for reasons such as a percieved inefficiency. + or not enabled for reasons such as a perceived inefficiency.
  • std::type_info includes a string containing type name. This would seem to satisfy 2) above. @@ -95,7 +95,7 @@

    Features

    in order to construct types serialized through a base class pointer.

    Runtime Interface

    -
    
    +
    
     namespace boost { 
     namespace serialization {
     
    @@ -114,9 +114,9 @@ 

    Runtime Interface

    void key_unregister(); public: const char * get_key() const; - bool operator<(const extended_type_info &rhs) const; - bool operator==(const extended_type_info &rhs) const; - bool operator!=(const extended_type_info &rhs) const { + bool operator<(const extended_type_info &rhs) const; + bool operator==(const extended_type_info &rhs) const; + bool operator!=(const extended_type_info &rhs) const { return !(operator==(rhs)); } // for plugins @@ -133,7 +133,7 @@

    Runtime Interface

    extended_type_info instance created for each type. However, this is enforced only at the executable module level. That is, if a program includes some shared libraries or DLLS, -there may be more than one instance of this class correponding to a particular type. +there may be more than one instance of this class corresponding to a particular type. For this reason the comparison functions below can't just compare the addresses of this instance but rather must be programmed to compare the actual information the instances contain. @@ -188,9 +188,9 @@

    Runtime Interface

  • 
    -bool operator<(const extended_type_info & rhs) const;
    -bool operator==(const extended_type_info & rhs) const;
    -bool operator!=(const extended_type_info & rhs) const;
    +bool operator<(const extended_type_info & rhs) const;
    +bool operator==(const extended_type_info & rhs) const;
    +bool operator!=(const extended_type_info & rhs) const;
     

    These functions are used to compare @@ -261,7 +261,7 @@

    Requirements for an Implementation

     template<class ETI>
     const extended_type_info *
    -ETI::get_derived_extended_type_info(const T & t) const;
    +ETI::get_derived_extended_type_info(const T & t) const;
     

    Return a pointer to the @@ -275,7 +275,7 @@

    Requirements for an Implementation

    -virtual bool ETI::is_less_than(const extended_type_info &rhs) const;
    +virtual bool ETI::is_less_than(const extended_type_info &rhs) const;
     

    Compare this instance to another one using the same @@ -283,7 +283,7 @@

    Requirements for an Implementation

    -virtual bool ETI::is_equal(const extended_type_info &rhs) const;
    +virtual bool ETI::is_equal(const extended_type_info &rhs) const;
     

    Compare this instance to another one using the same @@ -330,7 +330,7 @@

    Models

    extended_type_info_no_rtti

    is implemented in a way that doesn't rely on the existence RTTI. -Instead, it requires that all polymorphic types be explictly exported. +Instead, it requires that all polymorphic types be explicitly exported. In addition, if the export facility is to be used to serialize types through base class pointers, those types are required to implement a virtual function with the signature: @@ -354,16 +354,16 @@

    Example

    Requirements for Each Type

    Each type to be managed by the system must be "registered" individually. This is accomplished by instantiating -templates. For example, if the type T is to use the type_info system +templates. For example, if the type T is to use the type_info system one would include the following code:
     namespace boost {
     namespace serialization {
     template
    -struct extended_type_info_typeid>T>;
    +struct extended_type_info_typeid<T>;
     template
    -struct extended_type_info_typeid>const T>;
    +struct extended_type_info_typeid<const T>;
     } // serialization
     } // boost
     
    @@ -375,7 +375,7 @@

    Requirements for Each Type

     BOOST_CLASS_TYPE_INFO(
         my_type, 
    -    extended_type_info_typeid>my_class>
    +    extended_type_info_typeid<my_class>
     )
     
    @@ -399,7 +399,7 @@

    Requirements for Each Type

    }; ... extended_type_info *eti = extended_type_info::find("my_class") -base * b = eti->construct(...); +base * b = eti->construct(...);

    The construct takes an argument count and up to diff --git a/doc/headers.html b/doc/headers.html index 1028a7607a..a8dcdf6217 100644 --- a/doc/headers.html +++ b/doc/headers.html @@ -58,7 +58,7 @@

    Code Structure

    Files Included by User Programs

    Using this library entails including headers listed in this section. -It should not be necessary to explictly include any other header files. +It should not be necessary to explicitly include any other header files.

    Archive Implementations

    @@ -185,7 +185,7 @@

    Serialization Declarations

    boost/serialization/level.hpp -
    To override the default implementaton level trait for a type.
    +
    To override the default implementation level trait for a type.
    boost/serialization/tracking.hpp @@ -320,7 +320,7 @@

    Archive Development

    behavior on a type by type basis. For example, basic_xml_oarchive.hpp includes code to guarantee that any object not attached to a name will trap during compile time. On the other hand, basic_text_oarchive.hpp -contains code to strip out and ingore any names attached to objects. +contains code to strip out and ignore any names attached to objects.

    boost/archive/detail/common_iarchive.hpp @@ -343,7 +343,7 @@

    Archive Internals

    These files are found in the directory
    boost/archive/detail. -These are included as necessary by the archive class implemenations listed above. +These are included as necessary by the archive class implementations listed above. This has the unfortunate side effect of making the implementation less transparent. Users should never find it necessary to change these files.

    @@ -364,19 +364,19 @@

    Archive Internals

    the archive hierarchy.
    
    -template
    -void save_override(T & t, BOOST_PFTO int){
    +template<class T>
    +void save_override(T & t, BOOST_PFTO int){
         // All for otherwise unhandled types are forwarded to the base class.
         // This emulates behavior for function overloading.
    -    this->base::save_override(t, 0);
    +    this->base::save_override(t, 0);
     }
    -void save_override(const some_type & t, int){
    +void save_override(const some_type & t, int){
         // any special handling for some type
         // this will usually entail forwarding some other operation
         // in the most derived class.
    -    this->This()->...
    +    this->This()->...
         // or in one of its parents basic_text_oprimitive
    -    this->This()->save(static_cast<int>(t));
    +    this->This()->save(static_cast<int>(t));
     }
     ... // other special type handling
     
    @@ -408,7 +408,7 @@

    Archive Library Code Modules

    rather than each time a user's program is recompiled. This can save much development time.
  • Headers which solely related to implementation need only be included - in the library code modules. This prevents a user program from accidently + in the library code modules. This prevents a user program from accidentally depending on an implementation feature of the serialization library.
  • In building the library I came to the conclusions that there can arise situations regarding static code/data instantiation that could not be diff --git a/doc/implementation.html b/doc/implementation.html index 08e9974b03..1df3ed74f4 100644 --- a/doc/implementation.html +++ b/doc/implementation.html @@ -147,7 +147,7 @@

    Visual C++ 7.1

    compile command line, wchar_t will be considered an intrinsic type - otherwise it will be treated as a synonym for a 16 bit integer. The library can be used -either way - BUT - both the libray AND the application +either way - BUT - both the library AND the application must be compiled with the same switch settings. Note that BJAM includes this switch by default. So if want to use the libraries that BJAM builds, you should include this switch diff --git a/doc/new_case_studies.html b/doc/new_case_studies.html index 53ac6a07f2..82ac52e68a 100644 --- a/doc/new_case_studies.html +++ b/doc/new_case_studies.html @@ -32,7 +32,7 @@

    Proposed Case Studies

  • These are not part of the library itself, but rather -techiques on how to use the library to address specific situations. +techniques on how to use the library to address specific situations.

    Serializing a Function Object

    An example on how to serialize a function object. I believe this diff --git a/doc/overview.html b/doc/overview.html index 47a87071ad..229885b641 100644 --- a/doc/overview.html +++ b/doc/overview.html @@ -127,7 +127,7 @@

    Other implementations

    This library has similar goals to this one. Some aspects of the implemenation are also similar. As of this writing, it would seem that: