mirror of
https://github.com/boostorg/system.git
synced 2025-12-25 16:28:05 +01:00
Compare commits
59 Commits
feature/is
...
feature/dr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a10db59a82 | ||
|
|
0075b27457 | ||
|
|
a24ef0c664 | ||
|
|
21029dbecd | ||
|
|
73815f85a0 | ||
|
|
d8e86f3a85 | ||
|
|
c0bc88f17f | ||
|
|
1b5a62e04e | ||
|
|
3851632a6d | ||
|
|
66282c723d | ||
|
|
7e6d2eee90 | ||
|
|
b75a62c745 | ||
|
|
5f42eb2501 | ||
|
|
17e9ee880b | ||
|
|
6f6cf7fd00 | ||
|
|
21ae6f45bc | ||
|
|
d31781ed9c | ||
|
|
fd2029714c | ||
|
|
b3ce404352 | ||
|
|
8eff646954 | ||
|
|
bc07ab1e25 | ||
|
|
c6bff94709 | ||
|
|
ae079810be | ||
|
|
928de55563 | ||
|
|
442138de0a | ||
|
|
de610efd53 | ||
|
|
4b143cdacc | ||
|
|
a1cb578f52 | ||
|
|
96b5073b79 | ||
|
|
2bff5c7071 | ||
|
|
137128176d | ||
|
|
e0e0f56eae | ||
|
|
58d55a67e5 | ||
|
|
34dcb59ee8 | ||
|
|
33f6ecba31 | ||
|
|
23fbfb1ffa | ||
|
|
5366407135 | ||
|
|
72a79b1dcb | ||
|
|
a5c1ab042e | ||
|
|
c2beb75d66 | ||
|
|
54d9f4f38a | ||
|
|
b92be6417a | ||
|
|
245fff8af3 | ||
|
|
c359af3141 | ||
|
|
50cad72fac | ||
|
|
9554d8bbd3 | ||
|
|
cf9d986871 | ||
|
|
a5d68e52e6 | ||
|
|
9c6a09f41d | ||
|
|
b9c26b9fa0 | ||
|
|
2e2430c4fa | ||
|
|
4b1caad727 | ||
|
|
5b96abbaa8 | ||
|
|
2e1c800d82 | ||
|
|
04a79d710f | ||
|
|
5700936367 | ||
|
|
86b031cab9 | ||
|
|
204e65f725 | ||
|
|
a688d7834a |
253
.drone.jsonnet
Normal file
253
.drone.jsonnet
Normal file
@@ -0,0 +1,253 @@
|
||||
# Copyright 2022 Peter Dimov
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
local library = "system";
|
||||
|
||||
local triggers =
|
||||
{
|
||||
branch: [ "master", "develop", "feature/*" ]
|
||||
};
|
||||
|
||||
local ubsan = { UBSAN: '1', UBSAN_OPTIONS: 'print_stacktrace=1' };
|
||||
local asan = { ASAN: '1' };
|
||||
|
||||
local linux_pipeline(name, image, environment, packages = "", sources = [], arch = "amd64") =
|
||||
{
|
||||
name: name,
|
||||
kind: "pipeline",
|
||||
type: "docker",
|
||||
trigger: triggers,
|
||||
platform:
|
||||
{
|
||||
os: "linux",
|
||||
arch: arch
|
||||
},
|
||||
steps:
|
||||
[
|
||||
{
|
||||
name: "everything",
|
||||
image: image,
|
||||
environment: environment,
|
||||
commands:
|
||||
[
|
||||
'set -e',
|
||||
'wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -',
|
||||
] +
|
||||
(if sources != [] then [ ('apt-add-repository "' + source + '"') for source in sources ] else []) +
|
||||
(if packages != "" then [ 'apt-get update', 'apt-get -y install ' + packages ] else []) +
|
||||
[
|
||||
'export LIBRARY=' + library,
|
||||
'./.drone/drone.sh',
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
local macos_pipeline(name, environment, xcode_version = "12.2", osx_version = "catalina", arch = "amd64") =
|
||||
{
|
||||
name: name,
|
||||
kind: "pipeline",
|
||||
type: "exec",
|
||||
trigger: triggers,
|
||||
platform: {
|
||||
"os": "darwin",
|
||||
"arch": arch
|
||||
},
|
||||
node: {
|
||||
"os": osx_version
|
||||
},
|
||||
steps: [
|
||||
{
|
||||
name: "everything",
|
||||
environment: environment + { "DEVELOPER_DIR": "/Applications/Xcode-" + xcode_version + ".app/Contents/Developer" },
|
||||
commands:
|
||||
[
|
||||
'export LIBRARY=' + library,
|
||||
'./.drone/drone.sh',
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
local windows_pipeline(name, image, environment, arch = "amd64") =
|
||||
{
|
||||
name: name,
|
||||
kind: "pipeline",
|
||||
type: "docker",
|
||||
trigger: triggers,
|
||||
platform:
|
||||
{
|
||||
os: "windows",
|
||||
arch: arch
|
||||
},
|
||||
"steps":
|
||||
[
|
||||
{
|
||||
name: "everything",
|
||||
image: image,
|
||||
environment: environment,
|
||||
commands:
|
||||
[
|
||||
'cmd /C .drone\\\\drone.bat ' + library,
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
[
|
||||
linux_pipeline(
|
||||
"Linux 14.04 GCC 4.4",
|
||||
"cppalliance/droneubuntu1404:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-4.4', CXXSTD: '98,0x' },
|
||||
"g++-4.4",
|
||||
[ "ppa:ubuntu-toolchain-r/test" ],
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 14.04 GCC 4.6",
|
||||
"cppalliance/droneubuntu1404:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-4.6', CXXSTD: '98,0x' },
|
||||
"g++-4.6",
|
||||
[ "ppa:ubuntu-toolchain-r/test" ],
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 14.04 GCC 4.7",
|
||||
"cppalliance/droneubuntu1404:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-4.7', CXXSTD: '98,0x' },
|
||||
"g++-4.7",
|
||||
[ "ppa:ubuntu-toolchain-r/test" ],
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 14.04 GCC 4.8*",
|
||||
"cppalliance/droneubuntu1404:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11' },
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 14.04 GCC 4.9",
|
||||
"cppalliance/droneubuntu1404:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-4.9', CXXSTD: '03,11' },
|
||||
"g++-4.9",
|
||||
[ "ppa:ubuntu-toolchain-r/test" ],
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 16.04 GCC 5*",
|
||||
"cppalliance/droneubuntu1604:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11,14' },
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 18.04 GCC 6",
|
||||
"cppalliance/droneubuntu1804:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-6', CXXSTD: '03,11,14' },
|
||||
"g++-6",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 18.04 GCC 7* 32/64",
|
||||
"cppalliance/droneubuntu1804:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11,14,17', ADDRMD: '32,64' },
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 18.04 GCC 8",
|
||||
"cppalliance/droneubuntu1804:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-8', CXXSTD: '03,11,14,17' },
|
||||
"g++-8",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 20.04 GCC 9* 32",
|
||||
"cppalliance/droneubuntu2004:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11,14,17,2a', ADDRMD: '32' },
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 20.04 GCC 9* 64",
|
||||
"cppalliance/droneubuntu2004:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11,14,17,2a', ADDRMD: '64' },
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 20.04 GCC 9 ARM64 32/64",
|
||||
"cppalliance/droneubuntu2004:multiarch",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++', CXXSTD: '03,11,14,17,2a', ADDRMD: '32,64' },
|
||||
arch="arm64",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 20.04 GCC 10 32 ASAN",
|
||||
"cppalliance/droneubuntu2004:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-10', CXXSTD: '03,11,14,17,20', ADDRMD: '32' } + asan,
|
||||
"g++-10-multilib",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 20.04 GCC 10 64 ASAN",
|
||||
"cppalliance/droneubuntu2004:1",
|
||||
{ TOOLSET: 'gcc', COMPILER: 'g++-10', CXXSTD: '03,11,14,17,20', ADDRMD: '64' } + asan,
|
||||
"g++-10-multilib",
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 20.04 Clang 13",
|
||||
"cppalliance/droneubuntu2004:1",
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++-13', CXXSTD: '03,11,14,17,20' },
|
||||
"clang-13",
|
||||
["deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main"],
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 20.04 Clang 14 UBSAN",
|
||||
"cppalliance/droneubuntu2004:1",
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++-14', CXXSTD: '03,11,14,17,20' } + ubsan,
|
||||
"clang-14",
|
||||
["deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main"],
|
||||
),
|
||||
|
||||
linux_pipeline(
|
||||
"Linux 20.04 Clang 14 ASAN",
|
||||
"cppalliance/droneubuntu2004:1",
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++-14', CXXSTD: '03,11,14,17,20' } + asan,
|
||||
"clang-14",
|
||||
["deb http://apt.llvm.org/focal/ llvm-toolchain-focal-14 main"],
|
||||
),
|
||||
|
||||
macos_pipeline(
|
||||
"MacOS 10.15 Xcode 12.2 UBSAN",
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,1z' } + ubsan,
|
||||
),
|
||||
|
||||
macos_pipeline(
|
||||
"MacOS 10.15 Xcode 12.2 ASAN",
|
||||
{ TOOLSET: 'clang', COMPILER: 'clang++', CXXSTD: '03,11,14,1z' } + asan,
|
||||
),
|
||||
|
||||
windows_pipeline(
|
||||
"Windows VS2015 msvc-14.0",
|
||||
"cppalliance/dronevs2015",
|
||||
{ TOOLSET: 'msvc-14.0', CXXSTD: '14,latest' },
|
||||
),
|
||||
|
||||
windows_pipeline(
|
||||
"Windows VS2017 msvc-14.1",
|
||||
"cppalliance/dronevs2017",
|
||||
{ TOOLSET: 'msvc-14.1', CXXSTD: '14,17,latest' },
|
||||
),
|
||||
|
||||
windows_pipeline(
|
||||
"Windows VS2019 msvc-14.2",
|
||||
"cppalliance/dronevs2019",
|
||||
{ TOOLSET: 'msvc-14.2', CXXSTD: '14,17,20,latest' },
|
||||
),
|
||||
|
||||
windows_pipeline(
|
||||
"Windows VS2022 msvc-14.3",
|
||||
"cppalliance/dronevs2022:1",
|
||||
{ TOOLSET: 'msvc-14.3', CXXSTD: '14,17,20,latest' },
|
||||
),
|
||||
]
|
||||
32
.drone.star
Normal file
32
.drone.star
Normal file
@@ -0,0 +1,32 @@
|
||||
# Copyright 2020 Rene Rivera
|
||||
# Copyright 2022 Peter Dimov
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
globalenv={ 'UBSAN_OPTIONS': 'print_stacktrace=1' }
|
||||
|
||||
def main(ctx):
|
||||
return [
|
||||
linux_cxx("GCC 4.4 14.04", "", packages="g++-4.4", buildscript="drone", image="cppalliance/droneubuntu1404:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-4.4', 'CXXSTD': '98,0x'}, globalenv=globalenv),
|
||||
linux_cxx("GCC 4.6 14.04", "", packages="g++-4.6", buildscript="drone", image="cppalliance/droneubuntu1404:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-4.6', 'CXXSTD': '03,0x'}, globalenv=globalenv),
|
||||
linux_cxx("GCC 4.8* 14.04", "", packages="g++-multilib", buildscript="drone", image="cppalliance/droneubuntu1404:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++', 'CXXSTD': '03,11', 'ADDRMD': '32,64'}, globalenv=globalenv),
|
||||
linux_cxx("GCC 4.9 14.04", "", packages="g++-4.9", buildscript="drone", image="cppalliance/droneubuntu1404:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-4.9', 'CXXSTD': '03,11'}, globalenv=globalenv),
|
||||
linux_cxx("GCC 5* 16.04", "", packages="g++-multilib", buildscript="drone", image="cppalliance/droneubuntu1604:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++', 'CXXSTD': '03,11,14', 'ADDRMD': '32,64'}, globalenv=globalenv),
|
||||
linux_cxx("GCC 6 16.04", "", packages="g++-6", buildscript="drone", image="cppalliance/droneubuntu1604:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-6', 'CXXSTD': '03,11'}, globalenv=globalenv),
|
||||
linux_cxx("GCC 7* 18.04", "", packages="g++-multilib", buildscript="drone", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++', 'CXXSTD': '03,11,14,1z', 'ADDRMD': '32,64'}, globalenv=globalenv),
|
||||
linux_cxx("GCC 8 18.04", "", packages="g++-8", buildscript="drone", image="cppalliance/droneubuntu1804:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++-8', 'CXXSTD': '03,11,14,1z'}, globalenv=globalenv),
|
||||
linux_cxx("GCC 9* 20.04", "", packages="g++-multilib", buildscript="drone", image="cppalliance/droneubuntu2004:1", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++', 'CXXSTD': '03,11,14,17,2a', 'ADDRMD': '32,64'}, globalenv=globalenv),
|
||||
#linux_cxx("GCC 9* 20.04 UBSAN", "", packages="", buildscript="drone", image="cppalliance/droneubuntu2004:1", environment={'UBSAN': 1, 'TOOLSET': 'gcc', 'COMPILER': 'g++', 'CXXSTD': '03,11,14,17,2a', 'LINKFLAGS': '-fuse-ld=gold'}, globalenv=globalenv),
|
||||
linux_cxx("GCC 9* 20.04 ARM64", "", packages="", buildscript="drone", image="cppalliance/droneubuntu2004:multiarch", arch="arm64", environment={'TOOLSET': 'gcc', 'COMPILER': 'g++', 'CXXSTD': '03,11,14,17,2a', 'ADDRMD': '32,64'}, globalenv=globalenv),
|
||||
#linux_cxx("Clang 3.4 14.04", "", packages="clang-3.4", buildscript="drone", image="cppalliance/droneubuntu1404:1", environment={'TOOLSET': 'clang', 'COMPILER': '/usr/bin/clang++', 'CXXSTD': '03,11'}, globalenv=globalenv),
|
||||
linux_cxx("Clang 13 20.04 UBSAN", "", packages="clang-13", llvm_os="focal", llvm_ver="13", buildscript="drone", image="cppalliance/droneubuntu2004:1", environment={'UBSAN': '1', 'TOOLSET': 'clang', 'COMPILER': 'clang++-13', 'CXXSTD': '03,11,14,17,20'}, globalenv=globalenv),
|
||||
linux_cxx("Clang 14 20.04 UBSAN", "", packages="clang-14", llvm_os="focal", llvm_ver="14", buildscript="drone", image="cppalliance/droneubuntu2004:1", environment={'UBSAN': '1', 'TOOLSET': 'clang', 'COMPILER': 'clang++-14', 'CXXSTD': '03,11,14,17,20'}, globalenv=globalenv),
|
||||
osx_cxx("Xcode 12.2 UBSAN", "", packages="", buildtype="boost", buildscript="drone", xcode_version="12.2", environment={'UBSAN': '1', 'TOOLSET': 'clang', 'COMPILER': 'clang++', 'CXXSTD': '03,11,14,1z'}, globalenv=globalenv),
|
||||
windows_cxx("msvc-14.0", "", image="cppalliance/dronevs2015", buildscript="drone", environment={"TOOLSET": "msvc-14.0", "CXXSTD": "14,latest"}, globalenv=globalenv),
|
||||
windows_cxx("msvc-14.1", "", image="cppalliance/dronevs2017", buildscript="drone", environment={"TOOLSET": "msvc-14.1", "CXXSTD": "14,17,latest"}, globalenv=globalenv),
|
||||
windows_cxx("msvc-14.2", "", image="cppalliance/dronevs2019", buildscript="drone", environment={"TOOLSET": "msvc-14.2", "CXXSTD": "14,17,20,latest"}, globalenv=globalenv),
|
||||
windows_cxx("msvc-14.3", "", image="cppalliance/dronevs2022:1", buildscript="drone", environment={"TOOLSET": "msvc-14.3", "CXXSTD": "14,17,20,latest"}, globalenv=globalenv)
|
||||
]
|
||||
|
||||
# from https://github.com/boostorg/boost-ci
|
||||
load("@boost_ci//ci/drone/:functions.star", "linux_cxx", "windows_cxx", "osx_cxx")
|
||||
23
.drone/drone.bat
Normal file
23
.drone/drone.bat
Normal file
@@ -0,0 +1,23 @@
|
||||
@REM Copyright 2022 Peter Dimov
|
||||
@REM Distributed under the Boost Software License, Version 1.0.
|
||||
@REM https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
@ECHO ON
|
||||
|
||||
set LIBRARY=%1
|
||||
set DRONE_BUILD_DIR=%CD%
|
||||
|
||||
set BOOST_BRANCH=develop
|
||||
if "%DRONE_BRANCH%" == "master" set BOOST_BRANCH=master
|
||||
cd ..
|
||||
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||
cd boost-root
|
||||
git submodule update --init tools/boostdep
|
||||
xcopy /s /e /q %DRONE_BUILD_DIR% libs\%LIBRARY%\
|
||||
python tools/boostdep/depinst/depinst.py %LIBRARY%
|
||||
cmd /c bootstrap
|
||||
b2 -d0 headers
|
||||
|
||||
if not "%CXXSTD%" == "" set CXXSTD=cxxstd=%CXXSTD%
|
||||
if not "%ADDRMD%" == "" set ADDRMD=address-model=%ADDRMD%
|
||||
b2 -j3 libs/%LIBRARY%/test toolset=%TOOLSET% %CXXSTD% %ADDRMD% variant=debug,release embed-manifest-via=linker
|
||||
24
.drone/drone.sh
Executable file
24
.drone/drone.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Copyright 2022 Peter Dimov
|
||||
# Distributed under the Boost Software License, Version 1.0.
|
||||
# https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
set -ex
|
||||
|
||||
DRONE_BUILD_DIR=$(pwd)
|
||||
|
||||
BOOST_BRANCH=develop
|
||||
if [ "$DRONE_BRANCH" = "master" ]; then BOOST_BRANCH=master; fi
|
||||
|
||||
cd ..
|
||||
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||
cd boost-root
|
||||
git submodule update --init tools/boostdep
|
||||
cp -r $DRONE_BUILD_DIR/* libs/$LIBRARY
|
||||
python tools/boostdep/depinst/depinst.py $LIBRARY
|
||||
./bootstrap.sh
|
||||
./b2 -d0 headers
|
||||
|
||||
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
|
||||
./b2 -j3 libs/$LIBRARY/test toolset=$TOOLSET cxxstd=$CXXSTD variant=debug,release ${ADDRMD:+address-model=$ADDRMD} ${UBSAN:+undefined-sanitizer=norecover debug-symbols=on} ${ASAN:+address-sanitizer=norecover debug-symbols=on} ${LINKFLAGS:+linkflags=$LINKFLAGS}
|
||||
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
@@ -144,15 +144,23 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- toolset: msvc-14.0
|
||||
cxxstd: "14"
|
||||
addrmd: 32,64
|
||||
os: windows-2019
|
||||
- toolset: msvc-14.1
|
||||
cxxstd: "14,17,latest"
|
||||
addrmd: 32,64
|
||||
os: windows-2016
|
||||
- toolset: msvc-14.2
|
||||
cxxstd: "14,17,latest"
|
||||
cxxstd: "14,17,20,latest"
|
||||
addrmd: 32,64
|
||||
os: windows-2019
|
||||
- toolset: msvc-14.3
|
||||
cxxstd: "14,17,20,latest"
|
||||
addrmd: 32,64
|
||||
os: windows-2022
|
||||
- toolset: clang-win
|
||||
cxxstd: "14,17,latest"
|
||||
addrmd: 32,64
|
||||
os: windows-2022
|
||||
@@ -192,7 +200,7 @@ jobs:
|
||||
shell: cmd
|
||||
run: |
|
||||
cd ../boost-root
|
||||
b2 -j3 libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release
|
||||
b2 -j3 libs/%LIBRARY%/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} address-model=${{matrix.addrmd}} variant=debug,release embed-manifest-via=linker
|
||||
|
||||
posix-cmake-subdir:
|
||||
strategy:
|
||||
|
||||
10
appveyor.yml
10
appveyor.yml
@@ -22,20 +22,12 @@ environment:
|
||||
ADDRMD: 32,64
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
TOOLSET: msvc-14.1
|
||||
CXXSTD: 14,17
|
||||
ADDRMD: 32,64
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
|
||||
TOOLSET: clang-win
|
||||
CXXSTD: 14,17
|
||||
ADDRMD: 64
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
TOOLSET: msvc-14.2
|
||||
CXXSTD: 14,17,latest
|
||||
ADDRMD: 32,64
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
|
||||
TOOLSET: clang-win
|
||||
CXXSTD: 14,17,latest
|
||||
ADDRMD: 64
|
||||
ADDRMD: 32,64
|
||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||
ADDPATH: C:\cygwin\bin;
|
||||
TOOLSET: gcc
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
////
|
||||
Copyright 2018-2021 Peter Dimov
|
||||
Copyright 2018-2022 Peter Dimov
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
https://www.boost.org/LICENSE_1_0.txt
|
||||
////
|
||||
@@ -8,6 +8,13 @@ https://www.boost.org/LICENSE_1_0.txt
|
||||
# Revision History
|
||||
:idprefix:
|
||||
|
||||
## Changes in Boost 1.79
|
||||
|
||||
* Added a `throw_exception_from_error` overload for `std::error_code`.
|
||||
* Added a `boost::source_location` parameter to `throw_exception_from_error`.
|
||||
* `result<T>::value` now automatically supplies `BOOST_CURRENT_LOCATION` to
|
||||
`throw_exception_from_error` via a default argument.
|
||||
|
||||
## Changes in Boost 1.78
|
||||
|
||||
* Added support for source locations to `error_code`.
|
||||
|
||||
@@ -14,6 +14,6 @@ http://www.boost.org/LICENSE_1_0.txt
|
||||
This documentation is
|
||||
|
||||
* Copyright 2003-2017 Beman Dawes
|
||||
* Copyright 2018-2021 Peter Dimov
|
||||
* Copyright 2018-2022 Peter Dimov
|
||||
|
||||
and is distributed under the http://www.boost.org/LICENSE_1_0.txt[Boost Software License, Version 1.0].
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
////
|
||||
Copyright 2003-2017 Beman Dawes
|
||||
Copyright 2018-2021 Peter Dimov
|
||||
Copyright 2018-2022 Peter Dimov
|
||||
|
||||
Distributed under the Boost Software License, Version 1.0.
|
||||
|
||||
@@ -1454,7 +1454,11 @@ namespace system {
|
||||
|
||||
// throw_exception_from_error
|
||||
|
||||
BOOST_NORETURN inline void throw_exception_from_error( error_code const & e );
|
||||
BOOST_NORETURN inline void throw_exception_from_error( error_code const & e,
|
||||
boost::source_location const & loc );
|
||||
|
||||
BOOST_NORETURN inline void throw_exception_from_error( std::error_code const & e,
|
||||
boost::source_location const & loc );
|
||||
|
||||
// in_place_*
|
||||
|
||||
@@ -1486,13 +1490,24 @@ If `result<T, E>` is used with other error types, the user is expected to provid
|
||||
an appropriate overload of `throw_exception_from_error` in the namespace of `E`.
|
||||
|
||||
```
|
||||
BOOST_NORETURN inline void throw_exception_from_error( error_code const & e );
|
||||
BOOST_NORETURN inline void throw_exception_from_error( error_code const & e,
|
||||
boost::source_location const & loc );
|
||||
```
|
||||
[none]
|
||||
* {blank}
|
||||
+
|
||||
Effects: ::
|
||||
`boost::throw_exception( system_error( e ) )`.
|
||||
`boost::throw_exception( system_error( e ), loc )`.
|
||||
|
||||
```
|
||||
BOOST_NORETURN inline void throw_exception_from_error( std::error_code const & e,
|
||||
boost::source_location const & loc );
|
||||
```
|
||||
[none]
|
||||
* {blank}
|
||||
+
|
||||
Effects: ::
|
||||
`boost::throw_exception( std::system_error( e ), loc )`.
|
||||
|
||||
### result<T, E>
|
||||
|
||||
@@ -1528,10 +1543,17 @@ public:
|
||||
|
||||
// checked value access
|
||||
|
||||
constexpr T& value() & ;
|
||||
constexpr T const& value() const& ;
|
||||
constexpr T&& value() && ;
|
||||
constexpr T const&& value() const&& ;
|
||||
constexpr T& value( boost::source_location const & loc =
|
||||
BOOST_CURRENT_LOCATION ) & ;
|
||||
|
||||
constexpr T const& value( boost::source_location const & loc =
|
||||
BOOST_CURRENT_LOCATION ) const& ;
|
||||
|
||||
constexpr T&& value( boost::source_location const & loc =
|
||||
BOOST_CURRENT_LOCATION ) && ;
|
||||
|
||||
constexpr T const&& value( boost::source_location const & loc =
|
||||
BOOST_CURRENT_LOCATION ) const&& ;
|
||||
|
||||
// unchecked value access
|
||||
|
||||
@@ -1653,10 +1675,17 @@ Returns: ::
|
||||
#### Checked Value Access
|
||||
|
||||
```
|
||||
constexpr T& value() & ;
|
||||
constexpr T const& value() const& ;
|
||||
constexpr T&& value() && ;
|
||||
constexpr T const&& value() const&& ;
|
||||
constexpr T& value(
|
||||
boost::source_location const & loc = BOOST_CURRENT_LOCATION ) & ;
|
||||
|
||||
constexpr T const& value(
|
||||
boost::source_location const & loc = BOOST_CURRENT_LOCATION ) const& ;
|
||||
|
||||
constexpr T&& value(
|
||||
boost::source_location const & loc = BOOST_CURRENT_LOCATION ) && ;
|
||||
|
||||
constexpr T const&& value(
|
||||
boost::source_location const & loc = BOOST_CURRENT_LOCATION ) const&& ;
|
||||
```
|
||||
[none]
|
||||
* {blank}
|
||||
@@ -1664,7 +1693,7 @@ constexpr T const&& value() const&& ;
|
||||
Effects: ::
|
||||
If `*this` holds a value, returns a reference to it. Otherwise,
|
||||
calls `throw_exception_from_error`, passing it a reference to
|
||||
the held error.
|
||||
the held error, and `loc`.
|
||||
|
||||
#### Unchecked Value Access
|
||||
|
||||
@@ -1799,7 +1828,8 @@ public:
|
||||
|
||||
// checked value access
|
||||
|
||||
constexpr void value() const;
|
||||
constexpr void value( boost::source_location const & loc =
|
||||
BOOST_CURRENT_LOCATION ) const;
|
||||
|
||||
// unchecked value access
|
||||
|
||||
@@ -1912,14 +1942,15 @@ Returns: ::
|
||||
#### Checked Value Access
|
||||
|
||||
```
|
||||
constexpr void value() const;
|
||||
constexpr void value(
|
||||
boost::source_location const & loc = BOOST_CURRENT_LOCATION ) const;
|
||||
```
|
||||
[none]
|
||||
* {blank}
|
||||
+
|
||||
Effects: ::
|
||||
If `*this` doesn't hold a value, calls `throw_exception_from_error`,
|
||||
passing it a reference to the held error.
|
||||
passing it a reference to the held error, and `loc`.
|
||||
|
||||
#### Unchecked Value Access
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef BOOST_SYSTEM_DETAIL_CONFIG_HPP_INCLUDED
|
||||
#define BOOST_SYSTEM_DETAIL_CONFIG_HPP_INCLUDED
|
||||
|
||||
// Copyright 2018 Peter Dimov
|
||||
// Copyright 2018-2022 Peter Dimov
|
||||
//
|
||||
// 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)
|
||||
@@ -62,4 +62,20 @@
|
||||
# define BOOST_SYSTEM_CLANG_6
|
||||
#endif
|
||||
|
||||
//
|
||||
|
||||
#if defined(BOOST_LIBSTDCXX_VERSION) && BOOST_LIBSTDCXX_VERSION < 50000
|
||||
# define BOOST_SYSTEM_AVOID_STD_GENERIC_CATEGORY
|
||||
#endif
|
||||
|
||||
#if defined(__CYGWIN__) || defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER == 1800) || (defined(BOOST_LIBSTDCXX_VERSION) && BOOST_LIBSTDCXX_VERSION < 90000)
|
||||
|
||||
// Under Cygwin (and MinGW!), std::system_category() is POSIX
|
||||
// Under VS2013, std::system_category() isn't quite right
|
||||
// Under libstdc++ before 7.4, before 8.3, before 9.1, default_error_condition
|
||||
// for the system category returns a condition from the system category
|
||||
|
||||
# define BOOST_SYSTEM_AVOID_STD_SYSTEM_CATEGORY
|
||||
#endif
|
||||
|
||||
#endif // BOOST_SYSTEM_DETAIL_CONFIG_HPP_INCLUDED
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include <boost/system/detail/error_condition.hpp>
|
||||
#include <boost/system/detail/error_code.hpp>
|
||||
#include <boost/system/detail/snprintf.hpp>
|
||||
#include <boost/system/detail/config.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
@@ -108,7 +109,7 @@ inline error_category::operator std::error_category const & () const
|
||||
if( id_ == detail::generic_category_id )
|
||||
{
|
||||
// This condition must be the same as the one in error_condition.hpp
|
||||
#if defined(BOOST_GCC) && BOOST_GCC < 50000
|
||||
#if defined(BOOST_SYSTEM_AVOID_STD_GENERIC_CATEGORY)
|
||||
|
||||
static const boost::system::detail::std_category generic_instance( this, 0x1F4D3 );
|
||||
return generic_instance;
|
||||
@@ -123,10 +124,7 @@ inline error_category::operator std::error_category const & () const
|
||||
if( id_ == detail::system_category_id )
|
||||
{
|
||||
// This condition must be the same as the one in error_code.hpp
|
||||
#if defined(__CYGWIN__) || defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER == 1800) || (defined(BOOST_GCC) && BOOST_GCC < 50000)
|
||||
|
||||
// Under Cygwin (and MinGW!), std::system_category() is POSIX
|
||||
// Under VS2013, std::system_category() isn't quite right
|
||||
#if defined(BOOST_SYSTEM_AVOID_STD_SYSTEM_CATEGORY)
|
||||
|
||||
static const boost::system::detail::std_category system_instance( this, 0x1F4D7 );
|
||||
return system_instance;
|
||||
|
||||
@@ -83,6 +83,28 @@ private:
|
||||
// >3: pointer to source_location, failed_ in lsb
|
||||
boost::uintptr_t lc_flags_;
|
||||
|
||||
private:
|
||||
|
||||
char const* category_name() const BOOST_NOEXCEPT
|
||||
{
|
||||
// return category().name();
|
||||
|
||||
if( lc_flags_ == 0 )
|
||||
{
|
||||
// must match detail::system_error_category::name()
|
||||
return "system";
|
||||
}
|
||||
else if( lc_flags_ == 1 )
|
||||
{
|
||||
// must match detail::interop_error_category::name()
|
||||
return "std:unknown";
|
||||
}
|
||||
else
|
||||
{
|
||||
return d1_.cat_->name();
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// constructors:
|
||||
@@ -188,7 +210,11 @@ public:
|
||||
#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
|
||||
|
||||
std::error_code const& ec = *reinterpret_cast<std::error_code const*>( d2_ );
|
||||
return ec.value() + 1000 * static_cast<unsigned>( reinterpret_cast<boost::uintptr_t>( &ec.category() ) % 2097143 ); // 2^21-9, prime
|
||||
|
||||
unsigned cv = static_cast<unsigned>( ec.value() );
|
||||
unsigned ch = static_cast<unsigned>( reinterpret_cast<boost::uintptr_t>( &ec.category() ) % 2097143 ); // 2^21-9, prime
|
||||
|
||||
return static_cast<int>( cv + 1000 * ch );
|
||||
#else
|
||||
|
||||
return -1;
|
||||
@@ -230,7 +256,14 @@ public:
|
||||
|
||||
#endif
|
||||
|
||||
return category().message( value() );
|
||||
if( lc_flags_ == 0 )
|
||||
{
|
||||
return detail::system_error_category_message( value() );
|
||||
}
|
||||
else
|
||||
{
|
||||
return category().message( value() );
|
||||
}
|
||||
}
|
||||
|
||||
char const * message( char * buffer, std::size_t len ) const BOOST_NOEXCEPT
|
||||
@@ -238,23 +271,33 @@ public:
|
||||
#if defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
|
||||
if( lc_flags_ == 1 )
|
||||
{
|
||||
std::error_code const& ec = *reinterpret_cast<std::error_code const*>( d2_ );
|
||||
|
||||
#if !defined(BOOST_NO_EXCEPTIONS)
|
||||
try
|
||||
#endif
|
||||
{
|
||||
std::error_code const& ec = *reinterpret_cast<std::error_code const*>( d2_ );
|
||||
detail::snprintf( buffer, len, "%s", ec.message().c_str() );
|
||||
return buffer;
|
||||
}
|
||||
#if !defined(BOOST_NO_EXCEPTIONS)
|
||||
catch( ... )
|
||||
{
|
||||
detail::snprintf( buffer, len, "No message text available for error std:%s:%d", ec.category().name(), ec.value() );
|
||||
return buffer;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
return category().message( value(), buffer, len );
|
||||
if( lc_flags_ == 0 )
|
||||
{
|
||||
return detail::system_error_category_message( value(), buffer, len );
|
||||
}
|
||||
else
|
||||
{
|
||||
return category().message( value(), buffer, len );
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_SYSTEM_CONSTEXPR bool failed() const BOOST_NOEXCEPT
|
||||
@@ -532,7 +575,7 @@ public:
|
||||
else if( lc_flags_ == 0 )
|
||||
{
|
||||
// This condition must be the same as the one in error_category_impl.hpp
|
||||
#if defined(__CYGWIN__) || defined(__MINGW32__) || (defined(_MSC_VER) && _MSC_VER == 1800) || (defined(BOOST_GCC) && BOOST_GCC < 50000)
|
||||
#if defined(BOOST_SYSTEM_AVOID_STD_SYSTEM_CATEGORY)
|
||||
|
||||
return std::error_code( 0, boost::system::system_category() );
|
||||
|
||||
@@ -594,7 +637,7 @@ public:
|
||||
else
|
||||
#endif
|
||||
{
|
||||
std::string r = category().name();
|
||||
std::string r = category_name();
|
||||
detail::append_int( r, value() );
|
||||
return r;
|
||||
}
|
||||
@@ -604,7 +647,7 @@ public:
|
||||
inline friend std::basic_ostream<Ch, Tr>&
|
||||
operator<< (std::basic_ostream<Ch, Tr>& os, error_code const & ec)
|
||||
{
|
||||
return os << ec.to_string();
|
||||
return os << ec.to_string().c_str();
|
||||
}
|
||||
|
||||
std::string what() const
|
||||
|
||||
@@ -223,7 +223,7 @@ public:
|
||||
operator std::error_condition () const
|
||||
{
|
||||
// This condition must be the same as the one in error_category_impl.hpp
|
||||
#if defined(BOOST_GCC) && BOOST_GCC < 50000
|
||||
#if defined(BOOST_SYSTEM_AVOID_STD_GENERIC_CATEGORY)
|
||||
|
||||
return std::error_condition( value(), category() );
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
// See library home page at http://www.boost.org/libs/system
|
||||
|
||||
#include <boost/system/detail/system_category.hpp>
|
||||
#include <boost/system/detail/system_category_message.hpp>
|
||||
#include <boost/system/detail/error_condition.hpp>
|
||||
#include <boost/system/api_config.hpp>
|
||||
|
||||
@@ -22,7 +23,6 @@
|
||||
|
||||
#if defined(BOOST_WINDOWS_API)
|
||||
|
||||
#include <boost/system/detail/system_category_message_win32.hpp>
|
||||
#include <boost/system/detail/system_category_condition_win32.hpp>
|
||||
|
||||
inline boost::system::error_condition boost::system::detail::system_error_category::default_error_condition( int ev ) const BOOST_NOEXCEPT
|
||||
@@ -39,35 +39,23 @@ inline boost::system::error_condition boost::system::detail::system_error_catego
|
||||
}
|
||||
}
|
||||
|
||||
inline std::string boost::system::detail::system_error_category::message( int ev ) const
|
||||
{
|
||||
return system_category_message_win32( ev );
|
||||
}
|
||||
|
||||
inline char const * boost::system::detail::system_error_category::message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT
|
||||
{
|
||||
return system_category_message_win32( ev, buffer, len );
|
||||
}
|
||||
|
||||
#else // #if defined(BOOST_WINDOWS_API)
|
||||
|
||||
#include <boost/system/detail/generic_category_message.hpp>
|
||||
|
||||
inline boost::system::error_condition boost::system::detail::system_error_category::default_error_condition( int ev ) const BOOST_NOEXCEPT
|
||||
{
|
||||
return error_condition( boost::system::detail::generic_value_tag( ev ) );
|
||||
}
|
||||
|
||||
#endif // #if defined(BOOST_WINDOWS_API)
|
||||
|
||||
inline std::string boost::system::detail::system_error_category::message( int ev ) const
|
||||
{
|
||||
return generic_error_category_message( ev );
|
||||
return system_error_category_message( ev );
|
||||
}
|
||||
|
||||
inline char const * boost::system::detail::system_error_category::message( int ev, char * buffer, std::size_t len ) const BOOST_NOEXCEPT
|
||||
{
|
||||
return generic_error_category_message( ev, buffer, len );
|
||||
return system_error_category_message( ev, buffer, len );
|
||||
}
|
||||
|
||||
#endif // #if defined(BOOST_WINDOWS_API)
|
||||
|
||||
#endif // #ifndef BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_IMPL_HPP_INCLUDED
|
||||
|
||||
71
include/boost/system/detail/system_category_message.hpp
Normal file
71
include/boost/system/detail/system_category_message.hpp
Normal file
@@ -0,0 +1,71 @@
|
||||
#ifndef BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_MESSAGE_HPP_INCLUDED
|
||||
#define BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_MESSAGE_HPP_INCLUDED
|
||||
|
||||
// Implementation of system_error_category_message
|
||||
//
|
||||
// Copyright 2018, 2022 Peter Dimov
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
// See library home page at http://www.boost.org/libs/system
|
||||
|
||||
#include <boost/system/api_config.hpp>
|
||||
|
||||
#if !defined(BOOST_POSIX_API) && !defined(BOOST_WINDOWS_API)
|
||||
# error BOOST_POSIX_API or BOOST_WINDOWS_API must be defined
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_WINDOWS_API)
|
||||
|
||||
#include <boost/system/detail/system_category_message_win32.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace system
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
inline std::string system_error_category_message( int ev )
|
||||
{
|
||||
return system_category_message_win32( ev );
|
||||
}
|
||||
|
||||
inline char const * system_error_category_message( int ev, char * buffer, std::size_t len ) BOOST_NOEXCEPT
|
||||
{
|
||||
return system_category_message_win32( ev, buffer, len );
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace system
|
||||
} // namespace boost
|
||||
|
||||
#else // #if defined(BOOST_WINDOWS_API)
|
||||
|
||||
#include <boost/system/detail/generic_category_message.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace system
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
|
||||
inline std::string system_error_category_message( int ev )
|
||||
{
|
||||
return generic_error_category_message( ev );
|
||||
}
|
||||
|
||||
inline char const * system_error_category_message( int ev, char * buffer, std::size_t len ) BOOST_NOEXCEPT
|
||||
{
|
||||
return generic_error_category_message( ev, buffer, len );
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace system
|
||||
} // namespace boost
|
||||
|
||||
#endif // #if defined(BOOST_WINDOWS_API)
|
||||
|
||||
#endif // #ifndef BOOST_SYSTEM_DETAIL_SYSTEM_CATEGORY_MESSAGE_HPP_INCLUDED
|
||||
@@ -10,13 +10,6 @@
|
||||
#ifndef BOOST_SYSTEM_LINUX_ERROR_HPP
|
||||
#define BOOST_SYSTEM_LINUX_ERROR_HPP
|
||||
|
||||
#include <boost/config/pragma_message.hpp>
|
||||
|
||||
#if !defined(BOOST_ALLOW_DEPRECATED_HEADERS)
|
||||
BOOST_PRAGMA_MESSAGE("This header is deprecated and is slated for removal."
|
||||
" If you want it retained, please open an issue in github.com/boostorg/system.")
|
||||
#endif
|
||||
|
||||
// This header is effectively empty for compiles on operating systems where
|
||||
// it is not applicable.
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef BOOST_SYSTEM_RESULT_HPP_INCLUDED
|
||||
#define BOOST_SYSTEM_RESULT_HPP_INCLUDED
|
||||
|
||||
// Copyright 2017, 2021 Peter Dimov.
|
||||
// Copyright 2017, 2021, 2022 Peter Dimov.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
@@ -11,11 +11,13 @@
|
||||
#include <boost/system/detail/error_category_impl.hpp>
|
||||
#include <boost/variant2/variant.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/assert/source_location.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <iosfwd>
|
||||
#include <system_error>
|
||||
|
||||
//
|
||||
|
||||
@@ -26,11 +28,25 @@ namespace system
|
||||
|
||||
// throw_exception_from_error
|
||||
|
||||
BOOST_NORETURN inline void throw_exception_from_error( error_code const & e )
|
||||
#if defined(__GNUC__) && __GNUC__ >= 7 && __GNUC__ <= 8
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wattributes"
|
||||
#endif
|
||||
|
||||
BOOST_NORETURN BOOST_NOINLINE inline void throw_exception_from_error( error_code const & e, boost::source_location const& loc )
|
||||
{
|
||||
boost::throw_exception( system_error( e ) );
|
||||
boost::throw_exception( system_error( e ), loc );
|
||||
}
|
||||
|
||||
BOOST_NORETURN BOOST_NOINLINE inline void throw_exception_from_error( std::error_code const & e, boost::source_location const& loc )
|
||||
{
|
||||
boost::throw_exception( std::system_error( e ), loc );
|
||||
}
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 7 && __GNUC__ <= 8
|
||||
# pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
// in_place_*
|
||||
|
||||
using in_place_value_t = variant2::in_place_index_t<0>;
|
||||
@@ -155,7 +171,7 @@ public:
|
||||
// checked value access
|
||||
#if defined( BOOST_NO_CXX11_REF_QUALIFIERS )
|
||||
|
||||
BOOST_CXX14_CONSTEXPR T value() const
|
||||
BOOST_CXX14_CONSTEXPR T value( boost::source_location const& loc = BOOST_CURRENT_LOCATION ) const
|
||||
{
|
||||
if( has_value() )
|
||||
{
|
||||
@@ -163,13 +179,13 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
throw_exception_from_error( variant2::unsafe_get<1>( v_ ) );
|
||||
throw_exception_from_error( variant2::unsafe_get<1>( v_ ), loc );
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
BOOST_CXX14_CONSTEXPR T& value() &
|
||||
BOOST_CXX14_CONSTEXPR T& value( boost::source_location const& loc = BOOST_CURRENT_LOCATION ) &
|
||||
{
|
||||
if( has_value() )
|
||||
{
|
||||
@@ -177,11 +193,11 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
throw_exception_from_error( variant2::unsafe_get<1>( v_ ) );
|
||||
throw_exception_from_error( variant2::unsafe_get<1>( v_ ), loc );
|
||||
}
|
||||
}
|
||||
|
||||
BOOST_CXX14_CONSTEXPR T const& value() const&
|
||||
BOOST_CXX14_CONSTEXPR T const& value( boost::source_location const& loc = BOOST_CURRENT_LOCATION ) const&
|
||||
{
|
||||
if( has_value() )
|
||||
{
|
||||
@@ -189,24 +205,24 @@ public:
|
||||
}
|
||||
else
|
||||
{
|
||||
throw_exception_from_error( variant2::unsafe_get<1>( v_ ) );
|
||||
throw_exception_from_error( variant2::unsafe_get<1>( v_ ), loc );
|
||||
}
|
||||
}
|
||||
|
||||
template<class U = T>
|
||||
BOOST_CXX14_CONSTEXPR
|
||||
typename std::enable_if<std::is_move_constructible<U>::value, T>::type
|
||||
value() &&
|
||||
value( boost::source_location const& loc = BOOST_CURRENT_LOCATION ) &&
|
||||
{
|
||||
return std::move( value() );
|
||||
return std::move( value( loc ) );
|
||||
}
|
||||
|
||||
template<class U = T>
|
||||
BOOST_CXX14_CONSTEXPR
|
||||
typename std::enable_if<!std::is_move_constructible<U>::value, T&&>::type
|
||||
value() &&
|
||||
value( boost::source_location const& loc = BOOST_CURRENT_LOCATION ) &&
|
||||
{
|
||||
return std::move( value() );
|
||||
return std::move( value( loc ) );
|
||||
}
|
||||
|
||||
template<class U = T>
|
||||
@@ -217,9 +233,9 @@ public:
|
||||
template<class U = T>
|
||||
BOOST_CXX14_CONSTEXPR
|
||||
typename std::enable_if<!std::is_move_constructible<U>::value, T const&&>::type
|
||||
value() const &&
|
||||
value( boost::source_location const& loc = BOOST_CURRENT_LOCATION ) const &&
|
||||
{
|
||||
return std::move( value() );
|
||||
return std::move( value( loc ) );
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -443,14 +459,14 @@ public:
|
||||
|
||||
// checked value access
|
||||
|
||||
BOOST_CXX14_CONSTEXPR void value() const
|
||||
BOOST_CXX14_CONSTEXPR void value( boost::source_location const& loc = BOOST_CURRENT_LOCATION ) const
|
||||
{
|
||||
if( has_value() )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
throw_exception_from_error( variant2::unsafe_get<1>( v_ ) );
|
||||
throw_exception_from_error( variant2::unsafe_get<1>( v_ ), loc );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -23,46 +23,25 @@ private:
|
||||
|
||||
error_code code_;
|
||||
|
||||
private:
|
||||
|
||||
static std::string build_message( char const * prefix, error_code const & ec )
|
||||
{
|
||||
std::string r;
|
||||
|
||||
if( prefix )
|
||||
{
|
||||
r += prefix;
|
||||
r += ": ";
|
||||
}
|
||||
|
||||
r += ec.what();
|
||||
return r;
|
||||
}
|
||||
|
||||
static std::string build_message( char const * prefix, int ev, error_category const & cat )
|
||||
{
|
||||
return build_message( prefix, error_code( ev, cat ) );
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
explicit system_error( error_code const & ec )
|
||||
: std::runtime_error( build_message( 0, ec ) ), code_( ec ) {}
|
||||
explicit system_error( error_code const & ec ):
|
||||
std::runtime_error( ec.what() ), code_( ec ) {}
|
||||
|
||||
system_error( error_code const & ec, std::string const & prefix )
|
||||
: std::runtime_error( build_message( prefix.c_str(), ec ) ), code_( ec ) {}
|
||||
system_error( error_code const & ec, std::string const & prefix ):
|
||||
std::runtime_error( prefix + ": " + ec.what() ), code_( ec ) {}
|
||||
|
||||
system_error( error_code const & ec, char const * prefix )
|
||||
: std::runtime_error( build_message( prefix, ec ) ), code_( ec ) {}
|
||||
system_error( error_code const & ec, char const * prefix ):
|
||||
std::runtime_error( std::string( prefix ) + ": " + ec.what() ), code_( ec ) {}
|
||||
|
||||
system_error( int ev, error_category const & ecat )
|
||||
: std::runtime_error( build_message( 0, ev, ecat ) ), code_( ev, ecat ) {}
|
||||
system_error( int ev, error_category const & ecat ):
|
||||
std::runtime_error( error_code( ev, ecat ).what() ), code_( ev, ecat ) {}
|
||||
|
||||
system_error( int ev, error_category const & ecat, std::string const & prefix )
|
||||
: std::runtime_error( build_message( prefix.c_str(), ev, ecat ) ), code_( ev, ecat ) {}
|
||||
system_error( int ev, error_category const & ecat, std::string const & prefix ):
|
||||
std::runtime_error( prefix + ": " + error_code( ev, ecat ).what() ), code_( ev, ecat ) {}
|
||||
|
||||
system_error( int ev, error_category const & ecat, char const * prefix )
|
||||
: std::runtime_error( build_message( prefix, ev, ecat ) ), code_( ev, ecat ) {}
|
||||
system_error( int ev, error_category const & ecat, char const * prefix ):
|
||||
std::runtime_error( std::string( prefix ) + ": " + error_code( ev, ecat ).what() ), code_( ev, ecat ) {}
|
||||
|
||||
error_code code() const BOOST_NOEXCEPT
|
||||
{
|
||||
|
||||
@@ -112,6 +112,10 @@ boost_test(TYPE run SOURCES system_error_test3.cpp)
|
||||
|
||||
boost_test(TYPE run SOURCES std_interop_test11.cpp)
|
||||
|
||||
boost_test(TYPE run SOURCES ec_wstream_test.cpp)
|
||||
|
||||
boost_test(TYPE run SOURCES std_interop_test12.cpp)
|
||||
|
||||
# result
|
||||
|
||||
set(BOOST_TEST_COMPILE_FEATURES cxx_std_11)
|
||||
|
||||
@@ -20,6 +20,8 @@ project
|
||||
<toolset>msvc:<warnings-as-errors>on
|
||||
<toolset>gcc:<warnings-as-errors>on
|
||||
<toolset>clang:<warnings-as-errors>on
|
||||
|
||||
<toolset>gcc-4.4:<cxxflags>-Wno-sign-compare
|
||||
;
|
||||
|
||||
rule system-run ( sources + )
|
||||
@@ -134,6 +136,10 @@ run system_error_test3.cpp ;
|
||||
|
||||
run std_interop_test11.cpp ;
|
||||
|
||||
run ec_wstream_test.cpp ;
|
||||
|
||||
run std_interop_test12.cpp ;
|
||||
|
||||
# result
|
||||
|
||||
import ../../config/checks/config : requires ;
|
||||
|
||||
21
test/ec_wstream_test.cpp
Normal file
21
test/ec_wstream_test.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
// Copyright 2022 Peter Dimov.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/system/error_code.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <sstream>
|
||||
|
||||
namespace sys = boost::system;
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
std::wostringstream os;
|
||||
os << sys::error_code();
|
||||
|
||||
BOOST_TEST( os.str() == L"system:0" );
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
// Copyright 2017, 2021 Peter Dimov.
|
||||
// Copyright 2017, 2021, 2022 Peter Dimov.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/system/result.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/core/lightweight_test_trait.hpp>
|
||||
#include <system_error>
|
||||
|
||||
using namespace boost::system;
|
||||
|
||||
@@ -26,7 +27,7 @@ struct E
|
||||
{
|
||||
};
|
||||
|
||||
BOOST_NORETURN void throw_exception_from_error( Y const & )
|
||||
BOOST_NORETURN void throw_exception_from_error( Y const &, boost::source_location const& )
|
||||
{
|
||||
throw E();
|
||||
}
|
||||
@@ -165,6 +166,22 @@ int main()
|
||||
BOOST_TEST_EQ( result<int>( ec ).operator->(), static_cast<int*>(0) );
|
||||
}
|
||||
|
||||
{
|
||||
auto ec = make_error_code( std::errc::invalid_argument );
|
||||
|
||||
result<int, std::error_code> const r( ec );
|
||||
|
||||
BOOST_TEST( !r.has_value() );
|
||||
BOOST_TEST( r.has_error() );
|
||||
|
||||
BOOST_TEST_NOT( r );
|
||||
BOOST_TEST( !r );
|
||||
|
||||
BOOST_TEST_THROWS( r.value(), std::system_error );
|
||||
|
||||
BOOST_TEST_EQ( r.operator->(), static_cast<int*>(0) );
|
||||
}
|
||||
|
||||
{
|
||||
result<X> r( 1 );
|
||||
|
||||
@@ -341,5 +358,21 @@ int main()
|
||||
BOOST_TEST_EQ( result<void>( ec ).operator->(), static_cast<void*>(0) );
|
||||
}
|
||||
|
||||
{
|
||||
auto ec = make_error_code( std::errc::invalid_argument );
|
||||
|
||||
result<void, std::error_code> const r( ec );
|
||||
|
||||
BOOST_TEST( !r.has_value() );
|
||||
BOOST_TEST( r.has_error() );
|
||||
|
||||
BOOST_TEST_NOT( r );
|
||||
BOOST_TEST( !r );
|
||||
|
||||
BOOST_TEST_THROWS( r.value(), std::system_error );
|
||||
|
||||
BOOST_TEST_EQ( r.operator->(), static_cast<void*>(0) );
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
127
test/std_interop_test12.cpp
Normal file
127
test/std_interop_test12.cpp
Normal file
@@ -0,0 +1,127 @@
|
||||
// Copyright 2021, 2022 Peter Dimov.
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/system/error_code.hpp>
|
||||
#include <boost/system/error_category.hpp>
|
||||
#include <boost/system/errc.hpp>
|
||||
#include <boost/core/lightweight_test.hpp>
|
||||
#include <boost/config/pragma_message.hpp>
|
||||
#include <boost/config.hpp>
|
||||
#include <cerrno>
|
||||
|
||||
#if !defined(BOOST_SYSTEM_HAS_SYSTEM_ERROR)
|
||||
|
||||
BOOST_PRAGMA_MESSAGE( "BOOST_SYSTEM_HAS_SYSTEM_ERROR not defined, test will be skipped" )
|
||||
int main() {}
|
||||
|
||||
#else
|
||||
|
||||
#include <system_error>
|
||||
|
||||
enum my_errc
|
||||
{
|
||||
my_enoent = ENOENT
|
||||
};
|
||||
|
||||
class my_category: public boost::system::error_category
|
||||
{
|
||||
public:
|
||||
|
||||
char const* name() const BOOST_NOEXCEPT
|
||||
{
|
||||
return "mycat";
|
||||
}
|
||||
|
||||
boost::system::error_condition default_error_condition( int ev ) const BOOST_NOEXCEPT
|
||||
{
|
||||
switch( ev )
|
||||
{
|
||||
case my_enoent:
|
||||
|
||||
return boost::system::error_condition( ENOENT, boost::system::generic_category() );
|
||||
|
||||
default:
|
||||
|
||||
return boost::system::error_condition( ev, *this );
|
||||
}
|
||||
}
|
||||
|
||||
std::string message( int ev ) const
|
||||
{
|
||||
switch( ev )
|
||||
{
|
||||
case my_enoent:
|
||||
|
||||
return "No such entity";
|
||||
|
||||
default:
|
||||
|
||||
return "Unknown error";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(BOOST_GCC) && BOOST_GCC < 70000
|
||||
|
||||
// g++ 6 and earlier do not allow specializations outside the namespace
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace system
|
||||
{
|
||||
|
||||
template<> struct is_error_code_enum<my_errc>: std::true_type {};
|
||||
|
||||
} // namespace system
|
||||
} // namespace boost
|
||||
|
||||
namespace std
|
||||
{
|
||||
|
||||
template<> struct is_error_code_enum<my_errc>: std::true_type {};
|
||||
|
||||
} // namespace std
|
||||
|
||||
#else
|
||||
|
||||
template<> struct boost::system::is_error_code_enum<my_errc>: std::true_type {};
|
||||
template<> struct std::is_error_code_enum<my_errc>: std::true_type {};
|
||||
|
||||
#endif
|
||||
|
||||
boost::system::error_code make_error_code( my_errc e )
|
||||
{
|
||||
// If `cat` is declared constexpr or const, msvc-14.1 and
|
||||
// msvc-14.2 before 19.29 put it in read-only memory,
|
||||
// despite the `ps_` member being mutable. So it crashes.
|
||||
|
||||
static /*BOOST_SYSTEM_CONSTEXPR*/ my_category cat;
|
||||
return boost::system::error_code( e, cat );
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
{
|
||||
boost::system::error_code e1 = my_enoent;
|
||||
|
||||
BOOST_TEST( e1 == my_enoent );
|
||||
BOOST_TEST_NOT( e1 != my_enoent );
|
||||
|
||||
BOOST_TEST( e1 == boost::system::errc::no_such_file_or_directory );
|
||||
BOOST_TEST( e1 == std::errc::no_such_file_or_directory );
|
||||
}
|
||||
|
||||
{
|
||||
std::error_code e1 = my_enoent;
|
||||
|
||||
BOOST_TEST( e1 == my_enoent );
|
||||
BOOST_TEST_NOT( e1 != my_enoent );
|
||||
|
||||
BOOST_TEST( e1 == std::errc::no_such_file_or_directory );
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,4 +1,4 @@
|
||||
// Copyright 2021 Peter Dimov
|
||||
// Copyright 2021, 2022 Peter Dimov
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// https://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
@@ -14,22 +14,36 @@ int main()
|
||||
sys::error_code ec( 5, sys::generic_category() );
|
||||
sys::system_error x1( ec );
|
||||
|
||||
BOOST_TEST_EQ( std::string( x1.what() ), ec.what() );
|
||||
BOOST_TEST_EQ( std::string( x1.what() ), ec.what() );
|
||||
}
|
||||
|
||||
{
|
||||
BOOST_STATIC_CONSTEXPR boost::source_location loc = BOOST_CURRENT_LOCATION;
|
||||
|
||||
sys::error_code ec( 5, sys::system_category(), &loc );
|
||||
sys::error_code ec( 5, sys::generic_category() );
|
||||
sys::system_error x1( ec, "prefix" );
|
||||
|
||||
BOOST_TEST_EQ( std::string( x1.what() ), "prefix: " + ec.what() );
|
||||
}
|
||||
|
||||
{
|
||||
sys::system_error x1( 5, sys::generic_category() );
|
||||
sys::error_code ec( 5, sys::generic_category() );
|
||||
sys::system_error x1( ec, std::string( "prefix2" ) );
|
||||
|
||||
BOOST_TEST_EQ( std::string( x1.what() ), sys::error_code( 5, sys::generic_category() ).what() );
|
||||
BOOST_TEST_EQ( std::string( x1.what() ), "prefix2: " + ec.what() );
|
||||
}
|
||||
|
||||
{
|
||||
BOOST_STATIC_CONSTEXPR boost::source_location loc = BOOST_CURRENT_LOCATION;
|
||||
|
||||
sys::error_code ec( 5, sys::generic_category(), &loc );
|
||||
sys::system_error x1( ec, "prefix3" );
|
||||
|
||||
BOOST_TEST_EQ( std::string( x1.what() ), "prefix3: " + ec.what() );
|
||||
}
|
||||
|
||||
{
|
||||
sys::system_error x1( 5, sys::system_category() );
|
||||
|
||||
BOOST_TEST_EQ( std::string( x1.what() ), sys::error_code( 5, sys::system_category() ).what() );
|
||||
}
|
||||
|
||||
{
|
||||
@@ -38,5 +52,11 @@ int main()
|
||||
BOOST_TEST_EQ( std::string( x1.what() ), "prefix: " + sys::error_code( 5, sys::system_category() ).what() );
|
||||
}
|
||||
|
||||
{
|
||||
sys::system_error x1( 5, sys::system_category(), std::string( "prefix2" ) );
|
||||
|
||||
BOOST_TEST_EQ( std::string( x1.what() ), "prefix2: " + sys::error_code( 5, sys::system_category() ).what() );
|
||||
}
|
||||
|
||||
return boost::report_errors();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user