Replace travis and fix several warnings (#128)

* fix iteration warning
* fix c++20 warning of deprecated volatile ops
* fix warning of using naked throw
This commit is contained in:
Hans Dembinski 2020-10-31 20:40:11 +01:00 committed by GitHub
parent 6e78037c43
commit 2f91f037b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 92 additions and 103 deletions

View File

@ -1,4 +1,4 @@
name: C++ CI
name: Fast
on:
pull_request:
@ -18,7 +18,7 @@ jobs:
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: true
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: ctest
run: |
mkdir build

84
.github/workflows/slow.yml vendored Normal file
View File

@ -0,0 +1,84 @@
name: Slow
on:
pull_request:
branches:
- master
- develop
paths-ignore:
- 'doc/**'
- 'tools/**'
jobs:
superproject_cmake_and_b2:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: cmake from superproject
run: |
cd ..
git clone -b $GITHUB_BASE_REF --depth 5 https://github.com/boostorg/boost.git
cd boost
git submodule update --init --depth 5 --jobs 3
rm -rf libs/histogram/*
mv -f $GITHUB_WORKSPACE/* libs/histogram
cd ..
cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 boost
ctest -j2 --output-on-failure -R boost_histogram
- name: b2 cxxstd=14,17 exception-handling=on/off rtti=on/off
run: |
cd $GITHUB_WORKSPACE/../boost
./bootstrap.sh
./b2 headers
cd libs/histogram
B2="../../b2 -q -j2 warnings-as-errors=on"
$B2 cxxstd=14,17 test//all examples
$B2 cxxstd=14 exception-handling=off rtti=off test//minimal
cov:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: install cpp-coveralls
run: |
python --version
pip install cpp-coveralls
- name: b2 toolset=gcc-8 cxxstd=latest coverage=on test//all
env:
COVERALLS_TOKEN: ${{ secrets.COVERALLS_TOKEN }}
run: |
cd ..
git clone -b $GITHUB_BASE_REF --depth 5 https://github.com/boostorg/boost.git
cd boost
git submodule update --init --depth 5 tools/build tools/boostdep
mv -f $GITHUB_WORKSPACE/* libs/histogram
python tools/boostdep/depinst/depinst.py --git_args "--depth 5 --jobs 3" histogram
# # use hdembinski/serialization due to frequent errors in boostorg/serialization
# pushd libs/serialization
# git remote add patch https://github.com/HDembinski/serialization.git
# git fetch patch
# git checkout patch/boost_histogram
# popd
# prepare build
./bootstrap.sh
./b2 headers
# simulate bundled boost by moving the headers instead of symlinking
rm -rf boost/histogram.pp boost/histogram
mv -f libs/histogram/include/boost/* boost
cd libs/histogram
B2="../../b2 -q -j2 warnings-as-errors=on"
# don't compile examples in coverage build, coverage must come from tests alone
$B2 toolset=gcc-8 cxxstd=latest coverage=on test//all
# process and send coverage data
GCOV=gcov-8 tools/cov.sh $COVERALLS_TOKEN

View File

@ -1,96 +0,0 @@
# Copyright Hans Dembinski 2019.
#
# 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)
#
# Based on original work by Antony Polukhin, see https://svn.boost.org/trac/boost/wiki/TravisCoverals
dist: xenial
branches:
only:
- master
- develop
matrix:
fast_finish: true
include:
- name: superproject cmake and b2 minimal
os: osx
language: cpp
before_script:
# clone minimal set of Boost libraries
- cd ..
- git clone -b $TRAVIS_BRANCH --depth 5 https://github.com/boostorg/boost.git
- cd boost
- git submodule update --init --depth 5 tools/boostdep
# replace library with this version and install dependencies
- rm -rf libs/histogram
- mv $TRAVIS_BUILD_DIR libs/histogram
# ignore optional dependencies not currently supported by the cmake build
- python tools/boostdep/depinst/depinst.py --git_args "--depth 5 --jobs 3" histogram -N accumulators -N range -N serialization -N units
# WORKAROUND: some external tests have extra dependencies that depinst.py misses
- python tools/boostdep/depinst/depinst.py --git_args "--depth 5 --jobs 3" throw_exception
- python tools/boostdep/depinst/depinst.py --git_args "--depth 5 --jobs 3" smart_ptr
- python tools/boostdep/depinst/depinst.py --git_args "--depth 5 --jobs 3" move
- git submodule update --init --depth 5 libs/function libs/type_index
script:
mkdir build && cd build &&
cmake -DBOOST_ENABLE_CMAKE=1 -DBoost_VERBOSE=1 .. &&
ctest -j2 --output-on-failure -R boost_histogram &&
cd .. &&
./bootstrap.sh &&
./b2 headers &&
./b2 -q -j2 warnings-as-errors=on cxxstd=latest libs/histogram/test//minimal
- os: linux
language: python
python: "3.6"
addons:
apt:
sources: ubuntu-toolchain-r-test
packages: g++-8
before_script:
# clone minimal set of Boost libraries
- cd ..
- git clone -b $TRAVIS_BRANCH --depth 5 https://github.com/boostorg/boost.git
- cd boost
- git submodule update --init --depth 5 tools/build tools/boostdep
# replace library with this version and install dependencies
- rm -rf libs/histogram
- mv $TRAVIS_BUILD_DIR libs/histogram
- python3 tools/boostdep/depinst/depinst.py --git_args "--depth 5 --jobs 3" histogram
# use hdembinski/serialization due to frequent errors in boostorg/serialization
- cd libs/serialization
- git remote add patch https://github.com/HDembinski/serialization.git
- git fetch patch
- git checkout patch/boost_histogram
- cd ../..
# prepare build
- ./bootstrap.sh
- ./b2 headers
# simulate bundled boost by moving the headers instead of symlinking
- rm -rf boost/histogram.pp boost/histogram
- mv -f libs/histogram/include/boost/* boost
- cd libs/histogram
- B2="../../b2 -q -j2 warnings-as-errors=on"
- pip install cpp-coveralls
script:
# don't compile examples in coverage build, coverage must come from tests alone
$B2 toolset=gcc-5 cxxstd=14 exception-handling=off rtti=off test//minimal &&
$B2 toolset=gcc-5 cxxstd=14 test//all examples &&
$B2 toolset=gcc-8 cxxstd=latest coverage=on test//all &&
GCOV=gcov-8 tools/cov.sh
notifications:
email: false

View File

@ -66,8 +66,8 @@ public:
s = large_;
}
large_ += value;
l -= large_;
l += s;
l = l - large_;
l = l + s;
small_ += l;
return *this;
}

View File

@ -88,7 +88,7 @@ struct storage_grower {
auto new_storage = make_default(storage);
new_storage.reset(new_size_);
const auto dlast = data_ + axes_rank(axes_) - 1;
for (const auto& x : storage) {
for (auto&& x : storage) {
auto ns = new_storage.begin();
auto sit = shifts;
auto dit = data_;

View File

@ -8,6 +8,7 @@
#define BOOST_HISTOGRAM_DETAIL_SUB_ARRAY_HPP
#include <algorithm>
#include <boost/throw_exception.hpp>
#include <stdexcept>
namespace boost {
@ -42,12 +43,12 @@ public:
}
reference at(size_type pos) noexcept {
if (pos >= size()) throw std::out_of_range{"pos is out of range"};
if (pos >= size()) BOOST_THROW_EXCEPTION(std::out_of_range{"pos is out of range"});
return data_[pos];
}
const_reference at(size_type pos) const noexcept {
if (pos >= size()) throw std::out_of_range{"pos is out of range"};
if (pos >= size()) BOOST_THROW_EXCEPTION(std::out_of_range{"pos is out of range"});
return data_[pos];
}