mirror of
https://github.com/boostorg/static_assert.git
synced 2026-01-24 06:22:11 +00:00
Compare commits
158 Commits
boost-1.30
...
develop
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
858097c08e | ||
|
|
b137322f65 | ||
|
|
794a106a9e | ||
|
|
aea95895f4 | ||
|
|
4cc0d67e50 | ||
|
|
9a6a86efc8 | ||
|
|
82e8219497 | ||
|
|
b78ae8e44c | ||
|
|
4df5eb93a3 | ||
|
|
acbd163624 | ||
|
|
28277d9854 | ||
|
|
91ddf94f3c | ||
|
|
223997c70c | ||
|
|
e74f1d4f6e | ||
|
|
bccba72bff | ||
|
|
140907f843 | ||
|
|
aa4e60bd88 | ||
|
|
54412f7937 | ||
|
|
c65f0cd147 | ||
|
|
18ab3e9250 | ||
|
|
13690ce9b5 | ||
|
|
8df439fa03 | ||
|
|
9519349ab9 | ||
|
|
45eec41c29 | ||
|
|
a1abfec1ef | ||
|
|
ba72d3340f | ||
|
|
803b983da7 | ||
|
|
392199f6b1 | ||
|
|
482e81cddd | ||
|
|
6ec69e506c | ||
|
|
66db74297a | ||
|
|
e9ab97859d | ||
|
|
073c482606 | ||
|
|
8ab850a342 | ||
|
|
9102d74933 | ||
|
|
ba846a3091 | ||
|
|
0277552ae2 | ||
|
|
317f01fc58 | ||
|
|
b57860c33f | ||
|
|
ca94dbbc1a | ||
|
|
0a775cf1c5 | ||
|
|
eac11c5e50 | ||
|
|
944702b862 | ||
|
|
1aaabeb02b | ||
|
|
9064caf95f | ||
|
|
f970afff9d | ||
|
|
ad48daf3b2 | ||
|
|
c6b558f1f2 | ||
|
|
00724b8429 | ||
|
|
00a741184c | ||
|
|
f000d27cb2 | ||
|
|
a8597c46d5 | ||
|
|
609a5c0cd1 | ||
|
|
233ef6bedd | ||
|
|
cb6d8fe37d | ||
|
|
23ee2b94b5 | ||
|
|
cffc57ffba | ||
|
|
488af9cf1b | ||
|
|
a2c81d05e5 | ||
|
|
feaaf3d14a | ||
|
|
68e4213583 | ||
|
|
b91e4747ce | ||
|
|
62c6cdcd46 | ||
|
|
662ecd3d9f | ||
|
|
afe9e9d786 | ||
|
|
c2f58a187a | ||
|
|
0d27f7bcf6 | ||
|
|
d0967cbf65 | ||
|
|
3e8b6f5322 | ||
|
|
87f3be4a8f | ||
|
|
46e0bd762c | ||
|
|
8cd6ce7829 | ||
|
|
bb3cc11f09 | ||
|
|
15c38db1d2 | ||
|
|
41f9c4b99c | ||
|
|
d2f57474a7 | ||
|
|
29a7d491b8 | ||
|
|
4aab0b78c3 | ||
|
|
d215ee5c9c | ||
|
|
f2b7643595 | ||
|
|
bc29f7ab62 | ||
|
|
c951c0db9a | ||
|
|
8912d413ba | ||
|
|
41521344af | ||
|
|
bf3ee21630 | ||
|
|
c40a626f1c | ||
|
|
2993231dad | ||
|
|
5233df9b9e | ||
|
|
ce9e800db8 | ||
|
|
5e7b62a1f4 | ||
|
|
7d9fdaee13 | ||
|
|
06dedcd232 | ||
|
|
e910489e16 | ||
|
|
6f1d2476fa | ||
|
|
f57e592d1e | ||
|
|
e27a27c9f3 | ||
|
|
a0a2bd5703 | ||
|
|
80c6340833 | ||
|
|
12f96b5653 | ||
|
|
138c5bde91 | ||
|
|
5d9274a683 | ||
|
|
23d7abde22 | ||
|
|
87ecd7d39f | ||
|
|
9e4d6dfeff | ||
|
|
2637358ba9 | ||
|
|
62461d8848 | ||
|
|
a7e33291eb | ||
|
|
9e411076c6 | ||
|
|
413e7eda07 | ||
|
|
a9a9f0591b | ||
|
|
effe841116 | ||
|
|
3488b2bdf2 | ||
|
|
8cfe5d77c0 | ||
|
|
28e09a3cca | ||
|
|
8b819d5c6c | ||
|
|
481c2efbac | ||
|
|
bc5065e495 | ||
|
|
3b702727b9 | ||
|
|
f298ed51a9 | ||
|
|
851fd2622e | ||
|
|
720fb456d5 | ||
|
|
2fa11699bf | ||
|
|
1663a635aa | ||
|
|
b9a3b24aef | ||
|
|
a0dac351fb | ||
|
|
69dbf6f12d | ||
|
|
c68b2114de | ||
|
|
66dd3d2595 | ||
|
|
48b6934f7f | ||
|
|
7a0a3fbf32 | ||
|
|
c5de8ff789 | ||
|
|
d0fe5bc897 | ||
|
|
6541c76677 | ||
|
|
098770b91d | ||
|
|
1b9f71f4dd | ||
|
|
f7531de553 | ||
|
|
11be1f5a93 | ||
|
|
3959c96e26 | ||
|
|
178eed53c2 | ||
|
|
81625fade8 | ||
|
|
811af44dd5 | ||
|
|
2cf2951f97 | ||
|
|
f60bc26f84 | ||
|
|
f0969644d0 | ||
|
|
68545773d5 | ||
|
|
328b4fee16 | ||
|
|
21ab9ce12a | ||
|
|
0e39de168b | ||
|
|
52bc1a8fb7 | ||
|
|
0566bafd1d | ||
|
|
a2c78d51be | ||
|
|
d06c7261fc | ||
|
|
5e7c100b55 | ||
|
|
c26dde8e6e | ||
|
|
19e8840ad7 | ||
|
|
dd969b13ab | ||
|
|
5ea5535e1a | ||
|
|
64973e2132 |
668
.github/workflows/ci.yml
vendored
Normal file
668
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,668 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
- feature/**
|
||||||
|
|
||||||
|
env:
|
||||||
|
UBSAN_OPTIONS: print_stacktrace=1
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
posix:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- toolset: gcc-4.8
|
||||||
|
cxxstd: "11"
|
||||||
|
container: ubuntu:18.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: g++-4.8-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-5
|
||||||
|
cxxstd: "11,14,1z"
|
||||||
|
container: ubuntu:18.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: g++-5-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-6
|
||||||
|
cxxstd: "11,14,1z"
|
||||||
|
container: ubuntu:18.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: g++-6-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-7
|
||||||
|
cxxstd: "11,14,17"
|
||||||
|
container: ubuntu:18.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: g++-7-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-8
|
||||||
|
cxxstd: "11,14,17,2a"
|
||||||
|
container: ubuntu:20.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: g++-8-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-9
|
||||||
|
cxxstd: "11,14,17,2a"
|
||||||
|
container: ubuntu:20.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: g++-9-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-10
|
||||||
|
cxxstd: "11,14,17,2a"
|
||||||
|
container: ubuntu:20.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: g++-10-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-11
|
||||||
|
cxxstd: "11,14,17,20"
|
||||||
|
os: ubuntu-22.04
|
||||||
|
install: g++-11-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-12
|
||||||
|
cxxstd: "11,14,17,20,2b"
|
||||||
|
os: ubuntu-22.04
|
||||||
|
install: g++-12-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-13
|
||||||
|
cxxstd: "11,14,17,20,2b"
|
||||||
|
os: ubuntu-latest
|
||||||
|
container: ubuntu:24.04
|
||||||
|
install: g++-13-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-14
|
||||||
|
cxxstd: "11,14,17,20,23,2c"
|
||||||
|
os: ubuntu-latest
|
||||||
|
container: ubuntu:24.04
|
||||||
|
install: g++-14-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: gcc-15
|
||||||
|
cxxstd: "11,14,17,20,23,2c"
|
||||||
|
os: ubuntu-latest
|
||||||
|
container: ubuntu:25.04
|
||||||
|
install: g++-15-multilib
|
||||||
|
address-model: 32,64
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-3.9
|
||||||
|
cxxstd: "11,14"
|
||||||
|
container: ubuntu:18.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-3.9
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-4.0
|
||||||
|
cxxstd: "11,14"
|
||||||
|
container: ubuntu:18.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-4.0
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-5.0
|
||||||
|
cxxstd: "11,14,1z"
|
||||||
|
container: ubuntu:18.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-5.0
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-6.0
|
||||||
|
cxxstd: "11,14,17"
|
||||||
|
container: ubuntu:20.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-6.0
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-7
|
||||||
|
cxxstd: "11,14,17"
|
||||||
|
container: ubuntu:20.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-7
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-8
|
||||||
|
cxxstd: "11,14,17"
|
||||||
|
container: ubuntu:20.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-8
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-9
|
||||||
|
cxxstd: "11,14,17,2a"
|
||||||
|
container: ubuntu:20.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-9
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-10
|
||||||
|
cxxstd: "11,14,17,2a"
|
||||||
|
container: ubuntu:20.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-10
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-11
|
||||||
|
cxxstd: "11,14,17,2a"
|
||||||
|
container: ubuntu:20.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-11
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-12
|
||||||
|
cxxstd: "11,14,17,20"
|
||||||
|
container: ubuntu:20.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-12
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-13
|
||||||
|
cxxstd: "11,14,17,20,2b"
|
||||||
|
container: ubuntu:22.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-13
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-14
|
||||||
|
cxxstd: "11,14,17,20,2b"
|
||||||
|
container: ubuntu:22.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-14
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-15
|
||||||
|
cxxstd: "11,14,17,20,2b"
|
||||||
|
container: ubuntu:22.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-15
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-16
|
||||||
|
cxxstd: "11,14,17,20,2b"
|
||||||
|
container: ubuntu:24.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-16
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-17
|
||||||
|
cxxstd: "11,14,17,20,2b"
|
||||||
|
container: ubuntu:24.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-17
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-18
|
||||||
|
cxxstd: "11,14,17,20,2b"
|
||||||
|
container: ubuntu:24.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-18
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-19
|
||||||
|
cxxstd: "11,14,17,20,23,2c"
|
||||||
|
container: ubuntu:24.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-19
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-20
|
||||||
|
cxxstd: "11,14,17,20,23,2c"
|
||||||
|
container: ubuntu:24.04
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-20
|
||||||
|
- toolset: clang
|
||||||
|
compiler: clang++-21
|
||||||
|
cxxstd: "11,14,17,20,23,2c"
|
||||||
|
container: ubuntu:25.10
|
||||||
|
os: ubuntu-latest
|
||||||
|
install: clang-21
|
||||||
|
- toolset: clang
|
||||||
|
os: macos-14
|
||||||
|
cxxstd: "11,14,17,20,2b"
|
||||||
|
- toolset: clang
|
||||||
|
os: macos-15
|
||||||
|
cxxstd: "11,14,17,20,23,2c"
|
||||||
|
- toolset: clang
|
||||||
|
os: macos-26
|
||||||
|
cxxstd: "11,14,17,20,23,2c"
|
||||||
|
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
|
container:
|
||||||
|
image: ${{matrix.container}}
|
||||||
|
volumes:
|
||||||
|
- /node20217:/node20217:rw,rshared
|
||||||
|
- ${{ startsWith(matrix.container, 'ubuntu:1') && '/node20217:/__e/node20:ro,rshared' || ' ' }}
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Setup container environment
|
||||||
|
if: matrix.container
|
||||||
|
run: |
|
||||||
|
apt-get update
|
||||||
|
apt-get -y install sudo python3 git g++ curl xz-utils
|
||||||
|
|
||||||
|
- name: Install nodejs20glibc2.17
|
||||||
|
if: ${{ startsWith( matrix.container, 'ubuntu:1' ) }}
|
||||||
|
run: |
|
||||||
|
curl -LO https://archives.boost.io/misc/node/node-v20.9.0-linux-x64-glibc-217.tar.xz
|
||||||
|
tar -xf node-v20.9.0-linux-x64-glibc-217.tar.xz --strip-components 1 -C /node20217
|
||||||
|
ldd /__e/node20/bin/node
|
||||||
|
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install packages
|
||||||
|
if: matrix.install
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get -y install ${{matrix.install}}
|
||||||
|
|
||||||
|
- name: Setup Boost
|
||||||
|
run: |
|
||||||
|
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
|
||||||
|
LIBRARY=${GITHUB_REPOSITORY#*/}
|
||||||
|
echo LIBRARY: $LIBRARY
|
||||||
|
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
|
||||||
|
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
|
||||||
|
echo GITHUB_REF: $GITHUB_REF
|
||||||
|
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
|
||||||
|
REF=${REF#refs/heads/}
|
||||||
|
echo REF: $REF
|
||||||
|
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
|
||||||
|
echo BOOST_BRANCH: $BOOST_BRANCH
|
||||||
|
cd ..
|
||||||
|
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
|
cd boost-root
|
||||||
|
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
||||||
|
git submodule update --init tools/boostdep
|
||||||
|
python3 tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
|
||||||
|
./bootstrap.sh
|
||||||
|
./b2 -d0 headers
|
||||||
|
|
||||||
|
- name: Create user-config.jam
|
||||||
|
if: matrix.compiler
|
||||||
|
run: |
|
||||||
|
echo "using ${{matrix.toolset}} : : ${{matrix.compiler}} ;" > ~/user-config.jam
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
cd ../boost-root
|
||||||
|
./b2 -j3 libs/$LIBRARY/test toolset=${{matrix.toolset}} cxxstd=${{matrix.cxxstd}} ${ADDRMD:+address-model=$ADDRMD} variant=debug,release
|
||||||
|
|
||||||
|
windows:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- toolset: msvc-14.3
|
||||||
|
cxxstd: "14,17,20,latest"
|
||||||
|
addrmd: 32,64
|
||||||
|
os: windows-2022
|
||||||
|
- toolset: clang-win
|
||||||
|
cxxstd: "14,17,20,latest"
|
||||||
|
addrmd: 32,64
|
||||||
|
os: windows-2022
|
||||||
|
- toolset: gcc
|
||||||
|
cxxstd: "11,14,17,2a"
|
||||||
|
addrmd: 64
|
||||||
|
os: windows-2022
|
||||||
|
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Boost
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
|
||||||
|
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
|
||||||
|
echo LIBRARY: %LIBRARY%
|
||||||
|
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
|
||||||
|
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
|
||||||
|
echo GITHUB_REF: %GITHUB_REF%
|
||||||
|
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
|
||||||
|
set BOOST_BRANCH=develop
|
||||||
|
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
|
||||||
|
echo BOOST_BRANCH: %BOOST_BRANCH%
|
||||||
|
cd ..
|
||||||
|
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
|
cd boost-root
|
||||||
|
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
|
||||||
|
git submodule update --init tools/boostdep
|
||||||
|
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
|
||||||
|
cmd /c bootstrap
|
||||||
|
b2 -d0 headers
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root
|
||||||
|
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:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-22.04
|
||||||
|
- os: ubuntu-24.04
|
||||||
|
- os: macos-14
|
||||||
|
- os: macos-15
|
||||||
|
- os: macos-26
|
||||||
|
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install packages
|
||||||
|
if: matrix.install
|
||||||
|
run: sudo apt-get -y install ${{matrix.install}}
|
||||||
|
|
||||||
|
- name: Setup Boost
|
||||||
|
run: |
|
||||||
|
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
|
||||||
|
LIBRARY=${GITHUB_REPOSITORY#*/}
|
||||||
|
echo LIBRARY: $LIBRARY
|
||||||
|
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
|
||||||
|
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
|
||||||
|
echo GITHUB_REF: $GITHUB_REF
|
||||||
|
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
|
||||||
|
REF=${REF#refs/heads/}
|
||||||
|
echo REF: $REF
|
||||||
|
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
|
||||||
|
echo BOOST_BRANCH: $BOOST_BRANCH
|
||||||
|
cd ..
|
||||||
|
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
|
cd boost-root
|
||||||
|
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
||||||
|
git submodule update --init tools/boostdep
|
||||||
|
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
|
||||||
|
|
||||||
|
- name: Use library with add_subdirectory
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/libs/$LIBRARY/test/cmake_subdir_test
|
||||||
|
mkdir __build__ && cd __build__
|
||||||
|
cmake ..
|
||||||
|
cmake --build .
|
||||||
|
ctest --output-on-failure --no-tests=error
|
||||||
|
|
||||||
|
posix-cmake-install:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-22.04
|
||||||
|
- os: ubuntu-24.04
|
||||||
|
- os: macos-14
|
||||||
|
- os: macos-15
|
||||||
|
- os: macos-26
|
||||||
|
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install packages
|
||||||
|
if: matrix.install
|
||||||
|
run: sudo apt-get -y install ${{matrix.install}}
|
||||||
|
|
||||||
|
- name: Setup Boost
|
||||||
|
run: |
|
||||||
|
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
|
||||||
|
LIBRARY=${GITHUB_REPOSITORY#*/}
|
||||||
|
echo LIBRARY: $LIBRARY
|
||||||
|
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
|
||||||
|
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
|
||||||
|
echo GITHUB_REF: $GITHUB_REF
|
||||||
|
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
|
||||||
|
REF=${REF#refs/heads/}
|
||||||
|
echo REF: $REF
|
||||||
|
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
|
||||||
|
echo BOOST_BRANCH: $BOOST_BRANCH
|
||||||
|
cd ..
|
||||||
|
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
|
cd boost-root
|
||||||
|
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
||||||
|
git submodule update --init tools/boostdep
|
||||||
|
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
|
||||||
|
|
||||||
|
- name: Configure
|
||||||
|
run: |
|
||||||
|
cd ../boost-root
|
||||||
|
mkdir __build__ && cd __build__
|
||||||
|
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DCMAKE_INSTALL_PREFIX=~/.local ..
|
||||||
|
|
||||||
|
- name: Install
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/__build__
|
||||||
|
cmake --build . --target install
|
||||||
|
|
||||||
|
- name: Use the installed library
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/libs/$LIBRARY/test/cmake_install_test && mkdir __build__ && cd __build__
|
||||||
|
cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
|
||||||
|
cmake --build .
|
||||||
|
ctest --output-on-failure --no-tests=error
|
||||||
|
|
||||||
|
posix-cmake-test:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: ubuntu-22.04
|
||||||
|
- os: ubuntu-24.04
|
||||||
|
- os: macos-14
|
||||||
|
- os: macos-15
|
||||||
|
- os: macos-26
|
||||||
|
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install packages
|
||||||
|
if: matrix.install
|
||||||
|
run: sudo apt-get -y install ${{matrix.install}}
|
||||||
|
|
||||||
|
- name: Setup Boost
|
||||||
|
run: |
|
||||||
|
echo GITHUB_REPOSITORY: $GITHUB_REPOSITORY
|
||||||
|
LIBRARY=${GITHUB_REPOSITORY#*/}
|
||||||
|
echo LIBRARY: $LIBRARY
|
||||||
|
echo "LIBRARY=$LIBRARY" >> $GITHUB_ENV
|
||||||
|
echo GITHUB_BASE_REF: $GITHUB_BASE_REF
|
||||||
|
echo GITHUB_REF: $GITHUB_REF
|
||||||
|
REF=${GITHUB_BASE_REF:-$GITHUB_REF}
|
||||||
|
REF=${REF#refs/heads/}
|
||||||
|
echo REF: $REF
|
||||||
|
BOOST_BRANCH=develop && [ "$REF" == "master" ] && BOOST_BRANCH=master || true
|
||||||
|
echo BOOST_BRANCH: $BOOST_BRANCH
|
||||||
|
cd ..
|
||||||
|
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
|
cd boost-root
|
||||||
|
cp -r $GITHUB_WORKSPACE/* libs/$LIBRARY
|
||||||
|
git submodule update --init tools/boostdep
|
||||||
|
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" $LIBRARY
|
||||||
|
|
||||||
|
- name: Configure
|
||||||
|
run: |
|
||||||
|
cd ../boost-root
|
||||||
|
mkdir __build__ && cd __build__
|
||||||
|
cmake -DBOOST_INCLUDE_LIBRARIES=$LIBRARY -DBUILD_TESTING=ON ..
|
||||||
|
|
||||||
|
- name: Build tests
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/__build__
|
||||||
|
cmake --build . --target tests
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/__build__
|
||||||
|
ctest --output-on-failure --no-tests=error
|
||||||
|
|
||||||
|
windows-cmake-subdir:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: windows-latest
|
||||||
|
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Boost
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
|
||||||
|
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
|
||||||
|
echo LIBRARY: %LIBRARY%
|
||||||
|
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
|
||||||
|
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
|
||||||
|
echo GITHUB_REF: %GITHUB_REF%
|
||||||
|
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
|
||||||
|
set BOOST_BRANCH=develop
|
||||||
|
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
|
||||||
|
echo BOOST_BRANCH: %BOOST_BRANCH%
|
||||||
|
cd ..
|
||||||
|
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
|
cd boost-root
|
||||||
|
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
|
||||||
|
git submodule update --init tools/boostdep
|
||||||
|
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
|
||||||
|
|
||||||
|
- name: Use library with add_subdirectory (Debug)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/libs/%LIBRARY%/test/cmake_subdir_test
|
||||||
|
mkdir __build__ && cd __build__
|
||||||
|
cmake ..
|
||||||
|
cmake --build . --config Debug
|
||||||
|
ctest --output-on-failure --no-tests=error -C Debug
|
||||||
|
|
||||||
|
- name: Use library with add_subdirectory (Release)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/libs/%LIBRARY%/test/cmake_subdir_test/__build__
|
||||||
|
cmake --build . --config Release
|
||||||
|
ctest --output-on-failure --no-tests=error -C Release
|
||||||
|
|
||||||
|
windows-cmake-install:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: windows-latest
|
||||||
|
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Boost
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
|
||||||
|
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
|
||||||
|
echo LIBRARY: %LIBRARY%
|
||||||
|
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
|
||||||
|
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
|
||||||
|
echo GITHUB_REF: %GITHUB_REF%
|
||||||
|
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
|
||||||
|
set BOOST_BRANCH=develop
|
||||||
|
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
|
||||||
|
echo BOOST_BRANCH: %BOOST_BRANCH%
|
||||||
|
cd ..
|
||||||
|
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
|
cd boost-root
|
||||||
|
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
|
||||||
|
git submodule update --init tools/boostdep
|
||||||
|
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
|
||||||
|
|
||||||
|
- name: Configure
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root
|
||||||
|
mkdir __build__ && cd __build__
|
||||||
|
cmake -DBOOST_INCLUDE_LIBRARIES=%LIBRARY% -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
|
||||||
|
|
||||||
|
- name: Install (Debug)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/__build__
|
||||||
|
cmake --build . --target install --config Debug
|
||||||
|
|
||||||
|
- name: Install (Release)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/__build__
|
||||||
|
cmake --build . --target install --config Release
|
||||||
|
|
||||||
|
- name: Use the installed library (Debug)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test && mkdir __build__ && cd __build__
|
||||||
|
cmake -DCMAKE_INSTALL_PREFIX=C:/cmake-prefix ..
|
||||||
|
cmake --build . --config Debug
|
||||||
|
ctest --output-on-failure --no-tests=error -C Debug
|
||||||
|
|
||||||
|
- name: Use the installed library (Release)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/libs/%LIBRARY%/test/cmake_install_test/__build__
|
||||||
|
cmake --build . --config Release
|
||||||
|
ctest --output-on-failure --no-tests=error -C Release
|
||||||
|
|
||||||
|
windows-cmake-test:
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- os: windows-latest
|
||||||
|
|
||||||
|
runs-on: ${{matrix.os}}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Setup Boost
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
echo GITHUB_REPOSITORY: %GITHUB_REPOSITORY%
|
||||||
|
for /f %%i in ("%GITHUB_REPOSITORY%") do set LIBRARY=%%~nxi
|
||||||
|
echo LIBRARY: %LIBRARY%
|
||||||
|
echo LIBRARY=%LIBRARY%>>%GITHUB_ENV%
|
||||||
|
echo GITHUB_BASE_REF: %GITHUB_BASE_REF%
|
||||||
|
echo GITHUB_REF: %GITHUB_REF%
|
||||||
|
if "%GITHUB_BASE_REF%" == "" set GITHUB_BASE_REF=%GITHUB_REF%
|
||||||
|
set BOOST_BRANCH=develop
|
||||||
|
for /f %%i in ("%GITHUB_BASE_REF%") do if "%%~nxi" == "master" set BOOST_BRANCH=master
|
||||||
|
echo BOOST_BRANCH: %BOOST_BRANCH%
|
||||||
|
cd ..
|
||||||
|
git clone -b %BOOST_BRANCH% --depth 1 https://github.com/boostorg/boost.git boost-root
|
||||||
|
cd boost-root
|
||||||
|
xcopy /s /e /q %GITHUB_WORKSPACE% libs\%LIBRARY%\
|
||||||
|
git submodule update --init tools/boostdep
|
||||||
|
python tools/boostdep/depinst/depinst.py --git_args "--jobs 3" %LIBRARY%
|
||||||
|
|
||||||
|
- name: Configure
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root
|
||||||
|
mkdir __build__ && cd __build__
|
||||||
|
cmake -DBOOST_INCLUDE_LIBRARIES=%LIBRARY% -DBUILD_TESTING=ON ..
|
||||||
|
|
||||||
|
- name: Build tests (Debug)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/__build__
|
||||||
|
cmake --build . --target tests --config Debug
|
||||||
|
|
||||||
|
- name: Run tests (Debug)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/__build__
|
||||||
|
ctest --output-on-failure --no-tests=error -C Debug
|
||||||
|
|
||||||
|
- name: Build tests (Release)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/__build__
|
||||||
|
cmake --build . --target tests --config Release
|
||||||
|
|
||||||
|
- name: Run tests (Release)
|
||||||
|
shell: cmd
|
||||||
|
run: |
|
||||||
|
cd ../boost-root/__build__
|
||||||
|
ctest --output-on-failure --no-tests=error -C Release
|
||||||
327
.travis.yml
Normal file
327
.travis.yml
Normal file
@@ -0,0 +1,327 @@
|
|||||||
|
# Copyright 2016-2019 Peter Dimov
|
||||||
|
# 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)
|
||||||
|
|
||||||
|
language: cpp
|
||||||
|
|
||||||
|
dist: xenial
|
||||||
|
|
||||||
|
branches:
|
||||||
|
only:
|
||||||
|
- master
|
||||||
|
- develop
|
||||||
|
- /feature\/.*/
|
||||||
|
|
||||||
|
env:
|
||||||
|
matrix:
|
||||||
|
- BOGUS_JOB=true
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
|
||||||
|
exclude:
|
||||||
|
- env: BOGUS_JOB=true
|
||||||
|
|
||||||
|
include:
|
||||||
|
- os: linux
|
||||||
|
compiler: g++
|
||||||
|
env: TOOLSET=gcc COMPILER=g++ CXXSTD=03,11
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: g++-4.4
|
||||||
|
env: TOOLSET=gcc COMPILER=g++-4.4 CXXSTD=98
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-4.4
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: g++-4.6
|
||||||
|
env: TOOLSET=gcc COMPILER=g++-4.6 CXXSTD=03,0x
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-4.6
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: g++-4.7
|
||||||
|
env: TOOLSET=gcc COMPILER=g++-4.7 CXXSTD=03,11
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-4.7
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: g++-4.8
|
||||||
|
env: TOOLSET=gcc COMPILER=g++-4.8 CXXSTD=03,11
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-4.8
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- os: linux
|
||||||
|
compiler: g++-4.9
|
||||||
|
env: TOOLSET=gcc COMPILER=g++-4.9 CXXSTD=03,11
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-4.9
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: g++-5
|
||||||
|
env: TOOLSET=gcc COMPILER=g++-5 CXXSTD=03,11,14,1z
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-5
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: g++-6
|
||||||
|
env: TOOLSET=gcc COMPILER=g++-6 CXXSTD=03,11,14,1z
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-6
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
compiler: g++-7
|
||||||
|
env: TOOLSET=gcc COMPILER=g++-7 CXXSTD=03,11,14,17
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-7
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: g++-8
|
||||||
|
env: TOOLSET=gcc COMPILER=g++-8 CXXSTD=03,11,14,17,2a
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-8
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: g++-9
|
||||||
|
env: TOOLSET=gcc COMPILER=g++-9 CXXSTD=03,11,14,17,2a
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- g++-9
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++
|
||||||
|
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
compiler: /usr/bin/clang++
|
||||||
|
env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.3
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
compiler: /usr/bin/clang++
|
||||||
|
env: TOOLSET=clang COMPILER=/usr/bin/clang++ CXXSTD=03,11
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.4
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-3.5
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-3.5 CXXSTD=03,11,14,1z
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.5
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-3.6
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-3.6 CXXSTD=03,11,14,1z
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.6
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-3.7
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-3.7 CXXSTD=03,11,14,1z
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.7
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-3.8
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-3.8 CXXSTD=03,11,14,1z
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.8
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-3.9
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-3.9 CXXSTD=03,11,14,1z
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-3.9
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-4.0
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-4.0 CXXSTD=03,11,14,1z
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-4.0
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-5.0
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-5.0 CXXSTD=03,11,14,1z
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-5.0
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-6.0
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-6.0 CXXSTD=03,11,14,17,2a
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-6.0
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-7
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-7 CXXSTD=03,11,14,17,2a
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-7
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-xenial-7
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-8
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-8 CXXSTD=03,11,14,17,2a
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-8
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- llvm-toolchain-xenial-8
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
compiler: clang++-9
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-9 CXXSTD=03,11,14,17,2a
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- clang-9
|
||||||
|
sources:
|
||||||
|
- ubuntu-toolchain-r-test
|
||||||
|
- sourceline: 'deb https://apt.llvm.org/xenial/ llvm-toolchain-xenial-9 main'
|
||||||
|
key_url: 'https://apt.llvm.org/llvm-snapshot.gpg.key'
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
dist: trusty
|
||||||
|
compiler: clang++-libc++
|
||||||
|
env: TOOLSET=clang COMPILER=clang++-libc++ CXXSTD=03,11,14,1z
|
||||||
|
addons:
|
||||||
|
apt:
|
||||||
|
packages:
|
||||||
|
- libc++-dev
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env: CMAKE=1
|
||||||
|
script:
|
||||||
|
- mkdir __build__ && cd __build__
|
||||||
|
- cmake -DBUILD_TESTING=ON -DBOOST_INCLUDE_LIBRARIES=static_assert ..
|
||||||
|
- cmake --build . --target tests
|
||||||
|
- ctest --output-on-failure
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env: CMAKE_SUBDIR=1
|
||||||
|
install:
|
||||||
|
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
|
||||||
|
- git clone -b $BOOST_BRANCH https://github.com/boostorg/config.git ../config
|
||||||
|
script:
|
||||||
|
- cd test/cmake_subdir_test && mkdir __build__ && cd __build__
|
||||||
|
- cmake ..
|
||||||
|
- cmake --build .
|
||||||
|
- cmake --build . --target check
|
||||||
|
|
||||||
|
- os: linux
|
||||||
|
env: CMAKE_INSTALL=1
|
||||||
|
script:
|
||||||
|
- pip install --user cmake
|
||||||
|
- mkdir __build__ && cd __build__
|
||||||
|
- cmake -DBOOST_INCLUDE_LIBRARIES=static_assert -DCMAKE_INSTALL_PREFIX=~/.local ..
|
||||||
|
- cmake --build . --target install
|
||||||
|
- cd ../libs/static_assert/test/cmake_install_test && mkdir __build__ && cd __build__
|
||||||
|
- cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
|
||||||
|
- cmake --build .
|
||||||
|
- cmake --build . --target check
|
||||||
|
|
||||||
|
- os: osx
|
||||||
|
compiler: clang++
|
||||||
|
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z
|
||||||
|
|
||||||
|
install:
|
||||||
|
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
|
||||||
|
- 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 $TRAVIS_BUILD_DIR/* libs/static_assert
|
||||||
|
- python tools/boostdep/depinst/depinst.py static_assert
|
||||||
|
- ./bootstrap.sh
|
||||||
|
- ./b2 headers
|
||||||
|
|
||||||
|
script:
|
||||||
|
- |-
|
||||||
|
echo "using $TOOLSET : : $COMPILER ;" > ~/user-config.jam
|
||||||
|
- ./b2 -j 3 libs/static_assert/test toolset=$TOOLSET cxxstd=$CXXSTD
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
email:
|
||||||
|
on_success: always
|
||||||
28
CMakeLists.txt
Normal file
28
CMakeLists.txt
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
# Copyright 2018 Mike Dev
|
||||||
|
# Copyright 2019, 2025 Peter Dimov
|
||||||
|
# Distributed under the Boost Software License, Version 1.0.
|
||||||
|
# https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
|
||||||
|
# We support CMake 3.5, but prefer 3.31 policies and behavior
|
||||||
|
cmake_minimum_required(VERSION 3.5...3.31)
|
||||||
|
|
||||||
|
project(boost_static_assert VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
|
||||||
|
|
||||||
|
add_library(boost_static_assert INTERFACE)
|
||||||
|
add_library(Boost::static_assert ALIAS boost_static_assert)
|
||||||
|
|
||||||
|
target_include_directories(boost_static_assert INTERFACE include)
|
||||||
|
|
||||||
|
target_link_libraries(boost_static_assert
|
||||||
|
INTERFACE
|
||||||
|
Boost::config
|
||||||
|
)
|
||||||
|
|
||||||
|
# BUILD_TESTING is the standard CTest variable that enables testing
|
||||||
|
|
||||||
|
if(BUILD_TESTING)
|
||||||
|
|
||||||
|
add_subdirectory(test)
|
||||||
|
add_subdirectory(example)
|
||||||
|
|
||||||
|
endif()
|
||||||
22
Jamfile
22
Jamfile
@@ -1,22 +0,0 @@
|
|||||||
subproject libs/static_assert ;
|
|
||||||
# bring in the rules for testing
|
|
||||||
SEARCH on testing.jam = $(BOOST_BUILD_PATH) ;
|
|
||||||
include testing.jam ;
|
|
||||||
|
|
||||||
test-suite static_assert :
|
|
||||||
[ run static_assert_test.cpp ]
|
|
||||||
[ run static_assert_example_1.cpp ]
|
|
||||||
[ run static_assert_example_2.cpp ]
|
|
||||||
[ run static_assert_example_3.cpp ]
|
|
||||||
[ compile-fail static_assert_test_fail_1.cpp ]
|
|
||||||
[ compile-fail static_assert_test_fail_2.cpp ]
|
|
||||||
[ compile-fail static_assert_test_fail_3.cpp ]
|
|
||||||
[ compile-fail static_assert_test_fail_4.cpp ]
|
|
||||||
[ compile-fail static_assert_test_fail_5.cpp ]
|
|
||||||
[ compile-fail static_assert_test_fail_6.cpp ]
|
|
||||||
[ compile-fail static_assert_test_fail_7.cpp ]
|
|
||||||
[ compile-fail static_assert_test_fail_8.cpp ]
|
|
||||||
;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
7
README.md
Normal file
7
README.md
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
Boost StaticAssert Library
|
||||||
|
============================
|
||||||
|
|
||||||
|
The Boost StaticAssert library provides static assertions for C++, this library is the ancestor to C++ native static_assert's and
|
||||||
|
can be used on older compilers which don't have that feature.
|
||||||
|
|
||||||
|
This library has been merged into [Boost.Config](https://github.com/boostorg/config). The full documentation is available on [boost.org](https://www.boost.org/doc/libs/release/libs/config).
|
||||||
23
build.jam
Normal file
23
build.jam
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
# 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/config//boost_config ;
|
||||||
|
|
||||||
|
project /boost/static_assert
|
||||||
|
: common-requirements
|
||||||
|
<include>include
|
||||||
|
;
|
||||||
|
|
||||||
|
explicit
|
||||||
|
[ alias boost_static_assert : : : : <library>$(boost_dependencies) ]
|
||||||
|
[ alias all : boost_static_assert example test ]
|
||||||
|
;
|
||||||
|
|
||||||
|
call-if : boost-library static_assert
|
||||||
|
;
|
||||||
|
|
||||||
11
example/CMakeLists.txt
Normal file
11
example/CMakeLists.txt
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Copyright 2018, 2019 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
|
||||||
|
|
||||||
|
include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
|
||||||
|
|
||||||
|
if(HAVE_BOOST_TEST)
|
||||||
|
|
||||||
|
boost_test_jamfile(FILE Jamfile.v2 LINK_LIBRARIES Boost::static_assert Boost::type_traits)
|
||||||
|
|
||||||
|
endif()
|
||||||
15
example/Jamfile.v2
Normal file
15
example/Jamfile.v2
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
# copyright John Maddock 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)
|
||||||
|
|
||||||
|
# bring in the rules for testing
|
||||||
|
import testing ;
|
||||||
|
|
||||||
|
project : requirements
|
||||||
|
<library>/boost/type_traits//boost_type_traits
|
||||||
|
;
|
||||||
|
|
||||||
|
#run static_assert_example_1.cpp ;
|
||||||
|
run static_assert_example_2.cpp ;
|
||||||
|
run static_assert_example_3.cpp ;
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
// (C) Copyright Steve Cleary & John Maddock 2000.
|
// (C) Copyright Steve Cleary & John Maddock 2000.
|
||||||
// Permission to copy, use, modify, sell and
|
// Use, modification and distribution are subject to the
|
||||||
// distribute this software is granted provided this copyright notice appears
|
// Boost Software License, Version 1.0. (See accompanying file
|
||||||
// in all copies. This software is provided "as is" without express or implied
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
|
|
||||||
// See http://www.boost.org for most recent version including documentation.
|
// See http://www.boost.org for most recent version including documentation.
|
||||||
|
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <cwchar>
|
#include <cwchar>
|
||||||
|
#include <limits>
|
||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
|
|
||||||
#if !defined(WCHAR_MIN)
|
#if !defined(WCHAR_MIN)
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
namespace boost{
|
namespace boost{
|
||||||
|
|
||||||
namespace my_conditions {
|
namespace my_conditions {
|
||||||
BOOST_STATIC_ASSERT(sizeof(int) * CHAR_BIT >= 32);
|
BOOST_STATIC_ASSERT(std::numeric_limits<int>::digits >= 32);
|
||||||
BOOST_STATIC_ASSERT(WCHAR_MIN >= 0);
|
BOOST_STATIC_ASSERT(WCHAR_MIN >= 0);
|
||||||
|
|
||||||
} // namespace my_conditions
|
} // namespace my_conditions
|
||||||
@@ -30,3 +30,5 @@ int main()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,19 +1,18 @@
|
|||||||
// (C) Copyright John Maddock 2000.
|
// (C) Copyright John Maddock 2000.
|
||||||
// Permission to copy, use, modify, sell and
|
// Use, modification and distribution are subject to the
|
||||||
// distribute this software is granted provided this copyright notice appears
|
// Boost Software License, Version 1.0. (See accompanying file
|
||||||
// in all copies. This software is provided "as is" without express or implied
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
|
|
||||||
// See http://www.boost.org for most recent version including documentation.
|
// See http://www.boost.org for most recent version including documentation.
|
||||||
|
|
||||||
|
#include <boost/static_assert.hpp>
|
||||||
|
#include <boost/type_traits.hpp>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <boost/static_assert.hpp>
|
|
||||||
#include <boost/type_traits.hpp>
|
|
||||||
|
|
||||||
template <class RandomAccessIterator >
|
template <class RandomAccessIterator >
|
||||||
RandomAccessIterator foo(RandomAccessIterator from, RandomAccessIterator to)
|
RandomAccessIterator foo(RandomAccessIterator from, RandomAccessIterator /*to*/)
|
||||||
{
|
{
|
||||||
// this template can only be used with
|
// this template can only be used with
|
||||||
// random access iterators...
|
// random access iterators...
|
||||||
@@ -38,3 +37,4 @@ int main()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,12 +1,11 @@
|
|||||||
// (C) Copyright John Maddock 2000.
|
// (C) Copyright John Maddock 2000.
|
||||||
// Permission to copy, use, modify, sell and
|
// Use, modification and distribution are subject to the
|
||||||
// distribute this software is granted provided this copyright notice appears
|
// Boost Software License, Version 1.0. (See accompanying file
|
||||||
// in all copies. This software is provided "as is" without express or implied
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
|
|
||||||
// See http://www.boost.org for most recent version including documentation.
|
// See http://www.boost.org for most recent version including documentation.
|
||||||
|
|
||||||
#include <climits>
|
#include <limits>
|
||||||
#include <boost/limits.hpp>
|
#include <boost/limits.hpp>
|
||||||
#include <boost/static_assert.hpp>
|
#include <boost/static_assert.hpp>
|
||||||
|
|
||||||
@@ -14,8 +13,8 @@ template <class UnsignedInt>
|
|||||||
class myclass
|
class myclass
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
BOOST_STATIC_ASSERT(sizeof(UnsignedInt) * CHAR_BIT >= 16);
|
BOOST_STATIC_ASSERT((std::numeric_limits<UnsignedInt>::digits >= 16)
|
||||||
BOOST_STATIC_ASSERT(std::numeric_limits<UnsignedInt>::is_specialized
|
&& std::numeric_limits<UnsignedInt>::is_specialized
|
||||||
&& std::numeric_limits<UnsignedInt>::is_integer
|
&& std::numeric_limits<UnsignedInt>::is_integer
|
||||||
&& !std::numeric_limits<UnsignedInt>::is_signed);
|
&& !std::numeric_limits<UnsignedInt>::is_signed);
|
||||||
public:
|
public:
|
||||||
@@ -30,3 +29,5 @@ int main()
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
// (C) Copyright John Maddock 2000.
|
|
||||||
// Permission to copy, use, modify, sell and
|
|
||||||
// distribute this software is granted provided this copyright notice appears
|
|
||||||
// in all copies. This software is provided "as is" without express or implied
|
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
|
|
||||||
// See http://www.boost.org/libs/static_assert for documentation.
|
|
||||||
|
|
||||||
/*
|
|
||||||
Revision history:
|
|
||||||
02 August 2000
|
|
||||||
Initial version.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef BOOST_STATIC_ASSERT_HPP
|
|
||||||
#define BOOST_STATIC_ASSERT_HPP
|
|
||||||
|
|
||||||
#include <boost/config.hpp>
|
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
//
|
|
||||||
// workaround for buggy integral-constant expression support:
|
|
||||||
#define BOOST_BUGGY_INTEGRAL_CONSTANT_EXPRESSIONS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace boost{
|
|
||||||
|
|
||||||
// HP aCC cannot deal with missing names for template value parameters
|
|
||||||
template <bool x> struct STATIC_ASSERTION_FAILURE;
|
|
||||||
|
|
||||||
template <> struct STATIC_ASSERTION_FAILURE<true> { enum { value = 1 }; };
|
|
||||||
|
|
||||||
// HP aCC cannot deal with missing names for template value parameters
|
|
||||||
template<int x> struct static_assert_test{};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//
|
|
||||||
// Implicit instantiation requires that all member declarations be
|
|
||||||
// instantiated, but that the definitions are *not* instantiated.
|
|
||||||
//
|
|
||||||
// It's not particularly clear how this applies to enum's or typedefs;
|
|
||||||
// both are described as declarations [7.1.3] and [7.2] in the standard,
|
|
||||||
// however some compilers use "delayed evaluation" of one or more of
|
|
||||||
// these when implicitly instantiating templates. We use typedef declarations
|
|
||||||
// by default, but try defining BOOST_USE_ENUM_STATIC_ASSERT if the enum
|
|
||||||
// version gets better results from your compiler...
|
|
||||||
//
|
|
||||||
// Implementation:
|
|
||||||
// Both of these versions rely on sizeof(incomplete_type) generating an error
|
|
||||||
// message containing the name of the incomplete type. We use
|
|
||||||
// "STATIC_ASSERTION_FAILURE" as the type name here to generate
|
|
||||||
// an eye catching error message. The result of the sizeof expression is either
|
|
||||||
// used as an enum initialiser, or as a template argument depending which version
|
|
||||||
// is in use...
|
|
||||||
// Note that the argument to the assert is explicitly cast to bool using old-
|
|
||||||
// style casts: too many compilers currently have problems with static_cast
|
|
||||||
// when used inside integral constant expressions.
|
|
||||||
//
|
|
||||||
#if !defined(BOOST_BUGGY_INTEGRAL_CONSTANT_EXPRESSIONS) && !defined(__MWERKS__)
|
|
||||||
|
|
||||||
#if defined(BOOST_MSVC)
|
|
||||||
// __LINE__ macro broken when -ZI is used see Q199057
|
|
||||||
// fortunately MSVC ignores duplicate typedef's.
|
|
||||||
#define BOOST_STATIC_ASSERT( B ) \
|
|
||||||
typedef ::boost::static_assert_test<\
|
|
||||||
sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >)\
|
|
||||||
> boost_static_assert_typedef_
|
|
||||||
#elif defined(BOOST_INTEL_CXX_VERSION)
|
|
||||||
// agurt 15/sep/02: a special care is needed to force Intel C++ issue an error
|
|
||||||
// instead of warning in case of failure
|
|
||||||
# define BOOST_STATIC_ASSERT( B ) \
|
|
||||||
typedef char BOOST_JOIN(boost_static_assert_typedef_, __LINE__) \
|
|
||||||
[ ::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >::value ]
|
|
||||||
#else
|
|
||||||
// generic version
|
|
||||||
#define BOOST_STATIC_ASSERT( B ) \
|
|
||||||
typedef ::boost::static_assert_test<\
|
|
||||||
sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >)>\
|
|
||||||
BOOST_JOIN(boost_static_assert_typedef_, __LINE__)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#else
|
|
||||||
// alternative enum based implementation:
|
|
||||||
#define BOOST_STATIC_ASSERT( B ) \
|
|
||||||
enum { BOOST_JOIN(boost_static_assert_enum_, __LINE__) \
|
|
||||||
= sizeof(::boost::STATIC_ASSERTION_FAILURE< (bool)( B ) >) }
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#endif // BOOST_STATIC_ASSERT_HPP
|
|
||||||
12
include/boost/static_assert/detail/backward.hpp
Normal file
12
include/boost/static_assert/detail/backward.hpp
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
// Copyright 2025 Peter Dimov
|
||||||
|
// Distributed under the Boost Software License, Version 1.0.
|
||||||
|
// https://www.boost.org/LICENSE_1_0.txt
|
||||||
|
//
|
||||||
|
// This header is unused and is only present for backward compatibility.
|
||||||
|
// Without it, StaticAssert would be the only library without an include/
|
||||||
|
// directory, and this breaks third-party installation scripts and logic.
|
||||||
|
|
||||||
|
// Introduce an artificial dependency on Config, such that libraries that
|
||||||
|
// link to StaticAssert depend on the new location of boost/static_assert.hpp
|
||||||
|
|
||||||
|
#include <boost/config.hpp>
|
||||||
20
index.html
20
index.html
@@ -1,9 +1,15 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="refresh" content="0; URL=static_assert.htm">
|
<meta http-equiv="refresh" content="0; URL=../config/index.html">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
Automatic redirection failed, please go to
|
Automatic redirection failed, please go to
|
||||||
<a href="static_assert.htm">static_assert.htm</a>.
|
<a href="../config/index.html">../config/index.html</a>.
|
||||||
</body>
|
<P>Copyright John Maddock 2006</P>
|
||||||
|
<P>Distributed under the Boost Software License, Version 1.0. (See accompanying file <A href="../../LICENSE_1_0.txt">
|
||||||
|
LICENSE_1_0.txt</A> or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</A>).</P>
|
||||||
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
17
meta/libraries.json
Normal file
17
meta/libraries.json
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"key": "static_assert",
|
||||||
|
"name": "Static Assert",
|
||||||
|
"authors": [
|
||||||
|
"John Maddock"
|
||||||
|
],
|
||||||
|
"description": "Static assertions (compile time assertions). Merged into Boost.Config.",
|
||||||
|
"category": [
|
||||||
|
"Correctness",
|
||||||
|
"Generic",
|
||||||
|
"Metaprogramming"
|
||||||
|
],
|
||||||
|
"maintainers": [
|
||||||
|
"John Maddock <john -at- johnmaddock.co.uk>"
|
||||||
|
],
|
||||||
|
"cxxstd": "03"
|
||||||
|
}
|
||||||
@@ -1,279 +1,15 @@
|
|||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
||||||
<html>
|
<html>
|
||||||
|
<head>
|
||||||
<head>
|
<meta http-equiv="refresh" content="0; URL=../config/index.html">
|
||||||
<meta http-equiv="Content-Type"
|
</head>
|
||||||
content="text/html; charset=iso-8859-1">
|
<body>
|
||||||
<meta name="Template"
|
Automatic redirection failed, please go to
|
||||||
content="C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE\html.dot">
|
<a href="../config/index.html">../config/index.html</a>.
|
||||||
<meta name="GENERATOR" content="Microsoft FrontPage Express 2.0">
|
<P>Copyright John Maddock 2006</P>
|
||||||
<title>static assertions</title>
|
<P>Distributed under the Boost Software License, Version 1.0. (See accompanying file <A href="../../LICENSE_1_0.txt">
|
||||||
</head>
|
LICENSE_1_0.txt</A> or copy at <A href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</A>).</P>
|
||||||
|
</body>
|
||||||
<body bgcolor="#FFFFFF" text="#000000" link="#0000FF"
|
|
||||||
vlink="#800080">
|
|
||||||
|
|
||||||
<h1><img src="../../c++boost.gif" width="276" height="86">Header
|
|
||||||
<<a href="../../boost/static_assert.hpp">boost/static_assert.hpp</a>></h1>
|
|
||||||
|
|
||||||
<p>The header <boost/static_assert.hpp> supplies a single
|
|
||||||
macro BOOST_STATIC_ASSERT(x), which generates a compile time
|
|
||||||
error message if the <a
|
|
||||||
href="../../more/int_const_guidelines.htm">integral-constant-expression</a>
|
|
||||||
<i>x</i> is not true. In other words it is the compile time
|
|
||||||
equivalent of the assert macro; this is sometimes known as a
|
|
||||||
"compile-time-assertion", but will be called a "static
|
|
||||||
assertion" throughout these docs. Note that if the condition
|
|
||||||
is true, then the macro will generate neither code nor data - and
|
|
||||||
the macro can also be used at either namespace, class or function
|
|
||||||
scope. When used in a template, the static assertion will be
|
|
||||||
evaluated at the time the template is instantiated; this is
|
|
||||||
particularly useful for validating template parameters. </p>
|
|
||||||
|
|
||||||
<p>One of the aims of BOOST_STATIC_ASSERT is to generate readable
|
|
||||||
error messages. These immediately tell the user that a library is
|
|
||||||
being used in a manner that is not supported. While error
|
|
||||||
messages obviously differ from compiler to compiler, but you
|
|
||||||
should see something like: </p>
|
|
||||||
|
|
||||||
<pre>Illegal use of COMPILE_TIME_ASSERTION_FAILURE<false></pre>
|
|
||||||
|
|
||||||
<p>Which is intended to at least catch the eye!</p>
|
|
||||||
|
|
||||||
<p>You can use BOOST_STATIC_ASSERT at any place where you can
|
|
||||||
place a declaration, that is at <a href="#class">class</a>, <a
|
|
||||||
href="#function">function</a> or <a href="#namespace">namespace</a>
|
|
||||||
scope, this is illustrated by the following examples:</p>
|
|
||||||
|
|
||||||
<h3><a name="namespace"></a>Use at namespace scope.</h3>
|
|
||||||
|
|
||||||
<p>The macro can be used at namespace scope, if there is some
|
|
||||||
requirement must always be true; generally this means some
|
|
||||||
platform specific requirement. Suppose we require that <b>int</b>
|
|
||||||
be at least a 32-bit integral type, and that <b>wchar_t</b> be an
|
|
||||||
unsigned type. We can verify this at compile time as follows:</p>
|
|
||||||
|
|
||||||
<pre>#include <climits>
|
|
||||||
#include <cwchar>
|
|
||||||
#include <boost/static_assert.hpp>
|
|
||||||
|
|
||||||
namespace my_conditions {
|
|
||||||
|
|
||||||
BOOST_STATIC_ASSERT(sizeof(int) * CHAR_BIT >= 32);
|
|
||||||
BOOST_STATIC_ASSERT(WCHAR_MIN >= 0);
|
|
||||||
|
|
||||||
} // namespace my_conditions
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<p>The use of the namespace <i>my_conditions</i> here requires
|
|
||||||
some comment. The macro BOOST_STATIC_ASSERT works by generating
|
|
||||||
an <strong>typedef</strong> declaration, and since the typedef
|
|
||||||
must have a name, the macro generates one automatically by
|
|
||||||
mangling a stub name with the value of __LINE__. When
|
|
||||||
BOOST_STATIC_ASSERT is used at either class or function scope
|
|
||||||
then each use of BOOST_STATIC_ASSERT is guaranteed to produce a
|
|
||||||
name unique to that scope (provided you only use the macro once
|
|
||||||
on each line). However when used in a header at namespace scope,
|
|
||||||
that namespace can be continued over multiple headers, each of
|
|
||||||
which may have their own static assertions, and on the "same"
|
|
||||||
lines, thereby generating duplicate declarations. In theory the
|
|
||||||
compiler should silently ignore duplicate typedef declarations,
|
|
||||||
however many do not do so (and even if they do they are entitled
|
|
||||||
to emit warnings in such cases). To avoid potential problems, if
|
|
||||||
you use BOOST_STATIC_ASSERT in a header and at namespace scope,
|
|
||||||
then enclose them in a namespace unique to that header.</p>
|
|
||||||
|
|
||||||
<h3><a name="function"></a>Use at function scope</h3>
|
|
||||||
|
|
||||||
<p>The macro is typically used at function scope inside template
|
|
||||||
functions, when the template arguments need checking. Imagine
|
|
||||||
that we have an iterator-based algorithm that requires random
|
|
||||||
access iterators. If the algorithm is instantiated with iterators
|
|
||||||
that do not meet our requirements then an error will be generated
|
|
||||||
eventually, but this may be nested deep inside several templates,
|
|
||||||
making it hard for the user to determine what went wrong. One
|
|
||||||
option is to add a static assertion at the top level of the
|
|
||||||
template, in that case if the condition is not met, then an error
|
|
||||||
will be generated in a way that makes it reasonably obvious to
|
|
||||||
the user that the template is being misused.</p>
|
|
||||||
|
|
||||||
<pre>#include <iterator>
|
|
||||||
#include <boost/static_assert.hpp>
|
|
||||||
#include <boost/type_traits.hpp>
|
|
||||||
|
|
||||||
template <class RandomAccessIterator >
|
|
||||||
RandomAccessIterator foo(RandomAccessIterator from, RandomAccessIterator to)
|
|
||||||
{
|
|
||||||
// this template can only be used with
|
|
||||||
// random access iterators...
|
|
||||||
typedef typename std::iterator_traits< RandomAccessIterator >::iterator_category cat;
|
|
||||||
BOOST_STATIC_ASSERT((boost::is_convertible<cat, const std::random_access_iterator_tag&>::value));
|
|
||||||
//
|
|
||||||
// detail goes here...
|
|
||||||
return from;
|
|
||||||
}</pre>
|
|
||||||
|
|
||||||
<p>A couple of footnotes are in order here: the extra set of
|
|
||||||
parenthesis around the assert, is to prevent the comma inside the
|
|
||||||
is_convertible template being interpreted by the preprocessor as
|
|
||||||
a macro argument separator; the target type for is_convertible is
|
|
||||||
a reference type, as some compilers have problems using
|
|
||||||
is_convertible when the conversion is via a user defined
|
|
||||||
constructor (in any case there is no guarantee that the iterator
|
|
||||||
tag classes are copy-constructible).</p>
|
|
||||||
|
|
||||||
<h3><a name="class"></a>Use at class scope</h3>
|
|
||||||
|
|
||||||
<p>The macro is typically used inside classes that are templates.
|
|
||||||
Suppose we have a template-class that requires an unsigned
|
|
||||||
integral type with at least 16-bits of precision as a template
|
|
||||||
argument, we can achieve this using something like this:</p>
|
|
||||||
|
|
||||||
<pre>#include <climits>
|
|
||||||
#include <boost/static_assert.hpp>
|
|
||||||
|
|
||||||
template <class UnsignedInt>
|
|
||||||
class myclass
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
BOOST_STATIC_ASSERT(sizeof(UnsignedInt) * CHAR_BIT >= 16);
|
|
||||||
BOOST_STATIC_ASSERT(std::numeric_limits<UnsignedInt>::is_specialized
|
|
||||||
&& std::numeric_limits<UnsignedInt>::is_integer
|
|
||||||
&& !std::numeric_limits<UnsignedInt>::is_signed);
|
|
||||||
public:
|
|
||||||
/* details here */
|
|
||||||
};
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
<h3>How it works</h3>
|
|
||||||
|
|
||||||
<p>BOOST_STATIC_ASSERT works as follows. There is class
|
|
||||||
STATIC_ASSERTION_FAILURE which is defined as:</p>
|
|
||||||
|
|
||||||
<pre>namespace boost{
|
|
||||||
|
|
||||||
template <bool> struct STATIC_ASSERTION_FAILURE;
|
|
||||||
|
|
||||||
template <> struct STATIC_ASSERTION_FAILURE<true>{};
|
|
||||||
|
|
||||||
}</pre>
|
|
||||||
|
|
||||||
<p>The key feature is that the error message triggered by the
|
|
||||||
undefined expression sizeof(STATIC_ASSERTION_FAILURE<0>),
|
|
||||||
tends to be consistent across a wide variety of compilers. The
|
|
||||||
rest of the machinery of BOOST_STATIC_ASSERT is just a way to
|
|
||||||
feed the sizeof expression into a typedef. The use of a macro
|
|
||||||
here is somewhat ugly; however boost members have spent
|
|
||||||
considerable effort trying to invent a static assert that avoided
|
|
||||||
macros, all to no avail. The general conclusion was that the good
|
|
||||||
of a static assert working at namespace, function, and class
|
|
||||||
scope outweighed the ugliness of a macro.</p>
|
|
||||||
|
|
||||||
<h3>Test Programs</h3>
|
|
||||||
|
|
||||||
<p>The following test programs are provided with this library:</p>
|
|
||||||
|
|
||||||
<table border="0" width="100%">
|
|
||||||
<tr>
|
|
||||||
<td width="33%"><i>Test Program</i></td>
|
|
||||||
<td width="33%"><i>Expected to Compile</i></td>
|
|
||||||
<td width="34%"><i>Description</i></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="33%"><a href="static_assert_test.cpp">static_assert_test.cpp</a></td>
|
|
||||||
<td width="33%">Yes</td>
|
|
||||||
<td width="34%">Illustrates usage, and should always
|
|
||||||
compile, really just tests compiler compatibility.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="33%"><a href="static_assert_example_1.cpp">static_assert_example_1.cpp</a></td>
|
|
||||||
<td width="33%">Platform dependent.</td>
|
|
||||||
<td width="34%">Namespace scope test program, may compile
|
|
||||||
depending upon the platform.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="33%"><a href="static_assert_example_2.cpp">static_assert_example_2.cpp</a></td>
|
|
||||||
<td width="33%">Yes</td>
|
|
||||||
<td width="34%">Function scope test program.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="33%"><a href="static_assert_example_3.cpp">static_assert_example_3.cpp</a></td>
|
|
||||||
<td width="33%">Yes</td>
|
|
||||||
<td width="34%">Class scope test program.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="33%"><a href="static_assert_test_fail_1.cpp">static_assert_test_fail_1.cpp</a></td>
|
|
||||||
<td width="33%">No</td>
|
|
||||||
<td width="34%">Illustrates failure at namespace scope.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="33%"><a href="static_assert_test_fail_2.cpp">static_assert_test_fail_2.cpp</a></td>
|
|
||||||
<td width="33%">No</td>
|
|
||||||
<td width="34%">Illustrates failure at non-template
|
|
||||||
function scope.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="33%"><a href="static_assert_test_fail_3.cpp">static_assert_test_fail_3.cpp</a></td>
|
|
||||||
<td width="33%">No</td>
|
|
||||||
<td width="34%">Illustrates failure at non-template class
|
|
||||||
scope.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="33%"><a href="static_assert_test_fail_4.cpp">static_assert_test_fail_4.cpp</a></td>
|
|
||||||
<td width="33%">No</td>
|
|
||||||
<td width="34%">Illustrates failure at non-template class
|
|
||||||
scope.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="33%"><a href="static_assert_test_fail_5.cpp">static_assert_test_fail_5.cpp</a></td>
|
|
||||||
<td width="33%">No</td>
|
|
||||||
<td width="34%">Illustrates failure at template class
|
|
||||||
scope.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="33%"><a href="static_assert_test_fail_6.cpp">static_assert_test_fail_6.cpp</a></td>
|
|
||||||
<td width="33%">No</td>
|
|
||||||
<td width="34%">Illustrates failure at template class
|
|
||||||
member function scope.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td width="33%"><a href="static_assert_test_fail_7.cpp">static_assert_test_fail_7.cpp</a></td>
|
|
||||||
<td width="33%">No</td>
|
|
||||||
<td width="34%">Illustrates failure of class scope
|
|
||||||
example.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><a href="static_assert_test_fail_8.cpp">static_assert_test_fail_8.cpp</a></td>
|
|
||||||
<td>No</td>
|
|
||||||
<td>Illustrates failure of function scope example.</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><a href="static_assert_test_fail_9.cpp">static_assert_test_fail_9.cpp</a></td>
|
|
||||||
<td>No</td>
|
|
||||||
<td>Illustrates failure of function scope example (part 2).</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
<p>Revised 27th Nov 2000</p>
|
|
||||||
|
|
||||||
<p>Documentation © Copyright John Maddock 2000. Permission to
|
|
||||||
copy, use, modify, sell and distribute this document is granted
|
|
||||||
provided this copyright notice appears in all copies. This
|
|
||||||
document is provided "as is" without express or implied
|
|
||||||
warranty, and with no claim as to its suitability for any purpose.</p>
|
|
||||||
|
|
||||||
<p>Based on contributions by Steve Cleary and John Maddock.</p>
|
|
||||||
|
|
||||||
<p>Maintained by <a href="mailto:John_Maddock@compuserve.com">John
|
|
||||||
Maddock</a>, the latest version of this file can be found at <a
|
|
||||||
href="http://www.boost.org/">www.boost.org</a>, and the boost
|
|
||||||
discussion list at <a
|
|
||||||
href="http://www.yahoogroups.com/list/boost">www.yahoogroups.com/list/boost</a>.
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p> </p>
|
|
||||||
|
|
||||||
<p> </p>
|
|
||||||
</body>
|
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
// (C) Copyright Steve Cleary & John Maddock 2000.
|
|
||||||
// Permission to copy, use, modify, sell and
|
|
||||||
// distribute this software is granted provided this copyright notice appears
|
|
||||||
// in all copies. This software is provided "as is" without express or implied
|
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
|
|
||||||
// See http://www.boost.org for most recent version including documentation.
|
|
||||||
|
|
||||||
#include <boost/static_assert.hpp>
|
|
||||||
|
|
||||||
//
|
|
||||||
// all these tests should fail:
|
|
||||||
//
|
|
||||||
|
|
||||||
// Namespace scope
|
|
||||||
BOOST_STATIC_ASSERT(sizeof(int) == sizeof(char)); // will not compile
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
// (C) Copyright Steve Cleary & John Maddock 2000.
|
|
||||||
// Permission to copy, use, modify, sell and
|
|
||||||
// distribute this software is granted provided this copyright notice appears
|
|
||||||
// in all copies. This software is provided "as is" without express or implied
|
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
|
|
||||||
// See http://www.boost.org for most recent version including documentation.
|
|
||||||
|
|
||||||
#include <boost/static_assert.hpp>
|
|
||||||
|
|
||||||
//
|
|
||||||
// all these tests should fail:
|
|
||||||
//
|
|
||||||
|
|
||||||
// Function (block) scope
|
|
||||||
void f()
|
|
||||||
{
|
|
||||||
BOOST_STATIC_ASSERT(sizeof(int) == sizeof(char)); // should not compile
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
11
test/CMakeLists.txt
Normal file
11
test/CMakeLists.txt
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# Copyright 2018, 2019 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
|
||||||
|
|
||||||
|
include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
|
||||||
|
|
||||||
|
if(HAVE_BOOST_TEST)
|
||||||
|
|
||||||
|
boost_test_jamfile(FILE Jamfile.v2 LINK_LIBRARIES Boost::static_assert)
|
||||||
|
|
||||||
|
endif()
|
||||||
25
test/Jamfile.v2
Normal file
25
test/Jamfile.v2
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
# copyright John Maddock 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)
|
||||||
|
|
||||||
|
# bring in the rules for testing
|
||||||
|
import testing ;
|
||||||
|
|
||||||
|
project : requirements
|
||||||
|
<library>/boost/type_traits//boost_type_traits
|
||||||
|
;
|
||||||
|
|
||||||
|
run static_assert_test.cpp ;
|
||||||
|
compile-fail static_assert_test_fail_1.cpp ;
|
||||||
|
compile-fail static_assert_test_fail_2.cpp ;
|
||||||
|
compile-fail static_assert_test_fail_3.cpp ;
|
||||||
|
compile-fail static_assert_test_fail_4.cpp ;
|
||||||
|
compile-fail static_assert_test_fail_5.cpp ;
|
||||||
|
compile-fail static_assert_test_fail_6.cpp ;
|
||||||
|
compile-fail static_assert_test_fail_7.cpp ;
|
||||||
|
compile-fail static_assert_test_fail_8.cpp ;
|
||||||
|
compile-fail static_assert_test_fail_9.cpp ;
|
||||||
|
compile-fail static_assert_test_fail_10.cpp ;
|
||||||
|
|
||||||
|
build-project ../example ;
|
||||||
17
test/cmake_install_test/CMakeLists.txt
Normal file
17
test/cmake_install_test/CMakeLists.txt
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
# Copyright 2018, 2019 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
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.5...3.16)
|
||||||
|
|
||||||
|
project(cmake_install_test LANGUAGES CXX)
|
||||||
|
|
||||||
|
find_package(boost_static_assert REQUIRED)
|
||||||
|
|
||||||
|
add_executable(main main.cpp)
|
||||||
|
target_link_libraries(main Boost::static_assert)
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
|
add_test(NAME main COMMAND main)
|
||||||
|
|
||||||
|
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||||
7
test/cmake_install_test/main.cpp
Normal file
7
test/cmake_install_test/main.cpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#include <boost/static_assert.hpp>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int const x = 5;
|
||||||
|
BOOST_STATIC_ASSERT( x > 4 );
|
||||||
|
}
|
||||||
18
test/cmake_subdir_test/CMakeLists.txt
Normal file
18
test/cmake_subdir_test/CMakeLists.txt
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
# Copyright 2018, 2019 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
|
||||||
|
|
||||||
|
cmake_minimum_required(VERSION 3.5...3.16)
|
||||||
|
|
||||||
|
project(cmake_subdir_test LANGUAGES CXX)
|
||||||
|
|
||||||
|
add_subdirectory(../../../static_assert boostorg/static_assert)
|
||||||
|
add_subdirectory(../../../config boostorg/config)
|
||||||
|
|
||||||
|
add_executable(main main.cpp)
|
||||||
|
target_link_libraries(main Boost::static_assert)
|
||||||
|
|
||||||
|
enable_testing()
|
||||||
|
add_test(NAME main COMMAND main)
|
||||||
|
|
||||||
|
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
|
||||||
7
test/cmake_subdir_test/main.cpp
Normal file
7
test/cmake_subdir_test/main.cpp
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#include <boost/static_assert.hpp>
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
int const x = 5;
|
||||||
|
BOOST_STATIC_ASSERT( x > 4 );
|
||||||
|
}
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
// (C) Copyright Steve Cleary & John Maddock 2000.
|
// (C) Copyright Steve Cleary & John Maddock 2000.
|
||||||
// Permission to copy, use, modify, sell and
|
// Use, modification and distribution are subject to the
|
||||||
// distribute this software is granted provided this copyright notice appears
|
// Boost Software License, Version 1.0. (See accompanying file
|
||||||
// in all copies. This software is provided "as is" without express or implied
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
|
|
||||||
// See http://www.boost.org for most recent version including documentation.
|
// See http://www.boost.org for most recent version including documentation.
|
||||||
|
|
||||||
@@ -17,12 +16,16 @@
|
|||||||
// Namespace scope
|
// Namespace scope
|
||||||
BOOST_STATIC_ASSERT(sizeof(int) >= sizeof(short));
|
BOOST_STATIC_ASSERT(sizeof(int) >= sizeof(short));
|
||||||
BOOST_STATIC_ASSERT(sizeof(char) == 1);
|
BOOST_STATIC_ASSERT(sizeof(char) == 1);
|
||||||
|
BOOST_STATIC_ASSERT_MSG(sizeof(int) >= sizeof(short), "msg1");
|
||||||
|
BOOST_STATIC_ASSERT_MSG(sizeof(char) == 1, "msg2");
|
||||||
|
|
||||||
// Function (block) scope
|
// Function (block) scope
|
||||||
void f()
|
void f()
|
||||||
{
|
{
|
||||||
BOOST_STATIC_ASSERT(sizeof(int) >= sizeof(short));
|
BOOST_STATIC_ASSERT(sizeof(int) >= sizeof(short));
|
||||||
BOOST_STATIC_ASSERT(sizeof(char) == 1);
|
BOOST_STATIC_ASSERT(sizeof(char) == 1);
|
||||||
|
BOOST_STATIC_ASSERT_MSG(sizeof(int) >= sizeof(short), "msg3");
|
||||||
|
BOOST_STATIC_ASSERT_MSG(sizeof(char) == 1, "msg4");
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Bob
|
struct Bob
|
||||||
@@ -30,6 +33,8 @@ struct Bob
|
|||||||
private: // can be in private, to avoid namespace pollution
|
private: // can be in private, to avoid namespace pollution
|
||||||
BOOST_STATIC_ASSERT(sizeof(int) >= sizeof(short));
|
BOOST_STATIC_ASSERT(sizeof(int) >= sizeof(short));
|
||||||
BOOST_STATIC_ASSERT(sizeof(char) == 1);
|
BOOST_STATIC_ASSERT(sizeof(char) == 1);
|
||||||
|
BOOST_STATIC_ASSERT_MSG(sizeof(int) >= sizeof(short), "msg5");
|
||||||
|
BOOST_STATIC_ASSERT_MSG(sizeof(char) == 1, "msg6");
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Member function scope: provides access to member variables
|
// Member function scope: provides access to member variables
|
||||||
@@ -37,9 +42,11 @@ struct Bob
|
|||||||
char c;
|
char c;
|
||||||
int f()
|
int f()
|
||||||
{
|
{
|
||||||
#ifndef _MSC_VER // broken sizeof in VC6
|
#if defined(_MSC_VER) && _MSC_VER < 1300 // broken sizeof in VC6
|
||||||
BOOST_STATIC_ASSERT(sizeof(x) >= sizeof(short));
|
BOOST_STATIC_ASSERT(sizeof(x) >= sizeof(short));
|
||||||
BOOST_STATIC_ASSERT(sizeof(c) == 1);
|
BOOST_STATIC_ASSERT(sizeof(c) == 1);
|
||||||
|
BOOST_STATIC_ASSERT_MSG(sizeof(x) >= sizeof(short), "msg7");
|
||||||
|
BOOST_STATIC_ASSERT_MSG(sizeof(c) == 1, "msg8");
|
||||||
#endif
|
#endif
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
@@ -51,8 +58,10 @@ struct Bob
|
|||||||
template <class Int, class Char>
|
template <class Int, class Char>
|
||||||
struct Bill
|
struct Bill
|
||||||
{
|
{
|
||||||
|
BOOST_STATIC_CONSTANT(int, value = 1);
|
||||||
private: // can be in private, to avoid namespace pollution
|
private: // can be in private, to avoid namespace pollution
|
||||||
BOOST_STATIC_ASSERT(sizeof(Int) > sizeof(char));
|
BOOST_STATIC_ASSERT(sizeof(Int) > sizeof(char));
|
||||||
|
BOOST_STATIC_ASSERT_MSG(sizeof(Int) > sizeof(char), "msg9");
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Template member function scope: provides access to member variables
|
// Template member function scope: provides access to member variables
|
||||||
@@ -63,10 +72,12 @@ struct Bill
|
|||||||
{
|
{
|
||||||
BOOST_STATIC_ASSERT(sizeof(Int) == sizeof(Int2));
|
BOOST_STATIC_ASSERT(sizeof(Int) == sizeof(Int2));
|
||||||
BOOST_STATIC_ASSERT(sizeof(Char) == sizeof(Char2));
|
BOOST_STATIC_ASSERT(sizeof(Char) == sizeof(Char2));
|
||||||
|
BOOST_STATIC_ASSERT_MSG(sizeof(Int) == sizeof(Int2), "msg10");
|
||||||
|
BOOST_STATIC_ASSERT_MSG(sizeof(Char) == sizeof(Char2), "msg11");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void test_Bill() // BOOST_CT_ASSERTs are not triggerred until instantiated
|
void test_Bill() // BOOST_STATIC_ASSERTs are not triggerred until instantiated
|
||||||
{
|
{
|
||||||
Bill<int, char> z;
|
Bill<int, char> z;
|
||||||
//Bill<int, int> bad; // will not compile
|
//Bill<int, int> bad; // will not compile
|
||||||
@@ -79,8 +90,18 @@ void test_Bill() // BOOST_CT_ASSERTs are not triggerred until instantiated
|
|||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
test_Bill();
|
test_Bill();
|
||||||
|
//
|
||||||
|
// Test variadic macro support:
|
||||||
|
//
|
||||||
|
#ifndef BOOST_NO_CXX11_VARIADIC_MACROS
|
||||||
|
BOOST_STATIC_ASSERT(Bill<int, char>::value);
|
||||||
|
#ifndef BOOST_NO_CXX11_STATIC_ASSERT
|
||||||
|
BOOST_STATIC_ASSERT_MSG(Bill<int, char>::value, "This is a message");
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
23
test/static_assert_test_fail_1.cpp
Normal file
23
test/static_assert_test_fail_1.cpp
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
// (C) Copyright Steve Cleary & John Maddock 2000.
|
||||||
|
// 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 for most recent version including documentation.
|
||||||
|
|
||||||
|
#include <boost/static_assert.hpp>
|
||||||
|
|
||||||
|
//
|
||||||
|
// all these tests should fail:
|
||||||
|
//
|
||||||
|
typedef char a1[2];
|
||||||
|
typedef char a2[3];
|
||||||
|
|
||||||
|
// Namespace scope
|
||||||
|
BOOST_STATIC_ASSERT(sizeof(a1) == sizeof(a2)); // will not compile
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
18
test/static_assert_test_fail_10.cpp
Normal file
18
test/static_assert_test_fail_10.cpp
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
//~ Copyright 2005 Redshift Software, Inc.
|
||||||
|
//~ Distributed under the Boost Software License, Version 1.0.
|
||||||
|
//~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
#include <boost/static_assert.hpp>
|
||||||
|
|
||||||
|
template <int N>
|
||||||
|
int foo()
|
||||||
|
{
|
||||||
|
BOOST_STATIC_ASSERT( N < 2 );
|
||||||
|
|
||||||
|
return N;
|
||||||
|
}
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
return foo<5>();
|
||||||
|
}
|
||||||
25
test/static_assert_test_fail_2.cpp
Normal file
25
test/static_assert_test_fail_2.cpp
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
// (C) Copyright Steve Cleary & John Maddock 2000.
|
||||||
|
// 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 for most recent version including documentation.
|
||||||
|
|
||||||
|
#include <boost/static_assert.hpp>
|
||||||
|
|
||||||
|
//
|
||||||
|
// all these tests should fail:
|
||||||
|
//
|
||||||
|
typedef char a1[2];
|
||||||
|
typedef char a2[3];
|
||||||
|
|
||||||
|
// Function (block) scope
|
||||||
|
void f()
|
||||||
|
{
|
||||||
|
BOOST_STATIC_ASSERT(sizeof(a1) == sizeof(a2)); // should not compile
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
// (C) Copyright Steve Cleary & John Maddock 2000.
|
// (C) Copyright Steve Cleary & John Maddock 2000.
|
||||||
// Permission to copy, use, modify, sell and
|
// Use, modification and distribution are subject to the
|
||||||
// distribute this software is granted provided this copyright notice appears
|
// Boost Software License, Version 1.0. (See accompanying file
|
||||||
// in all copies. This software is provided "as is" without express or implied
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
|
|
||||||
// See http://www.boost.org for most recent version including documentation.
|
// See http://www.boost.org for most recent version including documentation.
|
||||||
|
|
||||||
@@ -11,11 +10,13 @@
|
|||||||
//
|
//
|
||||||
// this tests should fail:
|
// this tests should fail:
|
||||||
//
|
//
|
||||||
|
typedef char a1[2];
|
||||||
|
typedef char a2[3];
|
||||||
|
|
||||||
struct Bob
|
struct Bob
|
||||||
{
|
{
|
||||||
private: // can be in private, to avoid namespace pollution
|
private: // can be in private, to avoid namespace pollution
|
||||||
BOOST_STATIC_ASSERT(sizeof(int) == sizeof(char)); // will not compile
|
BOOST_STATIC_ASSERT(sizeof(a1) == sizeof(a2)); // will not compile
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Member function scope: provides access to member variables
|
// Member function scope: provides access to member variables
|
||||||
@@ -27,7 +28,6 @@ struct Bob
|
|||||||
BOOST_STATIC_ASSERT(sizeof(x) == 4);
|
BOOST_STATIC_ASSERT(sizeof(x) == 4);
|
||||||
BOOST_STATIC_ASSERT(sizeof(c) == 1);
|
BOOST_STATIC_ASSERT(sizeof(c) == 1);
|
||||||
#endif
|
#endif
|
||||||
//BOOST_STATIC_ASSERT((sizeof(x) == sizeof(c))); // should not compile
|
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -36,3 +36,4 @@ struct Bob
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
// (C) Copyright Steve Cleary & John Maddock 2000.
|
// (C) Copyright Steve Cleary & John Maddock 2000.
|
||||||
// Permission to copy, use, modify, sell and
|
// Use, modification and distribution are subject to the
|
||||||
// distribute this software is granted provided this copyright notice appears
|
// Boost Software License, Version 1.0. (See accompanying file
|
||||||
// in all copies. This software is provided "as is" without express or implied
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
|
|
||||||
// See http://www.boost.org for most recent version including documentation.
|
// See http://www.boost.org for most recent version including documentation.
|
||||||
|
|
||||||
@@ -19,7 +18,7 @@ struct Bob
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
// Member function scope: provides access to member variables
|
// Member function scope: provides access to member variables
|
||||||
int x;
|
char x[4];
|
||||||
char c;
|
char c;
|
||||||
int f()
|
int f()
|
||||||
{
|
{
|
||||||
@@ -36,3 +35,4 @@ struct Bob
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
// (C) Copyright Steve Cleary & John Maddock 2000.
|
// (C) Copyright Steve Cleary & John Maddock 2000.
|
||||||
// Permission to copy, use, modify, sell and
|
// Use, modification and distribution are subject to the
|
||||||
// distribute this software is granted provided this copyright notice appears
|
// Boost Software License, Version 1.0. (See accompanying file
|
||||||
// in all copies. This software is provided "as is" without express or implied
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
|
|
||||||
// See http://www.boost.org for most recent version including documentation.
|
// See http://www.boost.org for most recent version including documentation.
|
||||||
|
|
||||||
@@ -37,3 +36,4 @@ Bill<int, char> b;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
// (C) Copyright Steve Cleary & John Maddock 2000.
|
// (C) Copyright Steve Cleary & John Maddock 2000.
|
||||||
// Permission to copy, use, modify, sell and
|
// Use, modification and distribution are subject to the
|
||||||
// distribute this software is granted provided this copyright notice appears
|
// Boost Software License, Version 1.0. (See accompanying file
|
||||||
// in all copies. This software is provided "as is" without express or implied
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
|
|
||||||
// See http://www.boost.org for most recent version including documentation.
|
// See http://www.boost.org for most recent version including documentation.
|
||||||
|
|
||||||
@@ -44,3 +43,4 @@ void foo()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
// (C) Copyright John Maddock 2000.
|
// (C) Copyright John Maddock 2000.
|
||||||
// Permission to copy, use, modify, sell and
|
// Use, modification and distribution are subject to the
|
||||||
// distribute this software is granted provided this copyright notice appears
|
// Boost Software License, Version 1.0. (See accompanying file
|
||||||
// in all copies. This software is provided "as is" without express or implied
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
|
|
||||||
// See http://www.boost.org for most recent version including documentation.
|
// See http://www.boost.org for most recent version including documentation.
|
||||||
|
|
||||||
@@ -29,3 +28,4 @@ int main()
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
// (C) Copyright John Maddock 2000.
|
// (C) Copyright John Maddock 2000.
|
||||||
// Permission to copy, use, modify, sell and
|
// Use, modification and distribution are subject to the
|
||||||
// distribute this software is granted provided this copyright notice appears
|
// Boost Software License, Version 1.0. (See accompanying file
|
||||||
// in all copies. This software is provided "as is" without express or implied
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
|
|
||||||
// See http://www.boost.org for most recent version including documentation.
|
// See http://www.boost.org for most recent version including documentation.
|
||||||
|
|
||||||
@@ -24,6 +23,12 @@ RandomAccessIterator foo(RandomAccessIterator from, RandomAccessIterator)
|
|||||||
return from;
|
return from;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ensure that delayed instantiation compilers like Comeau see the failure early
|
||||||
|
// enough for "compile-fail" testing with the Boost.Build testing framework. (Greg Comeau)
|
||||||
|
template
|
||||||
|
std::list<int>::iterator
|
||||||
|
foo(std::list<int>::iterator, std::list<int>::iterator);
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
std::deque<int> d;
|
std::deque<int> d;
|
||||||
@@ -36,3 +41,4 @@ int main()
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,8 +1,7 @@
|
|||||||
// (C) Copyright John Maddock 2000.
|
// (C) Copyright John Maddock 2000.
|
||||||
// Permission to copy, use, modify, sell and
|
// Use, modification and distribution are subject to the
|
||||||
// distribute this software is granted provided this copyright notice appears
|
// Boost Software License, Version 1.0. (See accompanying file
|
||||||
// in all copies. This software is provided "as is" without express or implied
|
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
// warranty, and with no claim as to its suitability for any purpose.
|
|
||||||
|
|
||||||
// See http://www.boost.org for most recent version including documentation.
|
// See http://www.boost.org for most recent version including documentation.
|
||||||
|
|
||||||
@@ -30,3 +29,4 @@ int main()
|
|||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Reference in New Issue
Block a user