From 60ae371a6852a741e4a5d1592abb8064f0335e9f Mon Sep 17 00:00:00 2001 From: "James E. King III" Date: Tue, 14 May 2024 13:48:20 +0000 Subject: [PATCH 01/12] C++11, Fix use of deprecated timer, fix group assignment operator. Dependencies like optional and smart_ptr will no longer support C++03 therefore the new minimum language level is C++11, and all the CI jobs for both C++98 and C++03 have been removed. Fixed use of the deprecated top level timer class as it was causing build problems using warnings-as-errors. Fixed -Wdeprecated-cast in group.hpp. Fixed -Winvalid-source-encoding in sample_new_features.cpp. Fixed -Wself-assign-overloaded in format_test2.cpp. These changes also allow b2 to work properly when executed from within the format directory. --- .appveyor.yml | 23 +-- .drone.star | 41 ------ .drone/drone.sh | 106 -------------- .github/workflows/ci.yml | 248 +++++++++++++++++++++++--------- Jamfile | 14 +- README.md | 6 +- benchmark/Jamfile | 3 + benchmark/bench_format.cpp | 36 ++--- example/sample_new_features.cpp | 4 +- include/boost/format/group.hpp | 28 ++-- test/format_test2.cpp | 9 +- 11 files changed, 248 insertions(+), 270 deletions(-) delete mode 100644 .drone.star delete mode 100755 .drone/drone.sh diff --git a/.appveyor.yml b/.appveyor.yml index 79d87668..26f0b8ac 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -64,26 +64,15 @@ environment: B2_CXXSTD: 14,17 B2_TOOLSET: msvc-14.1 - - FLAVOR: clang-cl - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - B2_ADDRESS_MODEL: 64 - B2_CXXSTD: 11,14,17 - B2_TOOLSET: clang-win - - - FLAVOR: Visual Studio 2015, 2013 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - B2_TOOLSET: msvc-12.0,msvc-14.0 - - - FLAVOR: Visual Studio 2008, 2010, 2012 + - FLAVOR: Visual Studio 2013 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - B2_TOOLSET: msvc-9.0,msvc-10.0,msvc-11.0 - B2_ADDRESS_MODEL: 32 # No 64bit support + B2_TOOLSET: msvc-12.0 - FLAVOR: cygwin (32-bit) APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 ADDPATH: C:\cygwin\bin; B2_ADDRESS_MODEL: 32 - B2_CXXSTD: 03,11,14,1z + B2_CXXSTD: 11,14,1z B2_THREADING: threadapi=pthread B2_TOOLSET: gcc @@ -91,7 +80,7 @@ environment: APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 ADDPATH: C:\cygwin64\bin; B2_ADDRESS_MODEL: 64 - B2_CXXSTD: 03,11,14,1z + B2_CXXSTD: 11,14,1z B2_THREADING: threadapi=pthread B2_TOOLSET: gcc @@ -99,14 +88,14 @@ environment: APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 B2_ADDRESS_MODEL: 32 ADDPATH: C:\mingw\bin; - B2_CXXSTD: 03,11,14,1z + B2_CXXSTD: 11,14,1z B2_TOOLSET: gcc - FLAVOR: mingw64 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 ADDPATH: C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin; B2_ADDRESS_MODEL: 64 - B2_CXXSTD: 03,11,14,17,2a + B2_CXXSTD: 11,14,17,2a B2_TOOLSET: gcc install: diff --git a/.drone.star b/.drone.star deleted file mode 100644 index 0b899658..00000000 --- a/.drone.star +++ /dev/null @@ -1,41 +0,0 @@ -# Use, modification, and distribution are -# subject to the Boost Software License, Version 1.0. (See accompanying -# file LICENSE.txt) -# -# Copyright Rene Rivera 2020. - -# For Drone CI we use the Starlark scripting language to reduce duplication. -# As the yaml syntax for Drone CI is rather limited. -# -# -globalenv={'B2_VARIANT': 'variant=release'} -linuxglobalimage="cppalliance/droneubuntu1604:1" -windowsglobalimage="cppalliance/dronevs2019" - -def main(ctx): - return [ - linux_cxx("B2_TOOLSET=gcc-4.8 B2_CXXSTD=03,11 Job 0", "g++-4.8", packages="g++-4.8", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu1404:1", environment={'B2_TOOLSET': 'gcc-4.8', 'B2_CXXSTD': '03,11', 'DRONE_JOB_UUID': 'b6589fc6ab'}, globalenv=globalenv), - linux_cxx("B2_TOOLSET=gcc-4.9 B2_CXXSTD=03,11 Job 1", "g++-4.9", packages="g++-4.9", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu1404:1", environment={'B2_TOOLSET': 'gcc-4.9', 'B2_CXXSTD': '03,11', 'DRONE_JOB_UUID': '356a192b79'}, globalenv=globalenv), - linux_cxx("B2_TOOLSET=gcc-5 B2_CXXSTD=03,11 Job 2", "g++-5", packages="g++-5", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'gcc-5', 'B2_CXXSTD': '03,11', 'DRONE_JOB_UUID': 'da4b9237ba'}, globalenv=globalenv), - linux_cxx("B2_TOOLSET=gcc-6 B2_CXXSTD=11,14 Job 3", "g++-6", packages="g++-6", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'gcc-6', 'B2_CXXSTD': '11,14', 'DRONE_JOB_UUID': '77de68daec'}, globalenv=globalenv), - linux_cxx("B2_TOOLSET=gcc-7 B2_CXXSTD=14,17 Job 4", "g++-7", packages="g++-7", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'gcc-7', 'B2_CXXSTD': '14,17', 'DRONE_JOB_UUID': '1b64538924'}, globalenv=globalenv), - linux_cxx("B2_TOOLSET=gcc-8 B2_CXXSTD=17,2a Job 5", "g++-8", packages="g++-8", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'gcc-8', 'B2_CXXSTD': '17,2a', 'DRONE_JOB_UUID': 'ac3478d69a'}, globalenv=globalenv), - linux_cxx("B2_TOOLSET=gcc-9 B2_CXXSTD=17,2a Job 6", "g++-9", packages="g++-9", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'gcc-9', 'B2_CXXSTD': '17,2a', 'DRONE_JOB_UUID': 'c1dfd96eea'}, globalenv=globalenv), - linux_cxx("B2_TOOLSET=clang-3.8 B2_CXXSTD=03,11 Job 7", "clang++-3.8", packages="clang-3.8 libstdc++-6-dev", llvm_os="xenial", llvm_ver="3.8", buildtype="boost", buildscript="drone", image="cppalliance/droneubuntu1404:1", environment={'B2_TOOLSET': 'clang-3.8', 'B2_CXXSTD': '03,11', 'DRONE_JOB_UUID': '902ba3cda1'}, globalenv=globalenv), - linux_cxx("B2_TOOLSET=clang-4.0 B2_CXXSTD=11,14 Job 8", "clang++-4.0", packages="clang-4.0 libstdc++-6-dev", llvm_os="xenial", llvm_ver="4.0", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang-4.0', 'B2_CXXSTD': '11,14', 'DRONE_JOB_UUID': 'fe5dbbcea5'}, globalenv=globalenv), - linux_cxx("B2_TOOLSET=clang-5.0 B2_CXXSTD=11,14 Job 9", "clang++-5.0", packages="clang-5.0 libstdc++-7-dev", llvm_os="xenial", llvm_ver="5.0", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang-5.0', 'B2_CXXSTD': '11,14', 'DRONE_JOB_UUID': '0ade7c2cf9'}, globalenv=globalenv), - linux_cxx("B2_TOOLSET=clang-6.0 B2_CXXSTD=14,17 Job 10", "clang++-6.0", packages="clang-6.0 libc6-dbg libc++-dev libstdc++-8-dev", llvm_os="xenial", llvm_ver="6.0", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang-6.0', 'B2_CXXSTD': '14,17', 'DRONE_JOB_UUID': 'b1d5781111'}, globalenv=globalenv), - linux_cxx("B2_TOOLSET=clang-7 B2_CXXSTD=17,2a Job 11", "clang++-7", packages="clang-7 libc6-dbg libc++-dev libstdc++-8-dev", llvm_os="xenial", llvm_ver="7", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang-7', 'B2_CXXSTD': '17,2a', 'DRONE_JOB_UUID': '17ba079149'}, globalenv=globalenv), - linux_cxx("B2_TOOLSET=clang-8 B2_CXXSTD=17,2a Job 12", "clang++-8", packages="clang-8 libc6-dbg libc++-dev libstdc++-8-dev", llvm_os="xenial", llvm_ver="8", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang-8', 'B2_CXXSTD': '17,2a', 'DRONE_JOB_UUID': '7b52009b64'}, globalenv=globalenv), - linux_cxx("B2_TOOLSET=clang-6.0 B2_CXXSTD=03,11,14 Job 13", "clang++-6.0", packages="clang-6.0 libc6-dbg libc++-dev libstdc++-8-dev", llvm_os="xenial", llvm_ver="6.0", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'B2_TOOLSET': 'clang-6.0', 'B2_CXXSTD': '03,11,14', 'B2_CXXFLAGS': '-stdlib=libc++', 'DRONE_JOB_UUID': 'bd307a3ec3'}, globalenv=globalenv), - osx_cxx("B2_TOOLSET=clang B2_CXXSTD=03,11,17 Job 14", "g++", packages="", buildtype="boost", buildscript="drone", environment={'B2_TOOLSET': 'clang', 'B2_CXXSTD': '03,11,17', 'DRONE_JOB_UUID': 'fa35e19212'}, globalenv=globalenv), - linux_cxx("COMMENT=codecov.io B2_CXXSTD=03,11 B2_TOOLSET Job 15", "g++-8", packages="g++-8", buildtype="b5847f804b-0fcaf592f9", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'codecov.io', 'B2_CXXSTD': '03,11', 'B2_TOOLSET': 'gcc-8', 'B2_DEFINES': 'define=BOOST_NO_STRESS_TEST=1', 'DRONE_JOB_UUID': 'f1abd67035'}, globalenv=globalenv), - linux_cxx("COMMENT=asan B2_VARIANT=variant=debug B2_TOOL Job 16", "g++-8", packages="g++-8", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'asan', 'B2_VARIANT': 'variant=debug', 'B2_TOOLSET': 'gcc-8', 'B2_CXXSTD': '03,11,14', 'B2_CXXFLAGS': 'address-sanitizer=norecover', 'B2_DEFINES': 'define=BOOST_NO_STRESS_TEST=1', 'DRONE_EXTRA_PRIVILEGED': 'True', 'DRONE_JOB_UUID': '1574bddb75'}, globalenv=globalenv, privileged=True), - linux_cxx("COMMENT=tsan B2_VARIANT=variant=debug B2_TOOL Job 17", "g++-8", packages="g++-8", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'tsan', 'B2_VARIANT': 'variant=debug', 'B2_TOOLSET': 'gcc-8', 'B2_CXXSTD': '03,11,14', 'B2_CXXFLAGS': 'thread-sanitizer=norecover', 'B2_DEFINES': 'define=BOOST_NO_STRESS_TEST=1', 'DRONE_JOB_UUID': '0716d9708d'}, globalenv=globalenv), - linux_cxx("COMMENT=ubsan B2_VARIANT=variant=debug B2_TOO Job 18", "g++-8", packages="g++-8", buildtype="boost", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'ubsan', 'B2_VARIANT': 'variant=debug', 'B2_TOOLSET': 'gcc-8', 'B2_CXXSTD': '03,11,14', 'B2_CXXFLAGS': 'undefined-sanitizer=norecover', 'B2_DEFINES': 'define=BOOST_NO_STRESS_TEST=1', 'B2_LINKFLAGS': 'linkflags=-fuse-ld=gold', 'UBSAN_OPTIONS': 'print_stacktrace=1', 'DRONE_JOB_UUID': '9e6a55b6b4'}, globalenv=globalenv), - linux_cxx("COMMENT=valgrind B2_TOOLSET=clang-6.0 B2_CXXS Job 19", "clang++-6.0", packages="clang-6.0 libc6-dbg libc++-dev libstdc++-8-dev", llvm_os="xenial", llvm_ver="6.0", buildtype="b5847f804b-db180b7bd2", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'valgrind', 'B2_TOOLSET': 'clang-6.0', 'B2_CXXSTD': '03,11,14', 'B2_DEFINES': 'define=BOOST_NO_STRESS_TEST=1', 'B2_VARIANT': 'variant=debug', 'B2_TESTFLAGS': 'testing.launcher=valgrind', 'VALGRIND_OPTS': '--error-exitcode=1', 'DRONE_JOB_UUID': 'b3f0c7f6bb'}, globalenv=globalenv), - linux_cxx("COMMENT=Coverity Scan B2_TOOLSET=clang Job 20", "g++", packages="binutils-gold gdb libc6-dbg", buildtype="b5847f804b-cce9827eb5", buildscript="drone", image=linuxglobalimage, environment={'COMMENT': 'Coverity Scan', 'B2_TOOLSET': 'clang', 'DRONE_JOB_UUID': '91032ad7bb'}, globalenv=globalenv), - ] - -# from https://github.com/boostorg/boost-ci -load("@boost_ci//ci/drone/:functions.star", "linux_cxx","windows_cxx","osx_cxx","freebsd_cxx") diff --git a/.drone/drone.sh b/.drone/drone.sh deleted file mode 100755 index 1fc262e0..00000000 --- a/.drone/drone.sh +++ /dev/null @@ -1,106 +0,0 @@ -#!/bin/bash - -# Copyright 2020 Rene Rivera, Sam Darwin -# Distributed under the Boost Software License, Version 1.0. -# (See accompanying file LICENSE.txt or copy at http://boost.org/LICENSE_1_0.txt) - -set -e -export TRAVIS_BUILD_DIR=$(pwd) -export DRONE_BUILD_DIR=$(pwd) -export TRAVIS_BRANCH=$DRONE_BRANCH -export VCS_COMMIT_ID=$DRONE_COMMIT -export GIT_COMMIT=$DRONE_COMMIT -export REPO_NAME=$DRONE_REPO -export PATH=~/.local/bin:/usr/local/bin:$PATH - -if [ "$DRONE_JOB_BUILDTYPE" == "boost" ]; then - -echo '==================================> INSTALL' - -git clone https://github.com/boostorg/boost-ci.git boost-ci -cp -pr boost-ci/ci boost-ci/.codecov.yml . - -if [ "$TRAVIS_OS_NAME" == "osx" ]; then - unset -f cd -fi - -export SELF=`basename $REPO_NAME` -export BOOST_CI_TARGET_BRANCH="$TRAVIS_BRANCH" -export BOOST_CI_SRC_FOLDER=$(pwd) - -. ./ci/common_install.sh - -echo '==================================> SCRIPT' - -cd $BOOST_ROOT/libs/$SELF -ci/travis/build.sh - -elif [ "$DRONE_JOB_BUILDTYPE" == "b5847f804b-0fcaf592f9" ]; then - -echo '==================================> INSTALL' - -git clone https://github.com/boostorg/boost-ci.git boost-ci -cp -pr boost-ci/ci boost-ci/.codecov.yml . - -if [ "$TRAVIS_OS_NAME" == "osx" ]; then - unset -f cd -fi - -export SELF=`basename $REPO_NAME` -export BOOST_CI_TARGET_BRANCH="$TRAVIS_BRANCH" -export BOOST_CI_SRC_FOLDER=$(pwd) - -. ./ci/common_install.sh - -echo '==================================> SCRIPT' - -cd $BOOST_ROOT/libs/$SELF -ci/travis/codecov.sh - -elif [ "$DRONE_JOB_BUILDTYPE" == "b5847f804b-db180b7bd2" ]; then - -echo '==================================> INSTALL' - -git clone https://github.com/boostorg/boost-ci.git boost-ci -cp -pr boost-ci/ci boost-ci/.codecov.yml . - -if [ "$TRAVIS_OS_NAME" == "osx" ]; then - unset -f cd -fi - -export SELF=`basename $REPO_NAME` -export BOOST_CI_TARGET_BRANCH="$TRAVIS_BRANCH" -export BOOST_CI_SRC_FOLDER=$(pwd) - -. ./ci/common_install.sh - -echo '==================================> SCRIPT' - -cd $BOOST_ROOT/libs/$SELF -ci/travis/valgrind.sh - -elif [ "$DRONE_JOB_BUILDTYPE" == "b5847f804b-cce9827eb5" ]; then - -echo '==================================> INSTALL' - -git clone https://github.com/boostorg/boost-ci.git boost-ci -cp -pr boost-ci/ci boost-ci/.codecov.yml . - -if [ "$TRAVIS_OS_NAME" == "osx" ]; then - unset -f cd -fi - -export SELF=`basename $REPO_NAME` -export BOOST_CI_TARGET_BRANCH="$TRAVIS_BRANCH" -export BOOST_CI_SRC_FOLDER=$(pwd) - -. ./ci/common_install.sh - -echo '==================================> SCRIPT' - -if [ -n "${COVERITY_SCAN_NOTIFICATION_EMAIL}" -a \( "$DRONE_BRANCH" = "develop" -o "$DRONE_BRANCH" = "master" \) -a "$DRONE_BUILD_EVENT" = "push" ] ; then -cd $BOOST_ROOT/libs/$SELF -ci/travis/coverity.sh -fi - -fi diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4f87e60..ebeeda05 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,10 +14,6 @@ on: branches: - master - develop - - bugfix/** - - feature/** - - fix/** - - pr/** concurrency: group: ${{format('{0}:{1}', github.repository, github.ref)}} @@ -43,49 +39,60 @@ jobs: matrix: include: # Linux, gcc - - { compiler: gcc-4.4, cxxstd: '98,0x', os: ubuntu-20.04, container: 'ubuntu:16.04' } - - { compiler: gcc-4.6, cxxstd: '03,0x', os: ubuntu-20.04, container: 'ubuntu:16.04' } - - { compiler: gcc-4.7, cxxstd: '03,11', os: ubuntu-20.04, container: 'ubuntu:16.04' } - - { compiler: gcc-4.8, cxxstd: '03,11', os: ubuntu-18.04 } - - { compiler: gcc-4.9, cxxstd: '03,11', os: ubuntu-20.04, container: 'ubuntu:16.04' } - - { compiler: gcc-5, cxxstd: '03,11,14,1z', os: ubuntu-18.04 } - - { compiler: gcc-6, cxxstd: '03,11,14,17', os: ubuntu-18.04 } - - { compiler: gcc-7, cxxstd: '03,11,14,17', os: ubuntu-18.04 } - - { compiler: gcc-8, cxxstd: '03,11,14,17,2a', os: ubuntu-18.04 } - - { compiler: gcc-9, cxxstd: '03,11,14,17,2a', os: ubuntu-18.04 } - - { compiler: gcc-10, cxxstd: '03,11,14,17,20', os: ubuntu-20.04 } - - { compiler: gcc-11, cxxstd: '03,11,14,17,20', os: ubuntu-20.04 } + - { compiler: gcc-4.7, cxxstd: '11', os: ubuntu-22.04, container: 'ubuntu:16.04' } + - { compiler: gcc-4.8, cxxstd: '11', os: ubuntu-22.04, container: 'ubuntu:16.04' } + - { compiler: gcc-4.9, cxxstd: '11', os: ubuntu-22.04, container: 'ubuntu:16.04' } + - { compiler: gcc-5, cxxstd: '11,14,1z', os: ubuntu-22.04, container: 'ubuntu:18.04' } + - { compiler: gcc-6, cxxstd: '11,14,17', os: ubuntu-22.04, container: 'ubuntu:18.04' } + - { compiler: gcc-7, cxxstd: '11,14,17', os: ubuntu-20.04 } + - { compiler: gcc-8, cxxstd: '11,14,17,2a', os: ubuntu-20.04 } + - { compiler: gcc-9, cxxstd: '11,14,17,2a', os: ubuntu-20.04 } + - { compiler: gcc-10, cxxstd: '11,14,17,20', os: ubuntu-20.04 } + - { compiler: gcc-11, cxxstd: '11,14,17,20', os: ubuntu-20.04 } + - { compiler: gcc-12, cxxstd: '11,14,17,20', os: ubuntu-22.04 } + - { compiler: gcc-13, cxxstd: '11,14,17,20', os: ubuntu-22.04 } - { name: GCC w/ sanitizers, sanitize: yes, - compiler: gcc-11, cxxstd: '03,11,14,17,20', os: ubuntu-20.04 } + compiler: gcc-11, cxxstd: '11,14,17,20', os: ubuntu-20.04 } - { name: Collect coverage, coverage: yes, - compiler: gcc-10, cxxstd: '03,11', os: ubuntu-20.04, install: 'g++-10-multilib', address-model: '32,64' } + compiler: gcc-10, cxxstd: '11', os: ubuntu-20.04, install: 'g++-10-multilib', address-model: '32,64' } # Linux, clang - - { compiler: clang-3.5, cxxstd: '03,11', os: ubuntu-20.04, container: 'ubuntu:16.04' } - - { compiler: clang-3.6, cxxstd: '03,11,14', os: ubuntu-20.04, container: 'ubuntu:16.04' } - - { compiler: clang-3.7, cxxstd: '03,11,14', os: ubuntu-20.04, container: 'ubuntu:16.04' } - - { compiler: clang-3.8, cxxstd: '03,11,14', os: ubuntu-20.04, container: 'ubuntu:16.04' } - - { compiler: clang-3.9, cxxstd: '03,11,14', os: ubuntu-18.04 } - - { compiler: clang-4.0, cxxstd: '03,11,14', os: ubuntu-18.04 } - - { compiler: clang-5.0, cxxstd: '03,11,14,1z', os: ubuntu-18.04 } - - { compiler: clang-6.0, cxxstd: '03,11,14,17', os: ubuntu-18.04 } - - { compiler: clang-7, cxxstd: '03,11,14,17', os: ubuntu-18.04 } + - { compiler: clang-3.5, cxxstd: '11', os: ubuntu-22.04, container: 'ubuntu:16.04' } + - { compiler: clang-3.6, cxxstd: '11,14', os: ubuntu-22.04, container: 'ubuntu:16.04' } + - { compiler: clang-3.7, cxxstd: '11,14', os: ubuntu-22.04, container: 'ubuntu:16.04' } + - { compiler: clang-3.8, cxxstd: '11,14', os: ubuntu-22.04, container: 'ubuntu:16.04' } + - { compiler: clang-3.9, cxxstd: '11,14', os: ubuntu-22.04, container: 'ubuntu:18.04' } + - { compiler: clang-4.0, cxxstd: '11,14', os: ubuntu-22.04, container: 'ubuntu:18.04' } + - { compiler: clang-5.0, cxxstd: '11,14,1z', os: ubuntu-22.04, container: 'ubuntu:18.04' } + - { compiler: clang-6.0, cxxstd: '11,14,17', os: ubuntu-22.04, container: 'ubuntu:18.04' } + - { compiler: clang-7, cxxstd: '11,14,17', os: ubuntu-22.04, container: 'ubuntu:18.04' } # Note: clang-8 does not fully support C++20, so it is not compatible with some libstdc++ versions in this mode - - { compiler: clang-8, cxxstd: '03,11,14,17,2a', os: ubuntu-18.04, install: 'clang-8 g++-7', gcc_toolchain: 7 } - - { compiler: clang-9, cxxstd: '03,11,14,17,2a', os: ubuntu-20.04 } - - { compiler: clang-10, cxxstd: '03,11,14,17,20', os: ubuntu-20.04 } - - { compiler: clang-11, cxxstd: '03,11,14,17,20', os: ubuntu-20.04 } + - { compiler: clang-8, cxxstd: '11,14,17,2a', os: ubuntu-22.04, container: 'ubuntu:18.04', install: 'clang-8 g++-7', gcc_toolchain: 7 } + - { compiler: clang-9, cxxstd: '11,14,17,2a', os: ubuntu-20.04 } + - { compiler: clang-10, cxxstd: '11,14,17,20', os: ubuntu-20.04 } + - { compiler: clang-11, cxxstd: '11,14,17,20', os: ubuntu-20.04 } + - { compiler: clang-12, cxxstd: '11,14,17,20', os: ubuntu-20.04 } - { name: Clang w/ valgrind, valgrind: yes, - compiler: clang-12, cxxstd: '03,11,14,17,20', os: ubuntu-20.04, install: 'valgrind' } + compiler: clang-12, cxxstd: '11,14,17,20', os: ubuntu-20.04, install: 'valgrind' } + # Clang isn't compatible with libstdc++-13, so use the slightly older one + - { compiler: clang-13, cxxstd: '11,14,17,20', os: ubuntu-22.04, install: 'clang-13 g++-12', gcc_toolchain: 12 } + - { compiler: clang-14, cxxstd: '11,14,17,20', os: ubuntu-22.04, install: 'clang-14 g++-12', gcc_toolchain: 12 } + - { compiler: clang-15, cxxstd: '11,14,17,20', os: ubuntu-22.04, install: 'clang-15 g++-12', gcc_toolchain: 12 } + - { compiler: clang-16, cxxstd: '11,14,17,20,2b', os: ubuntu-latest, container: 'ubuntu:23.04' } + - { compiler: clang-17, cxxstd: '11,14,17,20,2b', os: ubuntu-latest, container: 'ubuntu:23.10' } # libc++ - - { compiler: clang-6.0, cxxstd: '03,11,14', os: ubuntu-18.04, stdlib: libc++, install: 'clang-6.0 libc++-dev libc++abi-dev' } - - { compiler: clang-12, cxxstd: '03,11,14,17,20', os: ubuntu-20.04, stdlib: libc++, install: 'clang-12 libc++-12-dev libc++abi-12-dev' } + - { compiler: clang-6.0, cxxstd: '11,14', os: ubuntu-22.04, container: 'ubuntu:18.04', stdlib: libc++, install: 'clang-6.0 libc++-dev libc++abi-dev' } + - { compiler: clang-12, cxxstd: '11,14,17,20', os: ubuntu-20.04, stdlib: libc++, install: 'clang-12 libc++-12-dev libc++abi-12-dev' } - { name: Clang w/ sanitizers, sanitize: yes, - compiler: clang-12, cxxstd: '03,11,14,17,20', os: ubuntu-20.04, stdlib: libc++, install: 'clang-12 libc++-12-dev libc++abi-12-dev' } + compiler: clang-12, cxxstd: '11,14,17,20', os: ubuntu-20.04, stdlib: libc++, install: 'clang-12 libc++-12-dev libc++abi-12-dev' } # OSX, clang - - { compiler: clang, cxxstd: '03,11,14,17,2a', os: macos-10.15, sanitize: yes } + - { compiler: clang, cxxstd: '11,14,17,2a', os: macos-11, ccache: no } + - { compiler: clang, cxxstd: '11,14,17,20', os: macos-12 } + - { name: MacOS w/ clang and sanitizers, + compiler: clang, cxxstd: '11,14,17,20,2b', os: macos-13, sanitize: yes } + - { compiler: clang, cxxstd: '11,14,17,20,2b', os: macos-14 } # Coverity Scan # requires two github secrets in repo to activate; see ci/github/coverity.sh @@ -94,7 +101,7 @@ jobs: compiler: clang-10, cxxstd: '17', os: ubuntu-20.04, ccache: no } # multiarch (bigendian testing) - does not support coverage yet - # format has no endian compile-itme branches + # format has no endian compile-time branches so this is unnecessary # - { name: Big-endian, multiarch: yes, # compiler: clang, cxxstd: '17', os: ubuntu-20.04, ccache: no, distro: fedora, edition: 34, arch: s390x } @@ -113,41 +120,77 @@ jobs: fi if [ -n "${{matrix.container}}" ] && [ -f "/etc/debian_version" ]; then apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common - # Need (newer) git + apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common curl + # Need (newer) git, and the older Ubuntu container may require requesting the key manually using port 80 + curl -sSL --retry ${NET_RETRY_COUNT:-5} 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xE1DD270288B4E6030699E45FA1715D88E1DF1F24' | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/git-core_ubuntu_ppa.gpg for i in {1..${NET_RETRY_COUNT:-3}}; do sudo -E add-apt-repository -y ppa:git-core/ppa && break || sleep 10; done apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y g++ python libpython-dev git + osver=$(lsb_release -sr | cut -f1 -d.) + pkgs="g++ git" + # Ubuntu 22+ has only Python 3 in the repos + if [ -n "$osver" ] && [ "$osver" -ge "22" ]; then + pkgs+=" python-is-python3 libpython3-dev" + else + pkgs+=" python libpython-dev" + fi + apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y $pkgs fi # multiple job types are not compatible with ccache, they use "ccache: no" in the matrix if [[ "${{ matrix.ccache }}" == "no" ]]; then echo "B2_USE_CCACHE=0" >> $GITHUB_ENV fi + git config --global pack.threads 0 + if [[ "${{matrix.container}}" == "ubuntu:16.04" ]] || [[ "${{matrix.container}}" == "ubuntu:18.04" ]]; then + # Ubuntu 16/18 can't run Node 20, so stick to older actions: https://github.com/actions/checkout/issues/1590 + echo "GHA_USE_NODE_20=false" >> $GITHUB_ENV + else + echo "GHA_USE_NODE_20=true" >> $GITHUB_ENV + fi if [[ "${{ matrix.valgrind }}" == "yes" ]]; then echo "B2_DEFINES=BOOST_NO_STRESS_TEST=1" >> $GITHUB_ENV echo "B2_TESTFLAGS=testing.launcher=valgrind" >> $GITHUB_ENV echo "B2_FLAGS=define=BOOST_USE_VALGRIND=1" >> $GITHUB_ENV echo "VALGRIND_OPTS=--error-exitcode=1" >> $GITHUB_ENV fi - git config --global pack.threads 0 - uses: actions/checkout@v3 + if: env.GHA_USE_NODE_20 == 'false' + with: + # For coverage builds fetch the whole history, else only 1 commit using a 'fake ternary' + fetch-depth: ${{ matrix.coverage && '0' || '1' }} + - uses: actions/checkout@v4 + if: env.GHA_USE_NODE_20 == 'true' with: # For coverage builds fetch the whole history, else only 1 commit using a 'fake ternary' fetch-depth: ${{ matrix.coverage && '0' || '1' }} - name: Cache ccache uses: actions/cache@v3 - if: env.B2_USE_CCACHE + if: env.B2_USE_CCACHE && env.GHA_USE_NODE_20 == 'false' + with: + path: ~/.ccache + key: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}-${{github.sha}} + restore-keys: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}- + + - name: Cache ccache + uses: actions/cache@v4 + if: env.B2_USE_CCACHE && env.GHA_USE_NODE_20 == 'true' with: path: ~/.ccache key: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}-${{github.sha}} - restore-keys: | - ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}- - ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}} + restore-keys: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}- - name: Fetch Boost.CI uses: actions/checkout@v3 + if: env.GHA_USE_NODE_20 == 'false' + with: + repository: boostorg/boost-ci + ref: master + path: boost-ci-cloned + + - name: Fetch Boost.CI + uses: actions/checkout@v4 + if: env.GHA_USE_NODE_20 == 'true' with: repository: boostorg/boost-ci ref: master @@ -165,17 +208,12 @@ jobs: SOURCE_KEYS=(${{join(matrix.source_keys, ' ')}}) SOURCES=(${{join(matrix.sources, ' ')}}) # Add this by default + SOURCE_KEYS+=('http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x1E9377A2BA9EF27F') SOURCES+=(ppa:ubuntu-toolchain-r/test) - for key in "${SOURCE_KEYS[@]}"; do - for i in {1..$NET_RETRY_COUNT}; do - wget -O - "$key" | sudo apt-key add - && break || sleep 10 - done - done - for source in "${SOURCES[@]}"; do - for i in {1..$NET_RETRY_COUNT}; do - sudo add-apt-repository $source && break || sleep 10 - done - done + + ci/add-apt-keys.sh "${SOURCE_KEYS[@]}" + ci/add-apt-repositories.sh "${SOURCES[@]}" + sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update if [[ -z "${{matrix.install}}" ]]; then pkgs="${{matrix.compiler}}" @@ -190,6 +228,9 @@ jobs: run: | GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain" echo "GCC_TOOLCHAIN_ROOT=$GCC_TOOLCHAIN_ROOT" >> $GITHUB_ENV + if ! command -v dpkg-architecture; then + apt-get install -y dpkg-dev + fi MULTIARCH_TRIPLET="$(dpkg-architecture -qDEB_HOST_MULTIARCH)" mkdir -p "$GCC_TOOLCHAIN_ROOT" ln -s /usr/include "$GCC_TOOLCHAIN_ROOT/include" @@ -209,6 +250,8 @@ jobs: echo "BDDE_ARCH=${{ matrix.arch }}" >> ${GITHUB_ENV} echo "B2_DEFINES=BOOST_NO_STRESS_TEST=1" >> ${GITHUB_ENV} echo "B2_WRAPPER=bdde" >> ${GITHUB_ENV} + # Avoid: /usr/bin/windres: Can't detect architecture. + echo "B2_DONT_EMBED_MANIFEST=1" >> ${GITHUB_ENV} - name: Setup Boost env: @@ -227,9 +270,21 @@ jobs: if: '!matrix.coverity' run: ci/build.sh - - name: Upload coverage + - name: Collect coverage if: matrix.coverage run: ci/codecov.sh "upload" + env: + BOOST_CI_CODECOV_IO_UPLOAD: skip + + - name: Upload coverage + if: matrix.coverage + uses: codecov/codecov-action@v4 + with: + disable_search: true + file: coverage.info + name: Github Actions + token: ${{secrets.CODECOV_TOKEN}} + verbose: true - name: Run coverity if: matrix.coverity && github.event_name == 'push' && (github.ref_name == 'develop' || github.ref_name == 'master') @@ -246,18 +301,21 @@ jobs: fail-fast: false matrix: include: + - { toolset: msvc-14.0, cxxstd: '14,latest', addrmd: '32,64', os: windows-2019 } - { toolset: msvc-14.2, cxxstd: '14,17,20', addrmd: '32,64', os: windows-2019 } + - { toolset: msvc-14.3, cxxstd: '14,17,20,latest',addrmd: '32,64', os: windows-2022 } - { name: Collect coverage, coverage: yes, - toolset: msvc-14.3, cxxstd: '14,17,20', addrmd: '32,64', os: windows-2022 } - - { toolset: gcc, cxxstd: '03,11,14,17,2a', addrmd: '64', os: windows-2019 } + toolset: msvc-14.3, cxxstd: 'latest', addrmd: '64', os: windows-2022 } + - { toolset: clang-win, cxxstd: '14,17,latest', addrmd: '32,64', os: windows-2022 } + - { toolset: gcc, cxxstd: '11,14,17,2a', addrmd: '64', os: windows-2019 } runs-on: ${{matrix.os}} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Fetch Boost.CI - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: repository: boostorg/boost-ci ref: master @@ -279,7 +337,7 @@ jobs: B2_CXXSTD: ${{matrix.cxxstd}} B2_ADDRESS_MODEL: ${{matrix.addrmd}} - - name: Run coverage + - name: Collect coverage shell: powershell if: matrix.coverage run: ci\opencppcoverage.ps1 @@ -290,10 +348,70 @@ jobs: - name: Upload coverage if: matrix.coverage - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v4 with: - files: __out/cobertura.xml + disable_search: true + file: __out/cobertura.xml + name: Github Actions + token: ${{secrets.CODECOV_TOKEN}} + verbose: true + MSYS2: + defaults: + run: + shell: msys2 {0} + strategy: + fail-fast: false + matrix: + include: + - { sys: MINGW32, compiler: gcc, cxxstd: '11,17,20' } + - { sys: MINGW64, compiler: gcc, cxxstd: '11,17,20' } + + runs-on: windows-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup MSYS2 environment + uses: msys2/setup-msys2@v2 + with: + msystem: ${{matrix.sys}} + update: true + install: git python + pacboy: gcc:p cmake:p ninja:p + + - name: Fetch Boost.CI + uses: actions/checkout@v4 + with: + repository: boostorg/boost-ci + ref: master + path: boost-ci-cloned + - name: Get CI scripts folder + run: | + # Copy ci folder if not testing Boost.CI + [[ "$GITHUB_REPOSITORY" =~ "boost-ci" ]] || cp -r boost-ci-cloned/ci . + rm -rf boost-ci-cloned + + - name: Setup Boost + env: + B2_COMPILER: ${{matrix.compiler}} + B2_CXXSTD: ${{matrix.cxxstd}} + B2_SANITIZE: ${{matrix.sanitize}} + B2_STDLIB: ${{matrix.stdlib}} + run: ci/github/install.sh + + - name: Run tests + run: ci/build.sh + + # Run also the CMake tests to avoid having to setup another matrix for CMake on MSYS + - name: Run CMake tests + run: | + cd "$BOOST_ROOT" + mkdir __build_cmake_test__ && cd __build_cmake_test__ + cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBOOST_INCLUDE_LIBRARIES=$SELF -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=ON -DBoost_VERBOSE=ON .. + cmake --build . --target tests --config Debug -j$B2_JOBS + ctest --output-on-failure --build-config Debug + CMake: defaults: run: @@ -312,10 +430,10 @@ jobs: runs-on: ${{matrix.os}} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Fetch Boost.CI - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: repository: boostorg/boost-ci ref: master diff --git a/Jamfile b/Jamfile index 5f53e9bf..56ca0a55 100644 --- a/Jamfile +++ b/Jamfile @@ -5,19 +5,13 @@ # Use, modification, and distribution are subject to 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) +# project : requirements - - all - - clang:-Wextra - clang:-ansi - clang:-pedantic - - gcc:-Wextra - gcc:-ansi - gcc:-pedantic + gcc-4.7:-Wno-unused-parameter + pedantic + on ; # please order by name to ease maintenance diff --git a/README.md b/README.md index de632fcf..1767593c 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,13 @@ Distributed under the [Boost Software License, Version 1.0](http://www.boost.org ### Properties -* C++03 +* C++11 * Header-only +### Dependencies + +Direct dependencies for `boost::format` branches: [`master`](https://pdimov.github.io/boostdep-report/master/format.html), [`develop`](https://pdimov.github.io/boostdep-report/develop/format.html) provided by boostdep-report. + ### Build Status Branch | GHA CI | Appveyor | Coverity Scan | codecov.io | Deps | Docs | Tests | diff --git a/benchmark/Jamfile b/benchmark/Jamfile index 0a420ab3..933ac966 100644 --- a/benchmark/Jamfile +++ b/benchmark/Jamfile @@ -13,15 +13,18 @@ project libs/format/benchmark exe bench_format_no_locale : bench_format.cpp + /boost/timer//boost_timer : BOOST_NO_STD_LOCALE no_locale ; exe bench_format_normal : bench_format.cpp + /boost/timer//boost_timer : normal ; exe bench_format_no_reuse_stream : bench_format.cpp + /boost/timer//boost_timer : alts BOOST_FORMAT_NO_OSS_MEMBER no_reuse_stream ; diff --git a/benchmark/bench_format.cpp b/benchmark/bench_format.cpp index 393df758..8385c6e5 100644 --- a/benchmark/bench_format.cpp +++ b/benchmark/bench_format.cpp @@ -28,7 +28,7 @@ #include #include #include // floor -#include +#include #include #include @@ -87,7 +87,7 @@ static int NTests = 300000; //static std::stringstream nullStream; static NulStream nullStream; -static double tstream, tpf; +static boost::timer::nanosecond_type tstream, tpf; //static const std::string fstring="%3$#x %1$20.10E %2$g %3$d \n"; static const std::string fstring="%3$0#6x %1$20.10E %2$g %3$0+5d \n"; static const double arg1=45.23; @@ -120,11 +120,11 @@ void test_sprintf() cerr << endl << buf; } // time the loop : - boost::timer chrono; + boost::timer::cpu_timer chrono; for(int i=0; i oss; oss << boost::format(fstring) % arg1 % arg2 % arg3; - boost::timer chrono; + boost::timer::cpu_timer chrono; size_t dummy=0; for(int i=0; i oss; { @@ -207,7 +207,7 @@ void test_nullstream() // nullStream << " " << arg2 << " " << arg3 << " \n" ; // } - double t = chrono.elapsed(); + boost::timer::nanosecond_type t = chrono.elapsed().wall; cout << left << setw(20) <<"ostream time"<< right <<":" << setw(5) << t << ", = " << t / tpf << " * printf \n"; tstream = t; @@ -216,7 +216,7 @@ void test_nullstream() void test_opti_nullstream() { using namespace std; - boost::timer chrono; + boost::timer::cpu_timer chrono; boost::io::basic_oaltstringstream oss; //static const std::string fstring="%3$#x %1$20.10E %2$g %3$d \n"; @@ -251,7 +251,7 @@ void test_opti_nullstream() nullStream.flags(f0); nullStream.precision(p0); nullStream << " " << arg2 << " " << arg3 << " \n" ; } - double t = chrono.elapsed(); + boost::timer::nanosecond_type t = chrono.elapsed().wall; cout << left << setw(20) <<"opti-stream time"<< right <<":" << setw(5) << t << ", = " << t / tpf << " * printf \n"; // tstream = t; @@ -271,11 +271,11 @@ void test_parsed_once_format() // not only is the format-string parsed once, // but also the buffer of the internal stringstream is already allocated. - boost::timer chrono; + boost::timer::cpu_timer chrono; for(int i=0; i tabulation of N times the character . // are useful when printing lines with several fields whose width can vary a lot // but we'd like to print some fields at the same place when possible : - vector names(1, "Marc-François Michel"), + vector names(1, "Marc-François Michel"), surname(1,"Durand"), tel(1, "+33 (0) 123 456 789"); @@ -52,7 +52,7 @@ int main(){ /* prints : - Marc-François Michel, Durand, +33 (0) 123 456 789 + Marc-François Michel, Durand, +33 (0) 123 456 789 Jean, de Lattre de Tassigny, +33 (0) 987 654 321 diff --git a/include/boost/format/group.hpp b/include/boost/format/group.hpp index c586b2a6..47b10a5d 100644 --- a/include/boost/format/group.hpp +++ b/include/boost/format/group.hpp @@ -55,8 +55,8 @@ struct group1 group1(T1 a1) : a1_(a1) {} -private: - group1& operator=(const group1&); + group1(const group1&) = default; + group1& operator=(const group1&) = delete; }; template @@ -80,8 +80,8 @@ struct group2 group2(T1 a1,T2 a2) : a1_(a1),a2_(a2) {} -private: - group2& operator=(const group2&); + group2(const group2&) = default; + group2& operator=(const group2&) = delete; }; template @@ -103,8 +103,8 @@ struct group3 group3(T1 a1,T2 a2,T3 a3) : a1_(a1),a2_(a2),a3_(a3) {} -private: - group3& operator=(const group3&); + group3(const group3&) = default; + group3& operator=(const group3&) = delete; }; template @@ -127,8 +127,8 @@ struct group4 group4(T1 a1,T2 a2,T3 a3,T4 a4) : a1_(a1),a2_(a2),a3_(a3),a4_(a4) {} -private: - group4& operator=(const group4&); + group4(const group4&) = default; + group4& operator=(const group4&) = delete; }; template @@ -152,6 +152,8 @@ struct group5 group5(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5) : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5) {} + group5(const group5&) = default; + group5& operator=(const group5&) = delete; }; template @@ -176,6 +178,8 @@ struct group6 group6(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6) : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6) {} + group6(const group6&) = default; + group6& operator=(const group6&) = delete; }; template @@ -201,6 +205,8 @@ struct group7 group7(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7) : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6),a7_(a7) {} + group7(const group7&) = default; + group7& operator=(const group7&) = delete; }; template @@ -227,6 +233,8 @@ struct group8 group8(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8) : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6),a7_(a7),a8_(a8) {} + group8(const group8&) = default; + group8& operator=(const group8&) = delete; }; template @@ -254,6 +262,8 @@ struct group9 group9(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8,T9 a9) : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6),a7_(a7),a8_(a8),a9_(a9) {} + group9(const group9&) = default; + group9& operator=(const group9&) = delete; }; template @@ -282,6 +292,8 @@ struct group10 group10(T1 a1,T2 a2,T3 a3,T4 a4,T5 a5,T6 a6,T7 a7,T8 a8,T9 a9,T10 a10) : a1_(a1),a2_(a2),a3_(a3),a4_(a4),a5_(a5),a6_(a6),a7_(a7),a8_(a8),a9_(a9),a10_(a10) {} + group10(const group10&) = default; + group10& operator=(const group10&) = delete; }; template diff --git a/test/format_test2.cpp b/test/format_test2.cpp index 9fb06101..84dd7bf1 100644 --- a/test/format_test2.cpp +++ b/test/format_test2.cpp @@ -204,9 +204,14 @@ int main(int, char* []) BOOST_TEST_EQ((boost::format("%2.2s %-4.4s % 8.8s") % mystr % mystr % mystr).str(), "ab abcd abcdefg"); - // coverage, operator = + // coverage, operator =, copy constructor format fmt("%1%%2%%3%"); - fmt = fmt; + format fmt2; + fmt2 = fmt; + format fmt3(fmt); + BOOST_TEST_EQ((fmt % 'a' % 'b' % 'c').str(), "abc"); + BOOST_TEST_EQ((fmt2 % 'b' % 'c' % 'd').str(), "bcd"); + BOOST_TEST_EQ((fmt3 % 'c' % 'd' % 'e').str(), "cde"); return boost::report_errors(); } From cd1dbc69b1eaa70ce213497eb72f07b4d1c9217e Mon Sep 17 00:00:00 2001 From: "James E. King III" Date: Wed, 15 May 2024 17:25:22 +0000 Subject: [PATCH 02/12] Fix documentation links in README --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1767593c..ea162928 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ Direct dependencies for `boost::format` branches: [`master`](https://pdimov.gith Branch | GHA CI | Appveyor | Coverity Scan | codecov.io | Deps | Docs | Tests | :-------------: | ------ | -------- | ------------- | ---------- | ---- | ---- | ----- | -[`master`](https://github.com/boostorg/format/tree/master) | [![Build Status](https://github.com/boostorg/format/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/format/actions?query=branch:master) | [![Build status](https://ci.appveyor.com/api/projects/status/tkcumf8nu6tb697d/branch/master?svg=true)](https://ci.appveyor.com/project/jeking3/format-bhjc4/branch/master) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/14007/badge.svg)](https://scan.coverity.com/projects/boostorg-format) | [![codecov](https://codecov.io/gh/boostorg/format/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/format/branch/master) | [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/format.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](http://www.boost.org/doc/libs/master/doc/html/format.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/format.html) -[`develop`](https://github.com/boostorg/format/tree/develop) | [![Build Status](https://github.com/boostorg/format/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/format/actions?query=branch:develop) | [![Build status](https://ci.appveyor.com/api/projects/status/tkcumf8nu6tb697d/branch/develop?svg=true)](https://ci.appveyor.com/project/jeking3/format-bhjc4/branch/develop) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/14007/badge.svg)](https://scan.coverity.com/projects/boostorg-format) | [![codecov](https://codecov.io/gh/boostorg/format/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/format/branch/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/format.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](http://www.boost.org/doc/libs/develop/doc/html/format.html) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/format.html) +[`master`](https://github.com/boostorg/format/tree/master) | [![Build Status](https://github.com/boostorg/format/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/format/actions?query=branch:master) | [![Build status](https://ci.appveyor.com/api/projects/status/tkcumf8nu6tb697d/branch/master?svg=true)](https://ci.appveyor.com/project/jeking3/format-bhjc4/branch/master) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/14007/badge.svg)](https://scan.coverity.com/projects/boostorg-format) | [![codecov](https://codecov.io/gh/boostorg/format/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/format/branch/master) | [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/format.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](https://www.boost.org/doc/libs/master/libs/format/) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/format.html) +[`develop`](https://github.com/boostorg/format/tree/develop) | [![Build Status](https://github.com/boostorg/format/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/format/actions?query=branch:develop) | [![Build status](https://ci.appveyor.com/api/projects/status/tkcumf8nu6tb697d/branch/develop?svg=true)](https://ci.appveyor.com/project/jeking3/format-bhjc4/branch/develop) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/14007/badge.svg)](https://scan.coverity.com/projects/boostorg-format) | [![codecov](https://codecov.io/gh/boostorg/format/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/format/branch/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/format.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](https://www.boost.org/doc/libs/develop/libs/format/) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/format.html) ### Directories From 355cff8f03856e21f7d6ca8f3d1f80452058622e Mon Sep 17 00:00:00 2001 From: "James E. King III" Date: Wed, 15 May 2024 17:26:46 +0000 Subject: [PATCH 03/12] Remove redundant dependencies README section --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index ea162928..16945065 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,6 @@ Distributed under the [Boost Software License, Version 1.0](http://www.boost.org * C++11 * Header-only -### Dependencies - -Direct dependencies for `boost::format` branches: [`master`](https://pdimov.github.io/boostdep-report/master/format.html), [`develop`](https://pdimov.github.io/boostdep-report/develop/format.html) provided by boostdep-report. - ### Build Status Branch | GHA CI | Appveyor | Coverity Scan | codecov.io | Deps | Docs | Tests | From 53e63060ba5813c7d6a26b9c0d6d8fbdddaf5727 Mon Sep 17 00:00:00 2001 From: "James E. King III" Date: Wed, 15 May 2024 18:25:36 +0000 Subject: [PATCH 04/12] Fix -Wunused-but-set-variable with clane 18.1 --- benchmark/bench_format.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/benchmark/bench_format.cpp b/benchmark/bench_format.cpp index 8385c6e5..b9fc09d3 100644 --- a/benchmark/bench_format.cpp +++ b/benchmark/bench_format.cpp @@ -141,7 +141,8 @@ void test_try1() boost::timer::nanosecond_type t = chrono.elapsed().wall; cout << left << setw(20) <<"try1 time"<< right <<":" << setw(5) << t << ", = " << t / tpf << " * printf " - << ", = " << t / tstream << " * nullStream \n"; + << ", = " << t / tstream << " * nullStream" + << ", accum = " << dummy << endl; } void test_try2() @@ -163,7 +164,8 @@ void test_try2() boost::timer::nanosecond_type t = chrono.elapsed().wall; cout << left << setw(20) <<"try2 time"<< right <<":" << setw(5) << t << ", = " << t / tpf << " * printf " - << ", = " << t / tstream << " * nullStream \n"; + << ", = " << t / tstream << " * nullStream" + << ", accum = " << dummy << endl; } void do_stream(std::ostream& os) { From fb4ad94028e9a029b06ec56505cd3d53f2b561c0 Mon Sep 17 00:00:00 2001 From: "James E. King III" Date: Wed, 15 May 2024 18:00:36 +0000 Subject: [PATCH 05/12] Update meta and cmake to c++11 language level --- CMakeLists.txt | 7 ++++--- meta/libraries.json | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cb1db66a..270b1d3a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,9 +1,9 @@ # Generated by `boostdep --cmake format` -# Copyright 2020 Peter Dimov +# Copyright 2020, 2021 Peter Dimov # Distributed under the Boost Software License, Version 1.0. # https://www.boost.org/LICENSE_1_0.txt -cmake_minimum_required(VERSION 3.5...3.16) +cmake_minimum_required(VERSION 3.8...3.20) project(boost_format VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) @@ -23,9 +23,10 @@ target_link_libraries(boost_format Boost::utility ) +target_compile_features(boost_format INTERFACE cxx_std_11) + if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt") add_subdirectory(test) endif() - diff --git a/meta/libraries.json b/meta/libraries.json index 43c03e88..fb38b66b 100644 --- a/meta/libraries.json +++ b/meta/libraries.json @@ -13,5 +13,5 @@ "Samuel Krempp ", "James E. King III " ], - "cxxstd": "03" + "cxxstd": "11" } From 51ff665248cf51fbe91f2eff1dd9ac7cb1859abd Mon Sep 17 00:00:00 2001 From: "James E. King III" Date: Thu, 16 May 2024 12:10:11 +0000 Subject: [PATCH 06/12] Disable a test on mingw32 due to lack of support. --- test/format_test2.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/format_test2.cpp b/test/format_test2.cpp index 84dd7bf1..299b1a76 100644 --- a/test/format_test2.cpp +++ b/test/format_test2.cpp @@ -130,7 +130,8 @@ int main(int, char* []) // specific so we're just going to do minimal checking... double dbl = 1234567.890123f; -#if (__cplusplus >= 201103L) || (BOOST_VERSION_NUMBER_MAJOR(BOOST_COMP_MSVC) >= 12) +#if !defined(__MINGW32__) && ((__cplusplus >= 201103L) || (BOOST_VERSION_NUMBER_MAJOR(BOOST_COMP_MSVC) >= 12)) + // mingw32 does not have support for hexfloat but does set __cplusplus to a C++11 value // msvc-12.0 and later have support for hexfloat but do not set __cplusplus to a C++11 value BOOST_TEST(boost::starts_with((boost::format("%A") % dbl).str(), "0X")); BOOST_TEST(boost::starts_with((boost::format("%a") % dbl).str(), "0x")); From 9c6964ae01169974da56ba0d3f32ff2627604776 Mon Sep 17 00:00:00 2001 From: "James E. King III" Date: Tue, 4 Jun 2024 21:52:47 +0000 Subject: [PATCH 07/12] Remove Travis CI configuration (unused) --- .travis.yml | 216 ---------------------------------------------------- 1 file changed, 216 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index fcc17f0a..00000000 --- a/.travis.yml +++ /dev/null @@ -1,216 +0,0 @@ -# Copyright 2016 Peter Dimov -# Copyright 2017 - 2019 James E. King III -# 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) - -# -# Generic Travis CI build script for boostorg repositories -# See: https://github.com/boostorg/boost-ci -# -# Instructions for customizing this script for your library: -# -# 1. Customize the compilers and language levels you want in the 'jobs'. -# 2. If you have more than include/, src/, test/, example/, examples/, or -# tools/ directories, modify your Travis CI project and add the environment -# variable DEPINST. For example if your build uses code in "bench/" and -# "fog/" directories, then set DEPINST to the following: -# --include bench --include fog -# 3. If you want to enable Coverity Scan, you need to provide the environment -# variables COVERITY_SCAN_TOKEN and COVERITY_SCAN_NOTIFICATION_EMAIL in -# your github settings. -# 4. Enable pull request builds in your boostorg/ account. -# -# That's it - the scripts will do everything else for you. - -dist: xenial -language: cpp - -env: - global: - # see: http://www.boost.org/build/doc/html/bbv2/overview/invocation.html#bbv2.overview.invocation.properties - # - B2_ADDRESS_MODEL=address-model=64,32 - # - B2_LINK=link=shared,static - # - B2_THREADING=threading=multi,single - - B2_VARIANT=variant=release - -install: - - git clone https://github.com/boostorg/boost-ci.git boost-ci - - cp -pr boost-ci/ci boost-ci/.codecov.yml . - - source ci/travis/install.sh - -addons: - apt: - packages: - - binutils-gold - - gdb - - libc6-dbg - -branches: - only: - - master - - develop - - /bugfix\/.*/ - - /feature\/.*/ - - /fix\/.*/ - - /pr\/.*/ - -script: - - cd $BOOST_ROOT/libs/$SELF - - ci/travis/build.sh - -# -# Default toolsets in Ubuntu -# -# trusty xenial bionic -# 14.04 16.04 18.04 -# ------ ------ ------ -# clang 3.4 3.8 6.0 -# gcc 4.8.2 5.3.1 7.3.0 -# - -anchors: - clang-38: &clang-38 { apt: { packages: [ "clang-3.8", - "libstdc++-6-dev" ], sources: [ "llvm-toolchain-xenial-3.8", - "ubuntu-toolchain-r-test" ] } } - clang-4: &clang-4 { apt: { packages: [ "clang-4.0", - "libstdc++-6-dev" ], sources: [ "llvm-toolchain-xenial-4.0", - "ubuntu-toolchain-r-test" ] } } - clang-5: &clang-5 { apt: { packages: [ "clang-5.0", - "libstdc++-7-dev" ], sources: [ "llvm-toolchain-xenial-5.0", - "ubuntu-toolchain-r-test" ] } } - clang-6: &clang-6 { apt: { packages: [ "clang-6.0", - "libc6-dbg", - "libc++-dev", - "libstdc++-8-dev" ], sources: [ "llvm-toolchain-xenial-6.0", - "ubuntu-toolchain-r-test" ] } } - clang-7: &clang-7 { apt: { packages: [ "clang-7", - "libc6-dbg", - "libc++-dev", - "libstdc++-8-dev" ], sources: [ "llvm-toolchain-xenial-7", - "ubuntu-toolchain-r-test" ] } } - clang-8: &clang-8 { apt: { packages: [ "clang-8", - "libc6-dbg", - "libc++-dev", - "libstdc++-8-dev" ], sources: [ "llvm-toolchain-xenial-8", - "ubuntu-toolchain-r-test" ] } } - gcc-48: &gcc-48 { apt: { packages: [ "g++-4.8" ] } } - gcc-49: &gcc-49 { apt: { packages: [ "g++-4.9" ], sources: [ "ubuntu-toolchain-r-test" ] } } - gcc-5: &gcc-5 { apt: { packages: [ "g++-5" ] } } - gcc-6: &gcc-6 { apt: { packages: [ "g++-6" ], sources: [ "ubuntu-toolchain-r-test" ] } } - gcc-7: &gcc-7 { apt: { packages: [ "g++-7" ], sources: [ "ubuntu-toolchain-r-test" ] } } - gcc-8: &gcc-8 { apt: { packages: [ "g++-8" ], sources: [ "ubuntu-toolchain-r-test" ] } } - gcc-9: &gcc-9 { apt: { packages: [ "g++-9" ], sources: [ "ubuntu-toolchain-r-test" ] } } - -jobs: - allow_failures: - - env: - - COPY="all the environment settings from your job" - - include: - # libstdc++ - - { os: "linux", dist: "trusty", # xenial has libstdc++ from gcc 5.4.0 with newer ABI - env: [ "B2_TOOLSET=gcc-4.8", "B2_CXXSTD=03,11" ], addons: *gcc-48 } - - { os: "linux", dist: "trusty", # xenial has libstdc++ from gcc 5.4.0 with newer ABI - env: [ "B2_TOOLSET=gcc-4.9", "B2_CXXSTD=03,11" ], addons: *gcc-49 } - - { os: "linux", env: [ "B2_TOOLSET=gcc-5", "B2_CXXSTD=03,11" ], addons: *gcc-5 } - - { os: "linux", env: [ "B2_TOOLSET=gcc-6", "B2_CXXSTD=11,14" ], addons: *gcc-6 } - - { os: "linux", env: [ "B2_TOOLSET=gcc-7", "B2_CXXSTD=14,17" ], addons: *gcc-7 } - - { os: "linux", env: [ "B2_TOOLSET=gcc-8", "B2_CXXSTD=17,2a" ], addons: *gcc-8 } - - { os: "linux", env: [ "B2_TOOLSET=gcc-9", "B2_CXXSTD=17,2a" ], addons: *gcc-9 } - - { os: "linux", dist: "trusty", # xenial has libstdc++ from gcc 5.4.0 with newer ABI - env: [ "B2_TOOLSET=clang-3.8", "B2_CXXSTD=03,11" ], addons: *clang-38 } - - { os: "linux", env: [ "B2_TOOLSET=clang-4.0", "B2_CXXSTD=11,14" ], addons: *clang-4 } - - { os: "linux", env: [ "B2_TOOLSET=clang-5.0", "B2_CXXSTD=11,14" ], addons: *clang-5 } - - { os: "linux", env: [ "B2_TOOLSET=clang-6.0", "B2_CXXSTD=14,17" ], addons: *clang-6 } - - { os: "linux", env: [ "B2_TOOLSET=clang-7", "B2_CXXSTD=17,2a" ], addons: *clang-7 } - - { os: "linux", env: [ "B2_TOOLSET=clang-8", "B2_CXXSTD=17,2a" ], addons: *clang-8 } - - # libc++ - - { os: "linux", env: [ "B2_TOOLSET=clang-6.0", "B2_CXXSTD=03,11,14", - "B2_CXXFLAGS=-stdlib=libc++" ], addons: *clang-6 } - - { os: "osx" , env: [ "B2_TOOLSET=clang", "B2_CXXSTD=03,11,17" ] } - - # to enable Intel ICC define INTEL_ICC_SERIAL_NUMBER and the following: - # - { os: "linux", env: [ "B2_TOOLSET=intel-linux", "B2_CXXSTD=11,14,17" ], addons: *gcc-7, - # script: cd $BOOST_ROOT/libs/$SELF && ci/travis/intelicc.sh } - - - os: linux - env: - - COMMENT=codecov.io - - B2_CXXSTD=03,11 - - B2_TOOLSET=gcc-8 - - B2_DEFINES="define=BOOST_NO_STRESS_TEST=1" - addons: *gcc-8 - script: - - cd $BOOST_ROOT/libs/$SELF - - ci/travis/codecov.sh - - - os: linux - env: - - COMMENT=asan - - B2_VARIANT=variant=debug - - B2_TOOLSET=gcc-8 - - B2_CXXSTD=03,11,14 - - B2_CXXFLAGS="address-sanitizer=norecover" - - B2_DEFINES="define=BOOST_NO_STRESS_TEST=1" - addons: *gcc-8 - - - os: linux - env: - - COMMENT=tsan - - B2_VARIANT=variant=debug - - B2_TOOLSET=gcc-8 - - B2_CXXSTD=03,11,14 - - B2_CXXFLAGS="thread-sanitizer=norecover" - - B2_DEFINES="define=BOOST_NO_STRESS_TEST=1" - addons: *gcc-8 - - - os: linux - env: - - COMMENT=ubsan - - B2_VARIANT=variant=debug - - B2_TOOLSET=gcc-8 - - B2_CXXSTD=03,11,14 - - B2_CXXFLAGS="undefined-sanitizer=norecover" - - B2_DEFINES="define=BOOST_NO_STRESS_TEST=1" - # https://github.com/boostorg/build/issues/451 using the gold linker to work around an issue - - B2_LINKFLAGS="linkflags=-fuse-ld=gold" - - UBSAN_OPTIONS=print_stacktrace=1 - addons: *gcc-8 - - - os: linux - env: - - COMMENT=valgrind - - B2_TOOLSET=clang-6.0 - - B2_CXXSTD=03,11,14 - - B2_DEFINES="define=BOOST_NO_STRESS_TEST=1" - - B2_VARIANT=variant=debug - - B2_TESTFLAGS=testing.launcher=valgrind - - VALGRIND_OPTS=--error-exitcode=1 - addons: *clang-6 - script: - - cd $BOOST_ROOT/libs/$SELF - - ci/travis/valgrind.sh - - # - os: linux - # env: - # - COMMENT=cppcheck - # script: - # - cd $BOOST_ROOT/libs/$SELF - # - ci/travis/cppcheck.sh - - #################### Jobs to run on pushes to master, develop ################### - - # Coverity Scan - - os: linux - if: (env(COVERITY_SCAN_NOTIFICATION_EMAIL) IS present) AND (branch IN (develop, master)) AND (type IN (cron, push)) - env: - - COMMENT="Coverity Scan" - - B2_TOOLSET=clang - script: - - cd $BOOST_ROOT/libs/$SELF - - ci/travis/coverity.sh - -notifications: - email: - false From f700da0dc961f5f1b13aa8ceda2e03de92622556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Ferdinand=20Rivera=20Morell?= Date: Wed, 1 Jan 2025 17:28:09 -0600 Subject: [PATCH 08/12] Add support for modular build structure. (#102) * Make the library modular usable. * Switch to library requirements instead of source. As source puts extra source in install targets. * Add missing lib reference. * Add requires-b2 check to top-level build file. * Bump B2 require to 5.2 * Change all references to . * Update copyright dates. * Move inter-lib dependencies to a project variable and into the build targets. * Update build deps. --- Jamfile | 21 --------------------- benchmark/Jamfile | 12 +++++++----- build.jam | 37 +++++++++++++++++++++++++++++++++++++ example/Jamfile.v2 | 4 +++- test/Jamfile.v2 | 5 +++++ tools/Jamfile.v2 | 5 ++++- 6 files changed, 56 insertions(+), 28 deletions(-) delete mode 100644 Jamfile create mode 100644 build.jam diff --git a/Jamfile b/Jamfile deleted file mode 100644 index 56ca0a55..00000000 --- a/Jamfile +++ /dev/null @@ -1,21 +0,0 @@ -# Boost.Format Library Jamfile -# -# Copyright (c) 2003 Samuel Krempp -# -# Use, modification, and distribution are subject to 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) -# - -project - : requirements - gcc-4.7:-Wno-unused-parameter - pedantic - on - ; - -# please order by name to ease maintenance -build-project benchmark ; -build-project example ; -build-project test ; -build-project tools ; diff --git a/benchmark/Jamfile b/benchmark/Jamfile index 933ac966..f5b1f32e 100644 --- a/benchmark/Jamfile +++ b/benchmark/Jamfile @@ -6,19 +6,21 @@ # See www.boost.org/LICENSE_1_0.txt # -project libs/format/benchmark +project : requirements - msvc:_CRT_SECURE_NO_WARNINGS - ; + /boost/format//boost_format + /boost/timer//boost_timer + msvc:_CRT_SECURE_NO_WARNINGS + ; exe bench_format_no_locale : bench_format.cpp /boost/timer//boost_timer - : BOOST_NO_STD_LOCALE no_locale + : BOOST_NO_STD_LOCALE no_locale ; exe bench_format_normal - : bench_format.cpp + : bench_format.cpp /boost/timer//boost_timer : normal ; diff --git a/build.jam b/build.jam new file mode 100644 index 00000000..4207b499 --- /dev/null +++ b/build.jam @@ -0,0 +1,37 @@ +# Copyright René Ferdinand Rivera Morell 2023-2024 +# 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) + +require-b2 5.2 ; + +constant boost_dependencies : + /boost/assert//boost_assert + /boost/config//boost_config + /boost/core//boost_core + /boost/optional//boost_optional + /boost/smart_ptr//boost_smart_ptr + /boost/throw_exception//boost_throw_exception + /boost/utility//boost_utility ; + +project /boost/format + : common-requirements + include + ; + +explicit + [ alias boost_format : : : : $(boost_dependencies) ] + [ alias all + : boost_format + benchmark + example + test + tools + : pedantic + on + ] + ; + +call-if : boost-library format + ; + diff --git a/example/Jamfile.v2 b/example/Jamfile.v2 index 6029e897..e20be7d2 100644 --- a/example/Jamfile.v2 +++ b/example/Jamfile.v2 @@ -7,10 +7,12 @@ import testing ; +project : requirements /boost/format//boost_format ; + test-suite "format-examples" : [ run sample_advanced.cpp ] [ run sample_formats.cpp ] [ run sample_new_features.cpp ] - [ run sample_userType.cpp ] + [ run sample_userType.cpp : : : /boost/numeric_conversion//boost_numeric_conversion ] ; diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index f77f97c8..5e5c3bba 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -7,6 +7,11 @@ import testing ; +project : requirements + /boost/format//boost_format + /boost/algorithm//boost_algorithm + ; + test-suite "format" : [ run format_test1.cpp ] [ run format_test1.cpp : : : msvc:"/FIWindows.h" : format_test1_windows_h ] diff --git a/tools/Jamfile.v2 b/tools/Jamfile.v2 index fe148231..b1d6dcc5 100644 --- a/tools/Jamfile.v2 +++ b/tools/Jamfile.v2 @@ -7,12 +7,15 @@ project : requirements + /boost/format//boost_format _CRT_SECURE_NO_WARNINGS static ; -exe format_matrix +exe format_matrix : format_matrix.cpp + /boost/array//boost_array + /boost/filesystem//boost_filesystem /boost/program_options//boost_program_options /boost/system//boost_system ; From b91dc19b4cdedcdb79605d22a71a4f612f5ed6de Mon Sep 17 00:00:00 2001 From: "James E. King III" Date: Wed, 1 Jan 2025 23:25:31 +0000 Subject: [PATCH 09/12] Update CI to 2024.12 spec, update README --- .appveyor.yml | 26 +--- .github/workflows/ci.yml | 223 ++++++++++++++++----------------- README.md | 19 +-- test/cmake_test/CMakeLists.txt | 22 ++++ test/cmake_test/main.cpp | 42 +++++++ 5 files changed, 191 insertions(+), 141 deletions(-) create mode 100644 test/cmake_test/CMakeLists.txt create mode 100644 test/cmake_test/main.cpp diff --git a/.appveyor.yml b/.appveyor.yml index 26f0b8ac..ffe7b588 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -33,6 +33,12 @@ branches: - /fix\/.*/ - /pr\/.*/ +skip_commits: + files: + - LICENSE + - meta/* + - README.md + matrix: fast_finish: false # Adding MAYFAIL to any matrix job allows it to fail but the build stays green: @@ -64,16 +70,11 @@ environment: B2_CXXSTD: 14,17 B2_TOOLSET: msvc-14.1 - - FLAVOR: Visual Studio 2013 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - B2_TOOLSET: msvc-12.0 - - FLAVOR: cygwin (32-bit) APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 ADDPATH: C:\cygwin\bin; B2_ADDRESS_MODEL: 32 B2_CXXSTD: 11,14,1z - B2_THREADING: threadapi=pthread B2_TOOLSET: gcc - FLAVOR: cygwin (64-bit) @@ -81,21 +82,6 @@ environment: ADDPATH: C:\cygwin64\bin; B2_ADDRESS_MODEL: 64 B2_CXXSTD: 11,14,1z - B2_THREADING: threadapi=pthread - B2_TOOLSET: gcc - - - FLAVOR: mingw32 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - B2_ADDRESS_MODEL: 32 - ADDPATH: C:\mingw\bin; - B2_CXXSTD: 11,14,1z - B2_TOOLSET: gcc - - - FLAVOR: mingw64 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 - ADDPATH: C:\mingw-w64\x86_64-8.1.0-posix-seh-rt_v6-rev0\mingw64\bin; - B2_ADDRESS_MODEL: 64 - B2_CXXSTD: 11,14,17,2a B2_TOOLSET: gcc install: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ebeeda05..ceb0f325 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,10 @@ on: branches: - master - develop + - bugfix/** + - feature/** + - fix/** + - pr/** concurrency: group: ${{format('{0}:{1}', github.repository, github.ref)}} @@ -39,76 +43,77 @@ jobs: matrix: include: # Linux, gcc - - { compiler: gcc-4.7, cxxstd: '11', os: ubuntu-22.04, container: 'ubuntu:16.04' } - - { compiler: gcc-4.8, cxxstd: '11', os: ubuntu-22.04, container: 'ubuntu:16.04' } - - { compiler: gcc-4.9, cxxstd: '11', os: ubuntu-22.04, container: 'ubuntu:16.04' } - - { compiler: gcc-5, cxxstd: '11,14,1z', os: ubuntu-22.04, container: 'ubuntu:18.04' } - - { compiler: gcc-6, cxxstd: '11,14,17', os: ubuntu-22.04, container: 'ubuntu:18.04' } - - { compiler: gcc-7, cxxstd: '11,14,17', os: ubuntu-20.04 } - - { compiler: gcc-8, cxxstd: '11,14,17,2a', os: ubuntu-20.04 } - - { compiler: gcc-9, cxxstd: '11,14,17,2a', os: ubuntu-20.04 } - - { compiler: gcc-10, cxxstd: '11,14,17,20', os: ubuntu-20.04 } - - { compiler: gcc-11, cxxstd: '11,14,17,20', os: ubuntu-20.04 } - - { compiler: gcc-12, cxxstd: '11,14,17,20', os: ubuntu-22.04 } - - { compiler: gcc-13, cxxstd: '11,14,17,20', os: ubuntu-22.04 } + - { compiler: gcc-4.8, cxxstd: '11', os: ubuntu-latest, container: 'ubuntu:16.04' } + - { compiler: gcc-4.9, cxxstd: '11', os: ubuntu-latest, container: 'ubuntu:16.04' } + - { compiler: gcc-5, cxxstd: '11,14,1z', os: ubuntu-latest, container: 'ubuntu:18.04' } + - { compiler: gcc-6, cxxstd: '11,14,17', os: ubuntu-latest, container: 'ubuntu:18.04' } + - { compiler: gcc-7, cxxstd: '11,14,17', os: ubuntu-20.04 } + - { compiler: gcc-8, cxxstd: '11,14,17,2a', os: ubuntu-20.04 } + - { compiler: gcc-9, cxxstd: '11,14,17,2a', os: ubuntu-20.04 } + - { compiler: gcc-10, cxxstd: '11,14,17,20', os: ubuntu-22.04 } + - { compiler: gcc-11, cxxstd: '11,14,17,20', os: ubuntu-22.04 } + - { compiler: gcc-12, cxxstd: '11,14,17,20', os: ubuntu-22.04 } + - { compiler: gcc-13, cxxstd: '11,14,17,20,2b', os: ubuntu-24.04 } + - { compiler: gcc-14, cxxstd: '11,14,17,20,2b', os: ubuntu-24.04 } - { name: GCC w/ sanitizers, sanitize: yes, - compiler: gcc-11, cxxstd: '11,14,17,20', os: ubuntu-20.04 } + compiler: gcc-13, cxxstd: '11,14,17,20', os: ubuntu-24.04 } - { name: Collect coverage, coverage: yes, - compiler: gcc-10, cxxstd: '11', os: ubuntu-20.04, install: 'g++-10-multilib', address-model: '32,64' } + compiler: gcc-13, cxxstd: '2b', os: ubuntu-24.04, install: 'g++-13-multilib', address-model: '32,64' } # Linux, clang - - { compiler: clang-3.5, cxxstd: '11', os: ubuntu-22.04, container: 'ubuntu:16.04' } - - { compiler: clang-3.6, cxxstd: '11,14', os: ubuntu-22.04, container: 'ubuntu:16.04' } - - { compiler: clang-3.7, cxxstd: '11,14', os: ubuntu-22.04, container: 'ubuntu:16.04' } - - { compiler: clang-3.8, cxxstd: '11,14', os: ubuntu-22.04, container: 'ubuntu:16.04' } - - { compiler: clang-3.9, cxxstd: '11,14', os: ubuntu-22.04, container: 'ubuntu:18.04' } - - { compiler: clang-4.0, cxxstd: '11,14', os: ubuntu-22.04, container: 'ubuntu:18.04' } - - { compiler: clang-5.0, cxxstd: '11,14,1z', os: ubuntu-22.04, container: 'ubuntu:18.04' } - - { compiler: clang-6.0, cxxstd: '11,14,17', os: ubuntu-22.04, container: 'ubuntu:18.04' } - - { compiler: clang-7, cxxstd: '11,14,17', os: ubuntu-22.04, container: 'ubuntu:18.04' } + - { compiler: clang-3.5, cxxstd: '11', os: ubuntu-latest, container: 'ubuntu:16.04' } + - { compiler: clang-3.6, cxxstd: '11,14', os: ubuntu-latest, container: 'ubuntu:16.04' } + - { compiler: clang-3.7, cxxstd: '11,14', os: ubuntu-latest, container: 'ubuntu:16.04' } + - { compiler: clang-3.8, cxxstd: '11,14', os: ubuntu-latest, container: 'ubuntu:16.04' } + - { compiler: clang-3.9, cxxstd: '11,14', os: ubuntu-latest, container: 'ubuntu:18.04' } + - { compiler: clang-4.0, cxxstd: '11,14', os: ubuntu-latest, container: 'ubuntu:18.04' } + - { compiler: clang-5.0, cxxstd: '11,14,1z', os: ubuntu-latest, container: 'ubuntu:18.04' } + - { compiler: clang-6.0, cxxstd: '11,14,17', os: ubuntu-20.04 } + - { compiler: clang-7, cxxstd: '11,14,17', os: ubuntu-20.04 } # Note: clang-8 does not fully support C++20, so it is not compatible with some libstdc++ versions in this mode - - { compiler: clang-8, cxxstd: '11,14,17,2a', os: ubuntu-22.04, container: 'ubuntu:18.04', install: 'clang-8 g++-7', gcc_toolchain: 7 } - - { compiler: clang-9, cxxstd: '11,14,17,2a', os: ubuntu-20.04 } - - { compiler: clang-10, cxxstd: '11,14,17,20', os: ubuntu-20.04 } - - { compiler: clang-11, cxxstd: '11,14,17,20', os: ubuntu-20.04 } - - { compiler: clang-12, cxxstd: '11,14,17,20', os: ubuntu-20.04 } - - { name: Clang w/ valgrind, valgrind: yes, - compiler: clang-12, cxxstd: '11,14,17,20', os: ubuntu-20.04, install: 'valgrind' } + - { compiler: clang-8, cxxstd: '11,14,17,2a', os: ubuntu-20.04 , install: 'clang-8 g++-7', gcc_toolchain: 7 } + - { compiler: clang-9, cxxstd: '11,14,17,2a', os: ubuntu-20.04 } + - { compiler: clang-10, cxxstd: '11,14,17,20', os: ubuntu-20.04 } + - { compiler: clang-11, cxxstd: '11,14,17,20', os: ubuntu-20.04 } + - { compiler: clang-12, cxxstd: '11,14,17,20', os: ubuntu-20.04 } # Clang isn't compatible with libstdc++-13, so use the slightly older one - - { compiler: clang-13, cxxstd: '11,14,17,20', os: ubuntu-22.04, install: 'clang-13 g++-12', gcc_toolchain: 12 } - - { compiler: clang-14, cxxstd: '11,14,17,20', os: ubuntu-22.04, install: 'clang-14 g++-12', gcc_toolchain: 12 } - - { compiler: clang-15, cxxstd: '11,14,17,20', os: ubuntu-22.04, install: 'clang-15 g++-12', gcc_toolchain: 12 } - - { compiler: clang-16, cxxstd: '11,14,17,20,2b', os: ubuntu-latest, container: 'ubuntu:23.04' } - - { compiler: clang-17, cxxstd: '11,14,17,20,2b', os: ubuntu-latest, container: 'ubuntu:23.10' } + - { compiler: clang-13, cxxstd: '11,14,17,20', os: ubuntu-22.04, install: 'clang-13 g++-12', gcc_toolchain: 12 } + - { compiler: clang-14, cxxstd: '11,14,17,20', os: ubuntu-22.04, install: 'clang-14 g++-12', gcc_toolchain: 12 } + - { compiler: clang-15, cxxstd: '11,14,17,20', os: ubuntu-22.04, install: 'clang-15 g++-12', gcc_toolchain: 12 } + - { compiler: clang-16, cxxstd: '11,14,17,20,2b', os: ubuntu-24.04 } + # https://github.com/llvm/llvm-project/issues/59827: disabled 2b/23 for clang-17 with libstdc++13 in 24.04 + - { compiler: clang-17, cxxstd: '11,14,17,20', os: ubuntu-24.04 } + - { compiler: clang-18, cxxstd: '11,14,17,20,23,2c', os: ubuntu-24.04 } # libc++ - - { compiler: clang-6.0, cxxstd: '11,14', os: ubuntu-22.04, container: 'ubuntu:18.04', stdlib: libc++, install: 'clang-6.0 libc++-dev libc++abi-dev' } - - { compiler: clang-12, cxxstd: '11,14,17,20', os: ubuntu-20.04, stdlib: libc++, install: 'clang-12 libc++-12-dev libc++abi-12-dev' } + - { compiler: clang-6.0, cxxstd: '11,14', os: ubuntu-latest, container: 'ubuntu:18.04', stdlib: libc++, install: 'clang-6.0 libc++-dev libc++abi-dev' } + - { compiler: clang-7, cxxstd: '11,14,17', os: ubuntu-20.04, stdlib: libc++, install: 'clang-7 libc++-7-dev libc++abi-7-dev' } - { name: Clang w/ sanitizers, sanitize: yes, - compiler: clang-12, cxxstd: '11,14,17,20', os: ubuntu-20.04, stdlib: libc++, install: 'clang-12 libc++-12-dev libc++abi-12-dev' } + compiler: clang-12, cxxstd: '11,14,17,20', os: ubuntu-20.04, stdlib: libc++, install: 'clang-12 libc++-12-dev libc++abi-12-dev' } - # OSX, clang - - { compiler: clang, cxxstd: '11,14,17,2a', os: macos-11, ccache: no } - - { compiler: clang, cxxstd: '11,14,17,20', os: macos-12 } - { name: MacOS w/ clang and sanitizers, compiler: clang, cxxstd: '11,14,17,20,2b', os: macos-13, sanitize: yes } - { compiler: clang, cxxstd: '11,14,17,20,2b', os: macos-14 } + - { compiler: clang, cxxstd: '11,14,17,20,2b', os: macos-15 } # Coverity Scan # requires two github secrets in repo to activate; see ci/github/coverity.sh # does not run on pull requests, only on pushes into develop and master - { name: Coverity, coverity: yes, - compiler: clang-10, cxxstd: '17', os: ubuntu-20.04, ccache: no } + compiler: clang-12, cxxstd: '20', os: ubuntu-20.04, ccache: no } # multiarch (bigendian testing) - does not support coverage yet - # format has no endian compile-time branches so this is unnecessary - # - { name: Big-endian, multiarch: yes, - # compiler: clang, cxxstd: '17', os: ubuntu-20.04, ccache: no, distro: fedora, edition: 34, arch: s390x } + - { name: Big-endian, multiarch: yes, + compiler: clang, cxxstd: '17', os: ubuntu-22.04, ccache: no, distro: fedora, edition: 34, arch: s390x } timeout-minutes: 120 runs-on: ${{matrix.os}} - container: ${{matrix.container}} + container: + image: ${{matrix.container}} + volumes: + - /node20217:/node20217:rw,rshared + - ${{ startsWith(matrix.container, 'ubuntu:1') && '/node20217:/__e/node20:ro,rshared' || ' ' }} env: {B2_USE_CCACHE: 1} steps: @@ -126,7 +131,7 @@ jobs: for i in {1..${NET_RETRY_COUNT:-3}}; do sudo -E add-apt-repository -y ppa:git-core/ppa && break || sleep 10; done apt-get -o Acquire::Retries=$NET_RETRY_COUNT update osver=$(lsb_release -sr | cut -f1 -d.) - pkgs="g++ git" + pkgs="g++ git xz-utils" # Ubuntu 22+ has only Python 3 in the repos if [ -n "$osver" ] && [ "$osver" -ge "22" ]; then pkgs+=" python-is-python3 libpython3-dev" @@ -135,62 +140,31 @@ jobs: fi apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y $pkgs fi - # multiple job types are not compatible with ccache, they use "ccache: no" in the matrix + # For jobs not compatible with ccache, use "ccache: no" in the matrix if [[ "${{ matrix.ccache }}" == "no" ]]; then echo "B2_USE_CCACHE=0" >> $GITHUB_ENV fi git config --global pack.threads 0 - if [[ "${{matrix.container}}" == "ubuntu:16.04" ]] || [[ "${{matrix.container}}" == "ubuntu:18.04" ]]; then - # Ubuntu 16/18 can't run Node 20, so stick to older actions: https://github.com/actions/checkout/issues/1590 - echo "GHA_USE_NODE_20=false" >> $GITHUB_ENV - else - echo "GHA_USE_NODE_20=true" >> $GITHUB_ENV - fi - if [[ "${{ matrix.valgrind }}" == "yes" ]]; then - echo "B2_DEFINES=BOOST_NO_STRESS_TEST=1" >> $GITHUB_ENV - echo "B2_TESTFLAGS=testing.launcher=valgrind" >> $GITHUB_ENV - echo "B2_FLAGS=define=BOOST_USE_VALGRIND=1" >> $GITHUB_ENV - echo "VALGRIND_OPTS=--error-exitcode=1" >> $GITHUB_ENV + if [[ "${{matrix.container}}" == "ubuntu:1"* ]]; then + # Node 20 doesn't work with Ubuntu 16/18 glibc: https://github.com/actions/checkout/issues/1590 + curl -sL https://archives.boost.io/misc/node/node-v20.9.0-linux-x64-glibc-217.tar.xz | tar -xJ --strip-components 1 -C /node20217 fi - - uses: actions/checkout@v3 - if: env.GHA_USE_NODE_20 == 'false' - with: - # For coverage builds fetch the whole history, else only 1 commit using a 'fake ternary' - fetch-depth: ${{ matrix.coverage && '0' || '1' }} - uses: actions/checkout@v4 - if: env.GHA_USE_NODE_20 == 'true' with: # For coverage builds fetch the whole history, else only 1 commit using a 'fake ternary' fetch-depth: ${{ matrix.coverage && '0' || '1' }} - - name: Cache ccache - uses: actions/cache@v3 - if: env.B2_USE_CCACHE && env.GHA_USE_NODE_20 == 'false' - with: - path: ~/.ccache - key: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}-${{github.sha}} - restore-keys: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}- - - name: Cache ccache uses: actions/cache@v4 - if: env.B2_USE_CCACHE && env.GHA_USE_NODE_20 == 'true' + if: env.B2_USE_CCACHE with: path: ~/.ccache key: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}-${{github.sha}} restore-keys: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}- - - name: Fetch Boost.CI - uses: actions/checkout@v3 - if: env.GHA_USE_NODE_20 == 'false' - with: - repository: boostorg/boost-ci - ref: master - path: boost-ci-cloned - - name: Fetch Boost.CI uses: actions/checkout@v4 - if: env.GHA_USE_NODE_20 == 'true' with: repository: boostorg/boost-ci ref: master @@ -205,13 +179,15 @@ jobs: - name: Install packages if: startsWith(matrix.os, 'ubuntu') run: | - SOURCE_KEYS=(${{join(matrix.source_keys, ' ')}}) - SOURCES=(${{join(matrix.sources, ' ')}}) + SOURCE_KEYS=("${{join(matrix.source_keys, '" "')}}") + SOURCES=("${{join(matrix.sources, '" "')}}") # Add this by default SOURCE_KEYS+=('http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x1E9377A2BA9EF27F') SOURCES+=(ppa:ubuntu-toolchain-r/test) ci/add-apt-keys.sh "${SOURCE_KEYS[@]}" + # Initial update before adding sources required to get e.g. keys + sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update ci/add-apt-repositories.sh "${SOURCES[@]}" sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update @@ -240,18 +216,11 @@ jobs: - name: Setup multiarch if: matrix.multiarch - run: | - sudo apt-get install --no-install-recommends -y binfmt-support qemu-user-static - sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes - git clone https://github.com/jeking3/bdde.git - echo "$(pwd)/bdde/bin/linux" >> ${GITHUB_PATH} - echo "BDDE_DISTRO=${{ matrix.distro }}" >> ${GITHUB_ENV} - echo "BDDE_EDITION=${{ matrix.edition }}" >> ${GITHUB_ENV} - echo "BDDE_ARCH=${{ matrix.arch }}" >> ${GITHUB_ENV} - echo "B2_DEFINES=BOOST_NO_STRESS_TEST=1" >> ${GITHUB_ENV} - echo "B2_WRAPPER=bdde" >> ${GITHUB_ENV} - # Avoid: /usr/bin/windres: Can't detect architecture. - echo "B2_DONT_EMBED_MANIFEST=1" >> ${GITHUB_ENV} + env: + BDDE_DISTRO: ${{matrix.distro}} + BDDE_EDITION: ${{matrix.edition}} + BDDE_ARCH: ${{matrix.arch}} + run: ci/github/setup_bdde.sh - name: Setup Boost env: @@ -260,6 +229,13 @@ jobs: B2_CXXSTD: ${{matrix.cxxstd}} B2_SANITIZE: ${{matrix.sanitize}} B2_STDLIB: ${{matrix.stdlib}} + # More entries can be added in the same way, see the B2_ARGS assignment in ci/enforce.sh for the possible keys. + # B2_DEFINES: ${{matrix.defines}} + # Variables set here (to non-empty) will override the top-level environment variables, e.g. + # B2_VARIANT: ${{matrix.variant}} + # Set the (B2) target(s) to build, defaults to the test folder of the current library + # Can alternatively be done like this in the build step or in the build command of the build step, e.g. `run: B2_TARGETS=libs/$SELF/doc ci/build.sh` + # B2_TARGETS: libs/foo/test//bar run: source ci/github/install.sh - name: Setup coverage collection @@ -272,16 +248,15 @@ jobs: - name: Collect coverage if: matrix.coverage - run: ci/codecov.sh "upload" - env: - BOOST_CI_CODECOV_IO_UPLOAD: skip + run: ci/codecov.sh "collect" - name: Upload coverage if: matrix.coverage - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: + fail_ci_if_error: true disable_search: true - file: coverage.info + files: coverage.info name: Github Actions token: ${{secrets.CODECOV_TOKEN}} verbose: true @@ -307,7 +282,7 @@ jobs: - { name: Collect coverage, coverage: yes, toolset: msvc-14.3, cxxstd: 'latest', addrmd: '64', os: windows-2022 } - { toolset: clang-win, cxxstd: '14,17,latest', addrmd: '32,64', os: windows-2022 } - - { toolset: gcc, cxxstd: '11,14,17,2a', addrmd: '64', os: windows-2019 } + - { toolset: gcc, cxxstd: '11,14,17,2a', addrmd: '64', os: windows-2019 } runs-on: ${{matrix.os}} @@ -348,7 +323,7 @@ jobs: - name: Upload coverage if: matrix.coverage - uses: codecov/codecov-action@v4 + uses: codecov/codecov-action@v5 with: disable_search: true file: __out/cobertura.xml @@ -411,7 +386,7 @@ jobs: cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBOOST_INCLUDE_LIBRARIES=$SELF -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=ON -DBoost_VERBOSE=ON .. cmake --build . --target tests --config Debug -j$B2_JOBS ctest --output-on-failure --build-config Debug - + CMake: defaults: run: @@ -421,9 +396,9 @@ jobs: fail-fast: false matrix: include: - - { os: ubuntu-20.04, build_shared: ON, build_type: Release, generator: 'Unix Makefiles' } + - { os: ubuntu-20.04, build_shared: ON, build_type: Debug, generator: 'Unix Makefiles' } - { os: ubuntu-20.04, build_shared: OFF, build_type: Debug, generator: 'Unix Makefiles' } - - { os: windows-2019, build_shared: ON, build_type: Release, generator: 'Visual Studio 16 2019' } + - { os: windows-2019, build_shared: ON, build_type: Debug, generator: 'Visual Studio 16 2019' } - { os: windows-2019, build_shared: OFF, build_type: Debug, generator: 'Visual Studio 16 2019' } timeout-minutes: 120 @@ -431,27 +406,51 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Fetch Boost.CI uses: actions/checkout@v4 with: repository: boostorg/boost-ci ref: master path: boost-ci-cloned - - name: Get CI scripts folder run: | # Copy ci folder if not testing Boost.CI [[ "$GITHUB_REPOSITORY" =~ "boost-ci" ]] || cp -r boost-ci-cloned/ci . rm -rf boost-ci-cloned - - name: Setup Boost env: {B2_DONT_BOOTSTRAP: 1} run: source ci/github/install.sh - - name: Run CMake + - name: Run CMake tests run: | cd "$BOOST_ROOT" mkdir __build_cmake_test__ && cd __build_cmake_test__ cmake -G "${{matrix.generator}}" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBOOST_INCLUDE_LIBRARIES=$SELF -DBUILD_SHARED_LIBS=${{matrix.build_shared}} -DBUILD_TESTING=ON -DBoost_VERBOSE=ON .. - cmake --build . --config ${{matrix.build_type}} + cmake --build . --target tests --config ${{matrix.build_type}} -j$B2_JOBS + ctest --output-on-failure --build-config ${{matrix.build_type}} + + - name: Run CMake subdir tests + run: | + cmake_test_folder="$BOOST_ROOT/libs/$SELF/test/cmake_test" # New unified folder + [ -d "$cmake_test_folder" ] || cmake_test_folder="$BOOST_ROOT/libs/$SELF/test/cmake_subdir_test" + cd "$cmake_test_folder" + mkdir __build_cmake_subdir_test__ && cd __build_cmake_subdir_test__ + cmake -G "${{matrix.generator}}" -DBOOST_CI_INSTALL_TEST=OFF -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBUILD_SHARED_LIBS=${{matrix.build_shared}} .. + cmake --build . --config ${{matrix.build_type}} -j$B2_JOBS + ctest --output-on-failure --build-config ${{matrix.build_type}} + + - name: Install Library + run: | + cd "$BOOST_ROOT" + mkdir __build_cmake_install_test__ && cd __build_cmake_install_test__ + cmake -G "${{matrix.generator}}" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBOOST_INCLUDE_LIBRARIES=$SELF -DBUILD_SHARED_LIBS=${{matrix.build_shared}} -DCMAKE_INSTALL_PREFIX=~/.local -DBoost_VERBOSE=ON -DBoost_DEBUG=ON .. + cmake --build . --target install --config ${{matrix.build_type}} -j$B2_JOBS + - name: Run CMake install tests + run: | + cmake_test_folder="$BOOST_ROOT/libs/$SELF/test/cmake_test" # New unified folder + [ -d "$cmake_test_folder" ] || cmake_test_folder="$BOOST_ROOT/libs/$SELF/test/cmake_install_test" + cd "$cmake_test_folder" + mkdir __build_cmake_install_test__ && cd __build_cmake_install_test__ + cmake -G "${{matrix.generator}}" -DBOOST_CI_INSTALL_TEST=ON -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBUILD_SHARED_LIBS=${{matrix.build_shared}} -DCMAKE_PREFIX_PATH=~/.local .. + cmake --build . --config ${{matrix.build_type}} -j$B2_JOBS + ctest --output-on-failure --build-config ${{matrix.build_type}} diff --git a/README.md b/README.md index 16945065..4fc64960 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -Format, part of the collection of [Boost C++ Libraries](http://github.com/boostorg), provides a type-safe mechanism for formatting arguments according to a printf-like format-string. User-defined types are supported by providing a `std::ostream operator <<` implementation for them. +Format, part of the collection of [Boost C++ Libraries](https://github.com/boostorg), provides a type-safe mechanism for formatting arguments according to a printf-like format-string. User-defined types are supported by providing a `std::ostream operator <<` implementation for them. ### License -Distributed under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). +Distributed under the [Boost Software License, Version 1.0](https://www.boost.org/LICENSE_1_0.txt). ### Properties @@ -11,10 +11,11 @@ Distributed under the [Boost Software License, Version 1.0](http://www.boost.org ### Build Status -Branch | GHA CI | Appveyor | Coverity Scan | codecov.io | Deps | Docs | Tests | -:-------------: | ------ | -------- | ------------- | ---------- | ---- | ---- | ----- | -[`master`](https://github.com/boostorg/format/tree/master) | [![Build Status](https://github.com/boostorg/format/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/format/actions?query=branch:master) | [![Build status](https://ci.appveyor.com/api/projects/status/tkcumf8nu6tb697d/branch/master?svg=true)](https://ci.appveyor.com/project/jeking3/format-bhjc4/branch/master) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/14007/badge.svg)](https://scan.coverity.com/projects/boostorg-format) | [![codecov](https://codecov.io/gh/boostorg/format/branch/master/graph/badge.svg)](https://codecov.io/gh/boostorg/format/branch/master) | [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/format.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](https://www.boost.org/doc/libs/master/libs/format/) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](http://www.boost.org/development/tests/master/developer/format.html) -[`develop`](https://github.com/boostorg/format/tree/develop) | [![Build Status](https://github.com/boostorg/format/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/format/actions?query=branch:develop) | [![Build status](https://ci.appveyor.com/api/projects/status/tkcumf8nu6tb697d/branch/develop?svg=true)](https://ci.appveyor.com/project/jeking3/format-bhjc4/branch/develop) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/14007/badge.svg)](https://scan.coverity.com/projects/boostorg-format) | [![codecov](https://codecov.io/gh/boostorg/format/branch/develop/graph/badge.svg)](https://codecov.io/gh/boostorg/format/branch/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/format.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](https://www.boost.org/doc/libs/develop/libs/format/) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](http://www.boost.org/development/tests/develop/developer/format.html) + +| Branch | GHA CI | Appveyor | Coverity Scan | codecov.io | Deps | Docs | Tests | +| :-------------: | ------ | -------- | ------------- | ---------- | ---- | ---- | ----- | +| [`master`](https://github.com/boostorg/format/tree/master) | [![Build Status](https://github.com/boostorg/format/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/boostorg/format/actions?query=branch:master) | [![Build status](https://ci.appveyor.com/api/projects/status/aeg8obnkb0mrgqvd/branch/master?svg=true)](https://ci.appveyor.com/project/cppalliance/format/branch/master) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/14007/badge.svg)](https://scan.coverity.com/projects/boostorg-format) | [![codecov](https://codecov.io/gh/boostorg/format/branch/master/graph/badge.svg?token=)](https://codecov.io/gh/boostorg/format/tree/master) | [![Deps](https://img.shields.io/badge/deps-master-brightgreen.svg)](https://pdimov.github.io/boostdep-report/master/format.html) | [![Documentation](https://img.shields.io/badge/docs-master-brightgreen.svg)](https://www.boost.org/doc/libs/master/libs/format) | [![Enter the Matrix](https://img.shields.io/badge/matrix-master-brightgreen.svg)](https://www.boost.org/development/tests/master/developer/format.html) +| [`develop`](https://github.com/boostorg/format/tree/develop) | [![Build Status](https://github.com/boostorg/format/actions/workflows/ci.yml/badge.svg?branch=develop)](https://github.com/boostorg/format/actions?query=branch:develop) | [![Build status](https://ci.appveyor.com/api/projects/status/aeg8obnkb0mrgqvd/branch/develop?svg=true)](https://ci.appveyor.com/project/cppalliance/format/branch/develop) | [![Coverity Scan Build Status](https://scan.coverity.com/projects/14007/badge.svg)](https://scan.coverity.com/projects/boostorg-format) | [![codecov](https://codecov.io/gh/boostorg/format/branch/develop/graph/badge.svg?token=)](https://codecov.io/gh/boostorg/format/tree/develop) | [![Deps](https://img.shields.io/badge/deps-develop-brightgreen.svg)](https://pdimov.github.io/boostdep-report/develop/format.html) | [![Documentation](https://img.shields.io/badge/docs-develop-brightgreen.svg)](https://www.boost.org/doc/libs/develop/libs/format) | [![Enter the Matrix](https://img.shields.io/badge/matrix-develop-brightgreen.svg)](https://www.boost.org/development/tests/develop/developer/format.html) ### Directories @@ -29,8 +30,8 @@ Branch | GHA CI | Appveyor | Coverity Scan | codecov.io | Deps | Docs | ### More information -* [Ask questions](http://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-format): Be sure to read the documentation first as Boost.Format, like any other string formatting library, has its own rules. +* [Ask questions](https://stackoverflow.com/questions/ask?tags=c%2B%2B,boost,boost-format): Be sure to read the documentation first as Boost.Format, like any other string formatting library, has its own rules. * [Report bugs](https://github.com/boostorg/format/issues): Be sure to mention Boost version, platform and compiler you're using. A small compilable code sample to reproduce the problem is always good as well. -* [Submit Pull Requests](https://github.com/boostorg/format/pulls) against the **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](http://www.boost.org/LICENSE_1_0.txt). Be sure to include tests proving your changes work properly. -* Discussions about the library are held on the [Boost developers mailing list](http://www.boost.org/community/groups.html#main). Be sure to read the [discussion policy](http://www.boost.org/community/policy.html) before posting and add the `[format]` tag at the beginning of the subject line. +* [Submit Pull Requests](https://github.com/boostorg/format/pulls) against the **develop** branch. Note that by submitting patches you agree to license your modifications under the [Boost Software License, Version 1.0](https://www.boost.org/LICENSE_1_0.txt). Be sure to include tests proving your changes work properly. +* Discussions about the library are held on the [Boost developers mailing list](https://www.boost.org/community/groups.html#main). Be sure to read the [discussion policy](https://www.boost.org/community/policy.html) before posting and add the `[format]` tag at the beginning of the subject line. diff --git a/test/cmake_test/CMakeLists.txt b/test/cmake_test/CMakeLists.txt new file mode 100644 index 00000000..72af30c6 --- /dev/null +++ b/test/cmake_test/CMakeLists.txt @@ -0,0 +1,22 @@ +# Copyright 2021-2024 Alexander Grund +# 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 + +cmake_minimum_required(VERSION 3.5...3.16) + +project(cmake_subdir_test LANGUAGES CXX) + +# Those 2 should work the same +# while using find_package for the installed Boost avoids the need to manually specify dependencies +if(BOOST_CI_INSTALL_TEST) + find_package(boost_format REQUIRED) +else() + set(BOOST_INCLUDE_LIBRARIES format) + add_subdirectory(../../../.. deps/boost EXCLUDE_FROM_ALL) +endif() + +add_executable(main main.cpp) +target_link_libraries(main Boost::format) + +enable_testing() +add_test(NAME main COMMAND main) diff --git a/test/cmake_test/main.cpp b/test/cmake_test/main.cpp new file mode 100644 index 00000000..d259d233 --- /dev/null +++ b/test/cmake_test/main.cpp @@ -0,0 +1,42 @@ +// ------------------------------------------------------------------------------ +// libs/format/test/format_test1.cpp : test constructing objects and basic parsing +// ------------------------------------------------------------------------------ + +// Copyright Samuel Krempp 2003. Use, modification, and distribution are +// subject to 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) + +// See http://www.boost.org/libs/format for library home page + +// ------------------------------------------------------------------------------ + +#include +#include + +int main(int, char* []) +{ + using boost::format; + using boost::str; + + if(str( format(" %% ") ) != " % ") + BOOST_ERROR("Basic parsing without arguments Failed"); + if(str( format("nothing") ) != "nothing") + BOOST_ERROR("Basic parsing without arguments Failed"); + if(str( format("%% ") ) != "% ") + BOOST_ERROR("Basic parsing without arguments Failed"); + if(str( format(" %%") ) != " %") + BOOST_ERROR("Basic parsing without arguments Failed"); + if(str( format(" %n ") ) != " ") + BOOST_ERROR("Basic parsing without arguments Failed"); + if(str( format("%n ") ) != " ") + BOOST_ERROR("Basic parsing without arguments Failed"); + if(str( format(" %n") ) != " ") + BOOST_ERROR("Basic parsing without arguments Failed"); + + if(str( format("%%##%%##%%1 %1%00") % "Escaped OK" ) != "%##%##%1 Escaped OK00") + BOOST_ERROR("Basic parsing Failed"); + if(str( format("%%##%#x ##%%1 %s00") % 20 % "Escaped OK" ) != "%##0x14 ##%1 Escaped OK00") + BOOST_ERROR("Basic p-parsing Failed") ; + + return boost::report_errors(); +} From 66075102416bc5d0f8e0bd151a19013dadbf94ce Mon Sep 17 00:00:00 2001 From: "James E. King III" Date: Thu, 2 Jan 2025 11:49:51 +0000 Subject: [PATCH 10/12] Remove redundant condition This fixes #93 --- include/boost/format/alt_sstream_impl.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/boost/format/alt_sstream_impl.hpp b/include/boost/format/alt_sstream_impl.hpp index 05379dcb..e72e7d00 100644 --- a/include/boost/format/alt_sstream_impl.hpp +++ b/include/boost/format/alt_sstream_impl.hpp @@ -126,7 +126,7 @@ namespace boost { off += static_cast(putend_ - pptr()); else if(way == ::std::ios_base::beg) off += static_cast(pbase() - pptr()); - else if(way != ::std::ios_base::beg) + else return pos_type(off_type(-1)); if(pbase() <= off+pptr() && off+pptr() <= putend_) // set pptr From cc2b15f371e2de557ea480828efb619a7aea36c5 Mon Sep 17 00:00:00 2001 From: Alexander Grund Date: Tue, 11 Feb 2025 09:08:47 +0100 Subject: [PATCH 11/12] Replace deprecated argument for codecov action --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ceb0f325..80ad5807 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -326,7 +326,7 @@ jobs: uses: codecov/codecov-action@v5 with: disable_search: true - file: __out/cobertura.xml + files: __out/cobertura.xml name: Github Actions token: ${{secrets.CODECOV_TOKEN}} verbose: true From 3fb39d7deeb2a1b13765fe19358518a010ba66b7 Mon Sep 17 00:00:00 2001 From: "James E. King III" Date: Thu, 26 Jun 2025 19:58:03 -0400 Subject: [PATCH 12/12] Implement reusable Boost.CI workflow for GHA This will reduce maintenance burden going forward. --- .github/workflows/ci.yml | 459 ++------------------------------------- 1 file changed, 22 insertions(+), 437 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 80ad5807..e7e66682 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,12 +1,20 @@ +# # Copyright 2020-2021 Peter Dimov # Copyright 2021 Andrey Semashev -# Copyright 2021 Alexander Grund -# Copyright 2022 James E. King III +# Copyright 2021-2024 Alexander Grund +# Copyright 2022-2025 James E. King III # # 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) +# +# This workflow uses the Boost.CI reusable workflow which builds a variety of +# configurations of your project, runs tests, and generates code coverage reports. +# +# To use it, copy this file into your repository as `.github/workflows/ci.yml` and +# customize it appropriately. +# --- -name: CI +name: Boost.CI on: pull_request: @@ -18,439 +26,16 @@ on: - feature/** - fix/** - pr/** - -concurrency: - group: ${{format('{0}:{1}', github.repository, github.ref)}} - cancel-in-progress: true - -env: - GIT_FETCH_JOBS: 8 - NET_RETRY_COUNT: 5 - B2_CI_VERSION: 1 - B2_VARIANT: debug,release - B2_LINK: shared,static - LCOV_BRANCH_COVERAGE: 0 - CODECOV_NAME: Github Actions + paths-ignore: + - LICENSE + - meta/** + - README.md jobs: - posix: - defaults: - run: - shell: bash - - strategy: - fail-fast: false - matrix: - include: - # Linux, gcc - - { compiler: gcc-4.8, cxxstd: '11', os: ubuntu-latest, container: 'ubuntu:16.04' } - - { compiler: gcc-4.9, cxxstd: '11', os: ubuntu-latest, container: 'ubuntu:16.04' } - - { compiler: gcc-5, cxxstd: '11,14,1z', os: ubuntu-latest, container: 'ubuntu:18.04' } - - { compiler: gcc-6, cxxstd: '11,14,17', os: ubuntu-latest, container: 'ubuntu:18.04' } - - { compiler: gcc-7, cxxstd: '11,14,17', os: ubuntu-20.04 } - - { compiler: gcc-8, cxxstd: '11,14,17,2a', os: ubuntu-20.04 } - - { compiler: gcc-9, cxxstd: '11,14,17,2a', os: ubuntu-20.04 } - - { compiler: gcc-10, cxxstd: '11,14,17,20', os: ubuntu-22.04 } - - { compiler: gcc-11, cxxstd: '11,14,17,20', os: ubuntu-22.04 } - - { compiler: gcc-12, cxxstd: '11,14,17,20', os: ubuntu-22.04 } - - { compiler: gcc-13, cxxstd: '11,14,17,20,2b', os: ubuntu-24.04 } - - { compiler: gcc-14, cxxstd: '11,14,17,20,2b', os: ubuntu-24.04 } - - { name: GCC w/ sanitizers, sanitize: yes, - compiler: gcc-13, cxxstd: '11,14,17,20', os: ubuntu-24.04 } - - { name: Collect coverage, coverage: yes, - compiler: gcc-13, cxxstd: '2b', os: ubuntu-24.04, install: 'g++-13-multilib', address-model: '32,64' } - - # Linux, clang - - { compiler: clang-3.5, cxxstd: '11', os: ubuntu-latest, container: 'ubuntu:16.04' } - - { compiler: clang-3.6, cxxstd: '11,14', os: ubuntu-latest, container: 'ubuntu:16.04' } - - { compiler: clang-3.7, cxxstd: '11,14', os: ubuntu-latest, container: 'ubuntu:16.04' } - - { compiler: clang-3.8, cxxstd: '11,14', os: ubuntu-latest, container: 'ubuntu:16.04' } - - { compiler: clang-3.9, cxxstd: '11,14', os: ubuntu-latest, container: 'ubuntu:18.04' } - - { compiler: clang-4.0, cxxstd: '11,14', os: ubuntu-latest, container: 'ubuntu:18.04' } - - { compiler: clang-5.0, cxxstd: '11,14,1z', os: ubuntu-latest, container: 'ubuntu:18.04' } - - { compiler: clang-6.0, cxxstd: '11,14,17', os: ubuntu-20.04 } - - { compiler: clang-7, cxxstd: '11,14,17', os: ubuntu-20.04 } - # Note: clang-8 does not fully support C++20, so it is not compatible with some libstdc++ versions in this mode - - { compiler: clang-8, cxxstd: '11,14,17,2a', os: ubuntu-20.04 , install: 'clang-8 g++-7', gcc_toolchain: 7 } - - { compiler: clang-9, cxxstd: '11,14,17,2a', os: ubuntu-20.04 } - - { compiler: clang-10, cxxstd: '11,14,17,20', os: ubuntu-20.04 } - - { compiler: clang-11, cxxstd: '11,14,17,20', os: ubuntu-20.04 } - - { compiler: clang-12, cxxstd: '11,14,17,20', os: ubuntu-20.04 } - # Clang isn't compatible with libstdc++-13, so use the slightly older one - - { compiler: clang-13, cxxstd: '11,14,17,20', os: ubuntu-22.04, install: 'clang-13 g++-12', gcc_toolchain: 12 } - - { compiler: clang-14, cxxstd: '11,14,17,20', os: ubuntu-22.04, install: 'clang-14 g++-12', gcc_toolchain: 12 } - - { compiler: clang-15, cxxstd: '11,14,17,20', os: ubuntu-22.04, install: 'clang-15 g++-12', gcc_toolchain: 12 } - - { compiler: clang-16, cxxstd: '11,14,17,20,2b', os: ubuntu-24.04 } - # https://github.com/llvm/llvm-project/issues/59827: disabled 2b/23 for clang-17 with libstdc++13 in 24.04 - - { compiler: clang-17, cxxstd: '11,14,17,20', os: ubuntu-24.04 } - - { compiler: clang-18, cxxstd: '11,14,17,20,23,2c', os: ubuntu-24.04 } - - # libc++ - - { compiler: clang-6.0, cxxstd: '11,14', os: ubuntu-latest, container: 'ubuntu:18.04', stdlib: libc++, install: 'clang-6.0 libc++-dev libc++abi-dev' } - - { compiler: clang-7, cxxstd: '11,14,17', os: ubuntu-20.04, stdlib: libc++, install: 'clang-7 libc++-7-dev libc++abi-7-dev' } - - { name: Clang w/ sanitizers, sanitize: yes, - compiler: clang-12, cxxstd: '11,14,17,20', os: ubuntu-20.04, stdlib: libc++, install: 'clang-12 libc++-12-dev libc++abi-12-dev' } - - - { name: MacOS w/ clang and sanitizers, - compiler: clang, cxxstd: '11,14,17,20,2b', os: macos-13, sanitize: yes } - - { compiler: clang, cxxstd: '11,14,17,20,2b', os: macos-14 } - - { compiler: clang, cxxstd: '11,14,17,20,2b', os: macos-15 } - - # Coverity Scan - # requires two github secrets in repo to activate; see ci/github/coverity.sh - # does not run on pull requests, only on pushes into develop and master - - { name: Coverity, coverity: yes, - compiler: clang-12, cxxstd: '20', os: ubuntu-20.04, ccache: no } - - # multiarch (bigendian testing) - does not support coverage yet - - { name: Big-endian, multiarch: yes, - compiler: clang, cxxstd: '17', os: ubuntu-22.04, ccache: no, distro: fedora, edition: 34, arch: s390x } - - - timeout-minutes: 120 - runs-on: ${{matrix.os}} - container: - image: ${{matrix.container}} - volumes: - - /node20217:/node20217:rw,rshared - - ${{ startsWith(matrix.container, 'ubuntu:1') && '/node20217:/__e/node20:ro,rshared' || ' ' }} - env: {B2_USE_CCACHE: 1} - - steps: - - 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}}" ] && [ -f "/etc/debian_version" ]; then - apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y sudo software-properties-common curl - # Need (newer) git, and the older Ubuntu container may require requesting the key manually using port 80 - curl -sSL --retry ${NET_RETRY_COUNT:-5} 'http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xE1DD270288B4E6030699E45FA1715D88E1DF1F24' | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/git-core_ubuntu_ppa.gpg - for i in {1..${NET_RETRY_COUNT:-3}}; do sudo -E add-apt-repository -y ppa:git-core/ppa && break || sleep 10; done - apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - osver=$(lsb_release -sr | cut -f1 -d.) - pkgs="g++ git xz-utils" - # Ubuntu 22+ has only Python 3 in the repos - if [ -n "$osver" ] && [ "$osver" -ge "22" ]; then - pkgs+=" python-is-python3 libpython3-dev" - else - pkgs+=" python libpython-dev" - fi - apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y $pkgs - fi - # For jobs not compatible with ccache, use "ccache: no" in the matrix - if [[ "${{ matrix.ccache }}" == "no" ]]; then - echo "B2_USE_CCACHE=0" >> $GITHUB_ENV - fi - git config --global pack.threads 0 - if [[ "${{matrix.container}}" == "ubuntu:1"* ]]; then - # Node 20 doesn't work with Ubuntu 16/18 glibc: https://github.com/actions/checkout/issues/1590 - curl -sL https://archives.boost.io/misc/node/node-v20.9.0-linux-x64-glibc-217.tar.xz | tar -xJ --strip-components 1 -C /node20217 - fi - - - uses: actions/checkout@v4 - with: - # For coverage builds fetch the whole history, else only 1 commit using a 'fake ternary' - fetch-depth: ${{ matrix.coverage && '0' || '1' }} - - - name: Cache ccache - uses: actions/cache@v4 - if: env.B2_USE_CCACHE - with: - path: ~/.ccache - key: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}-${{github.sha}} - restore-keys: ${{matrix.os}}-${{matrix.container}}-${{matrix.compiler}}- - - - name: Fetch Boost.CI - uses: actions/checkout@v4 - with: - repository: boostorg/boost-ci - ref: master - path: boost-ci-cloned - - - name: Get CI scripts folder - run: | - # Copy ci folder if not testing Boost.CI - [[ "$GITHUB_REPOSITORY" =~ "boost-ci" ]] || cp -r boost-ci-cloned/ci . - rm -rf boost-ci-cloned - - - name: Install packages - if: startsWith(matrix.os, 'ubuntu') - run: | - SOURCE_KEYS=("${{join(matrix.source_keys, '" "')}}") - SOURCES=("${{join(matrix.sources, '" "')}}") - # Add this by default - SOURCE_KEYS+=('http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x1E9377A2BA9EF27F') - SOURCES+=(ppa:ubuntu-toolchain-r/test) - - ci/add-apt-keys.sh "${SOURCE_KEYS[@]}" - # Initial update before adding sources required to get e.g. keys - sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - ci/add-apt-repositories.sh "${SOURCES[@]}" - - sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT update - if [[ -z "${{matrix.install}}" ]]; then - pkgs="${{matrix.compiler}}" - pkgs="${pkgs/gcc-/g++-}" - else - pkgs="${{matrix.install}}" - fi - sudo apt-get -o Acquire::Retries=$NET_RETRY_COUNT install -y $pkgs - - - name: Setup GCC Toolchain - if: matrix.gcc_toolchain - run: | - GCC_TOOLCHAIN_ROOT="$HOME/gcc-toolchain" - echo "GCC_TOOLCHAIN_ROOT=$GCC_TOOLCHAIN_ROOT" >> $GITHUB_ENV - if ! command -v dpkg-architecture; then - apt-get install -y dpkg-dev - fi - 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 multiarch - if: matrix.multiarch - env: - BDDE_DISTRO: ${{matrix.distro}} - BDDE_EDITION: ${{matrix.edition}} - BDDE_ARCH: ${{matrix.arch}} - run: ci/github/setup_bdde.sh - - - name: Setup Boost - env: - B2_ADDRESS_MODEL: ${{matrix.address-model}} - B2_COMPILER: ${{matrix.compiler}} - B2_CXXSTD: ${{matrix.cxxstd}} - B2_SANITIZE: ${{matrix.sanitize}} - B2_STDLIB: ${{matrix.stdlib}} - # More entries can be added in the same way, see the B2_ARGS assignment in ci/enforce.sh for the possible keys. - # B2_DEFINES: ${{matrix.defines}} - # Variables set here (to non-empty) will override the top-level environment variables, e.g. - # B2_VARIANT: ${{matrix.variant}} - # Set the (B2) target(s) to build, defaults to the test folder of the current library - # Can alternatively be done like this in the build step or in the build command of the build step, e.g. `run: B2_TARGETS=libs/$SELF/doc ci/build.sh` - # B2_TARGETS: libs/foo/test//bar - run: source ci/github/install.sh - - - name: Setup coverage collection - if: matrix.coverage - run: ci/github/codecov.sh "setup" - - - name: Run tests - if: '!matrix.coverity' - run: ci/build.sh - - - name: Collect coverage - if: matrix.coverage - run: ci/codecov.sh "collect" - - - name: Upload coverage - if: matrix.coverage - uses: codecov/codecov-action@v5 - with: - fail_ci_if_error: true - disable_search: true - files: coverage.info - name: Github Actions - token: ${{secrets.CODECOV_TOKEN}} - verbose: true - - - name: Run coverity - if: matrix.coverity && github.event_name == 'push' && (github.ref_name == 'develop' || github.ref_name == 'master') - run: ci/github/coverity.sh - env: - COVERITY_SCAN_NOTIFICATION_EMAIL: ${{ secrets.COVERITY_SCAN_NOTIFICATION_EMAIL }} - COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} - - windows: - defaults: - run: - shell: cmd - strategy: - fail-fast: false - matrix: - include: - - { toolset: msvc-14.0, cxxstd: '14,latest', addrmd: '32,64', os: windows-2019 } - - { toolset: msvc-14.2, cxxstd: '14,17,20', addrmd: '32,64', os: windows-2019 } - - { toolset: msvc-14.3, cxxstd: '14,17,20,latest',addrmd: '32,64', os: windows-2022 } - - { name: Collect coverage, coverage: yes, - toolset: msvc-14.3, cxxstd: 'latest', addrmd: '64', os: windows-2022 } - - { toolset: clang-win, cxxstd: '14,17,latest', addrmd: '32,64', os: windows-2022 } - - { toolset: gcc, cxxstd: '11,14,17,2a', addrmd: '64', os: windows-2019 } - - runs-on: ${{matrix.os}} - - steps: - - uses: actions/checkout@v4 - - - name: Fetch Boost.CI - uses: actions/checkout@v4 - with: - repository: boostorg/boost-ci - ref: master - path: boost-ci-cloned - - name: Get CI scripts folder - run: | - REM Copy ci folder if not testing Boost.CI - if "%GITHUB_REPOSITORY%" == "%GITHUB_REPOSITORY:boost-ci=%" xcopy /s /e /q /i /y boost-ci-cloned\ci .\ci - rmdir /s /q boost-ci-cloned - - - name: Setup Boost - run: ci\github\install.bat - - - name: Run tests - if: '!matrix.coverage' - run: ci\build.bat - env: - B2_TOOLSET: ${{matrix.toolset}} - B2_CXXSTD: ${{matrix.cxxstd}} - B2_ADDRESS_MODEL: ${{matrix.addrmd}} - - - name: Collect coverage - shell: powershell - if: matrix.coverage - run: ci\opencppcoverage.ps1 - env: - B2_TOOLSET: ${{matrix.toolset}} - B2_CXXSTD: ${{matrix.cxxstd}} - B2_ADDRESS_MODEL: ${{matrix.addrmd}} - - - name: Upload coverage - if: matrix.coverage - uses: codecov/codecov-action@v5 - with: - disable_search: true - files: __out/cobertura.xml - name: Github Actions - token: ${{secrets.CODECOV_TOKEN}} - verbose: true - - MSYS2: - defaults: - run: - shell: msys2 {0} - strategy: - fail-fast: false - matrix: - include: - - { sys: MINGW32, compiler: gcc, cxxstd: '11,17,20' } - - { sys: MINGW64, compiler: gcc, cxxstd: '11,17,20' } - - runs-on: windows-latest - - steps: - - uses: actions/checkout@v4 - - - name: Setup MSYS2 environment - uses: msys2/setup-msys2@v2 - with: - msystem: ${{matrix.sys}} - update: true - install: git python - pacboy: gcc:p cmake:p ninja:p - - - name: Fetch Boost.CI - uses: actions/checkout@v4 - with: - repository: boostorg/boost-ci - ref: master - path: boost-ci-cloned - - name: Get CI scripts folder - run: | - # Copy ci folder if not testing Boost.CI - [[ "$GITHUB_REPOSITORY" =~ "boost-ci" ]] || cp -r boost-ci-cloned/ci . - rm -rf boost-ci-cloned - - - name: Setup Boost - env: - B2_COMPILER: ${{matrix.compiler}} - B2_CXXSTD: ${{matrix.cxxstd}} - B2_SANITIZE: ${{matrix.sanitize}} - B2_STDLIB: ${{matrix.stdlib}} - run: ci/github/install.sh - - - name: Run tests - run: ci/build.sh - - # Run also the CMake tests to avoid having to setup another matrix for CMake on MSYS - - name: Run CMake tests - run: | - cd "$BOOST_ROOT" - mkdir __build_cmake_test__ && cd __build_cmake_test__ - cmake -G Ninja -DCMAKE_BUILD_TYPE=Debug -DBOOST_INCLUDE_LIBRARIES=$SELF -DBUILD_SHARED_LIBS=ON -DBUILD_TESTING=ON -DBoost_VERBOSE=ON .. - cmake --build . --target tests --config Debug -j$B2_JOBS - ctest --output-on-failure --build-config Debug - - CMake: - defaults: - run: - shell: bash - - strategy: - fail-fast: false - matrix: - include: - - { os: ubuntu-20.04, build_shared: ON, build_type: Debug, generator: 'Unix Makefiles' } - - { os: ubuntu-20.04, build_shared: OFF, build_type: Debug, generator: 'Unix Makefiles' } - - { os: windows-2019, build_shared: ON, build_type: Debug, generator: 'Visual Studio 16 2019' } - - { os: windows-2019, build_shared: OFF, build_type: Debug, generator: 'Visual Studio 16 2019' } - - timeout-minutes: 120 - runs-on: ${{matrix.os}} - - steps: - - uses: actions/checkout@v4 - - name: Fetch Boost.CI - uses: actions/checkout@v4 - with: - repository: boostorg/boost-ci - ref: master - path: boost-ci-cloned - - name: Get CI scripts folder - run: | - # Copy ci folder if not testing Boost.CI - [[ "$GITHUB_REPOSITORY" =~ "boost-ci" ]] || cp -r boost-ci-cloned/ci . - rm -rf boost-ci-cloned - - name: Setup Boost - env: {B2_DONT_BOOTSTRAP: 1} - run: source ci/github/install.sh - - - name: Run CMake tests - run: | - cd "$BOOST_ROOT" - mkdir __build_cmake_test__ && cd __build_cmake_test__ - cmake -G "${{matrix.generator}}" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBOOST_INCLUDE_LIBRARIES=$SELF -DBUILD_SHARED_LIBS=${{matrix.build_shared}} -DBUILD_TESTING=ON -DBoost_VERBOSE=ON .. - cmake --build . --target tests --config ${{matrix.build_type}} -j$B2_JOBS - ctest --output-on-failure --build-config ${{matrix.build_type}} - - - name: Run CMake subdir tests - run: | - cmake_test_folder="$BOOST_ROOT/libs/$SELF/test/cmake_test" # New unified folder - [ -d "$cmake_test_folder" ] || cmake_test_folder="$BOOST_ROOT/libs/$SELF/test/cmake_subdir_test" - cd "$cmake_test_folder" - mkdir __build_cmake_subdir_test__ && cd __build_cmake_subdir_test__ - cmake -G "${{matrix.generator}}" -DBOOST_CI_INSTALL_TEST=OFF -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBUILD_SHARED_LIBS=${{matrix.build_shared}} .. - cmake --build . --config ${{matrix.build_type}} -j$B2_JOBS - ctest --output-on-failure --build-config ${{matrix.build_type}} - - - name: Install Library - run: | - cd "$BOOST_ROOT" - mkdir __build_cmake_install_test__ && cd __build_cmake_install_test__ - cmake -G "${{matrix.generator}}" -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBOOST_INCLUDE_LIBRARIES=$SELF -DBUILD_SHARED_LIBS=${{matrix.build_shared}} -DCMAKE_INSTALL_PREFIX=~/.local -DBoost_VERBOSE=ON -DBoost_DEBUG=ON .. - cmake --build . --target install --config ${{matrix.build_type}} -j$B2_JOBS - - name: Run CMake install tests - run: | - cmake_test_folder="$BOOST_ROOT/libs/$SELF/test/cmake_test" # New unified folder - [ -d "$cmake_test_folder" ] || cmake_test_folder="$BOOST_ROOT/libs/$SELF/test/cmake_install_test" - cd "$cmake_test_folder" - mkdir __build_cmake_install_test__ && cd __build_cmake_install_test__ - cmake -G "${{matrix.generator}}" -DBOOST_CI_INSTALL_TEST=ON -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DBUILD_SHARED_LIBS=${{matrix.build_shared}} -DCMAKE_PREFIX_PATH=~/.local .. - cmake --build . --config ${{matrix.build_type}} -j$B2_JOBS - ctest --output-on-failure --build-config ${{matrix.build_type}} + call-boost-ci: + name: Run Boost.CI + uses: boostorg/boost-ci/.github/workflows/reusable.yml@master + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + COVERITY_SCAN_NOTIFICATION_EMAIL: ${{ secrets.COVERITY_SCAN_NOTIFICATION_EMAIL }} + COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}