diff --git a/.github/workflows/cov.yml b/.github/workflows/cov.yml index a14b313b..94f8636a 100644 --- a/.github/workflows/cov.yml +++ b/.github/workflows/cov.yml @@ -11,8 +11,8 @@ on: - '*.md' env: - B2_OPTS: -q -j2 warnings-as-errors=on - GCC_VERSION: 11 + B2_OPTS: -q -a warnings-as-errors=on + GCC_VERSION: 15 concurrency: group: ${{ github.workflow }}-${{ github.head_ref }} @@ -20,7 +20,7 @@ concurrency: jobs: cov: - runs-on: macos-11 + runs-on: macos-latest steps: - uses: actions/checkout@v4 - name: Fetch Boost superproject @@ -48,6 +48,7 @@ jobs: # don't compile examples in coverage build, coverage must come from tests alone ../../b2 $B2_OPTS toolset=gcc-${GCC_VERSION} cxxstd=latest coverage=on test//all + ../../b2 $B2_OPTS -d+3 -d+12 -d+13 -n toolset=gcc-${GCC_VERSION} cxxstd=latest coverage=on test//quick - name: Process coverage data run: | diff --git a/.github/workflows/slow.yml b/.github/workflows/slow.yml index 68755972..c9e5e3b5 100644 --- a/.github/workflows/slow.yml +++ b/.github/workflows/slow.yml @@ -15,7 +15,7 @@ concurrency: cancel-in-progress: true env: - B2_OPTS: -q -j2 warnings-as-errors=on + B2_OPTS: -q -j2 -d+2 warnings-as-errors=on UBSAN_OPTIONS: print_stacktrace=1 LSAN_OPTIONS: verbosity=1:log_threads=1 ASAN_OPTIONS: detect_leaks=1:detect_stack_use_after_return=1 @@ -46,31 +46,7 @@ jobs: cd libs/histogram ../../b2 $B2_OPTS cxxstd=17 test//all - gcc7: - runs-on: ubuntu-20.04 - steps: - - uses: actions/checkout@v4 - - uses: egor-tensin/setup-gcc@v1 - with: - version: 7 - - name: Fetch Boost superproject - run: | - cd .. - git clone -b $GITHUB_BASE_REF --depth 5 https://github.com/boostorg/boost.git - cd boost - mv -f $GITHUB_WORKSPACE/* libs/histogram - git submodule update --init --depth 5 tools/build tools/boostdep - git submodule update --init --depth 5 libs/format - python tools/boostdep/depinst/depinst.py --git_args "--depth 5 --jobs 3" histogram - mv -f * $GITHUB_WORKSPACE - - name: Prepare b2 - run: ./bootstrap.sh - - name: Test cxxstd=14 (warnings ignored) - run: | - cd libs/histogram - ../../b2 -q -j2 toolset=gcc-7 cxxstd=14 test//all examples - - gcc10: + gcc: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -86,12 +62,12 @@ jobs: mv -f * $GITHUB_WORKSPACE - name: Prepare b2 run: ./bootstrap.sh - - name: Test cxxstd=20 -O3 -funsafe-math-optimizations + - name: Test cxxstd=20 optimization=speed -funsafe-math-optimizations run: | cd libs/histogram - ../../b2 $B2_OPTS toolset=gcc-10 cxxstd=20 cxxflags="-O3 -funsafe-math-optimizations" test//all examples + ../../b2 $B2_OPTS toolset=gcc cxxstd=20 optimization=speed cxxflags="-funsafe-math-optimizations" test//all examples - clang14: + clang: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -109,4 +85,4 @@ jobs: - name: Test cxxstd=17 ubsan asan run: | cd libs/histogram - ../../b2 $B2_OPTS toolset=clang-14 cxxstd=17 variant=histogram_ubasan test//all + ../../b2 $B2_OPTS toolset=clang cxxstd=17 variant=histogram_ubasan test//all diff --git a/.gitignore b/.gitignore index 922f7f45..32cc7284 100644 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,15 @@ tools/codecov coverage-report .cache venv -.pytest_cache \ No newline at end of file +.pytest_cache +!*.jam +*.vcxproj +*.vcxproj.filters +*.sln +BoostFetch.cmake +cmake_install.cmake +CMakeCache.txt +CMakeFiles +*.cmake +DartConfiguration.tcl +_deps \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index b9061817..af83a137 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,6 @@ target_link_libraries(boost_histogram Boost::mp11 Boost::throw_exception Boost::variant2 - Boost::math ) target_compile_features(boost_histogram INTERFACE cxx_std_14) diff --git a/Jamfile b/Jamfile deleted file mode 100644 index de6e5312..00000000 --- a/Jamfile +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright Mateusz Loskot 2018 -# Copyright Klemens David Morgenstern, Hans P. Dembinski 2016-2017 -# -# Use, modification and distribution is 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) - -# Special builds for Boost Histogram: -# -# Generate coverage data: b2 cxxstd=latest coverage=on test//all -# Test without exceptions and rtti: b2 cxxstd=latest exception-handling=off rtti=off test//minimal -# Test with sanitizers: b2 toolset=clang cxxstd=latest histogram_ubasan test - -import common ; - -project - : requirements - /boost//headers - $(BOOST_ROOT) - clang:"-pedantic -Wextra -Wsign-compare -Wstrict-aliasing -fstrict-aliasing -Wvexing-parse -Wfloat-conversion -fvisibility=hidden -fvisibility-inlines-hidden" - darwin:"-pedantic -Wextra -Wsign-compare -Wstrict-aliasing -fstrict-aliasing -Wvexing-parse -Wfloat-conversion -fvisibility=hidden -fvisibility-inlines-hidden" - gcc:"-pedantic -Wextra -Wsign-compare -Wstrict-aliasing -fstrict-aliasing -Wfloat-conversion -fvisibility=hidden -fvisibility-inlines-hidden" - msvc:"/bigobj" - intel-win:"/bigobj" - : default-build - all - ; - -path-constant THIS_PATH : . ; - -# only works with clang because of -fsanitize-blacklist -variant histogram_ubasan : debug : - "-fno-omit-frame-pointer -O0 -fno-inline -fsanitize=address,leak,undefined -fno-sanitize-recover=all -fsanitize-blacklist=$(THIS_PATH)/tools/blacklist.supp" - "-fsanitize=address,leak,undefined" - ; - -build-project test ; -build-project examples ; diff --git a/build.jam b/build.jam new file mode 100644 index 00000000..f39c0374 --- /dev/null +++ b/build.jam @@ -0,0 +1,50 @@ +# Copyright René Ferdinand Rivera Morell 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 ; + +# Special builds for Boost Histogram: +# +# Generate coverage data: b2 cxxstd=latest coverage=on test//all +# Test without exceptions and rtti: b2 cxxstd=latest exception-handling=off rtti=off test//minimal +# Test with sanitizers: b2 toolset=clang cxxstd=latest histogram_ubasan test + +# boost/serialization and boost/math must not be included here, they are optional dependencies +constant boost_dependencies : + /boost/config//boost_config + /boost/core//boost_core + /boost/mp11//boost_mp11 + /boost/throw_exception//boost_throw_exception + /boost/variant2//boost_variant2 ; + +project /boost/histogram + : requirements + clang:"-Wsign-compare -Wstrict-aliasing -fstrict-aliasing -Wvexing-parse -Wfloat-conversion" + darwin:"-Wsign-compare -Wstrict-aliasing -fstrict-aliasing -Wvexing-parse -Wfloat-conversion" + gcc:"-Wsign-compare -Wstrict-aliasing -fstrict-aliasing -Wfloat-conversion" + msvc:"/bigobj" + intel-win:"/bigobj" + hidden + : default-build + extra + ; + +explicit + [ alias boost_histogram : : : + : include $(boost_dependencies) ] + [ alias all : boost_histogram test examples ] + ; + +call-if : boost-library histogram + ; + +path-constant THIS_PATH : . ; + +# only works with clang because of -fsanitize-blacklist +variant histogram_ubasan : debug : + "-fno-omit-frame-pointer -O0 -fno-inline -fsanitize=address,leak,undefined -fno-sanitize-recover=all -fsanitize-blacklist=$(THIS_PATH)/tools/blacklist.supp" + "-fsanitize=address,leak,undefined" + ; + diff --git a/doc/Jamfile b/doc/Jamfile index 261e3083..61087d41 100644 --- a/doc/Jamfile +++ b/doc/Jamfile @@ -18,12 +18,12 @@ path-constant THIS_PATH : . ; doxygen reference : - $(THIS_PATH)/../../../boost/histogram.hpp - [ glob $(THIS_PATH)/../../../boost/histogram/*.hpp ] - [ glob $(THIS_PATH)/../../../boost/histogram/accumulators/*.hpp ] - [ glob $(THIS_PATH)/../../../boost/histogram/algorithm/*.hpp ] - [ glob $(THIS_PATH)/../../../boost/histogram/axis/*.hpp ] - [ glob $(THIS_PATH)/../../../boost/histogram/utility/*.hpp ] + $(THIS_PATH)/../include/boost/histogram.hpp + [ glob $(THIS_PATH)/../include/boost/histogram/*.hpp ] + [ glob $(THIS_PATH)/../include/boost/histogram/accumulators/*.hpp ] + [ glob $(THIS_PATH)/../include/boost/histogram/algorithm/*.hpp ] + [ glob $(THIS_PATH)/../include/boost/histogram/axis/*.hpp ] + [ glob $(THIS_PATH)/../include/boost/histogram/utility/*.hpp ] : QUIET=YES WARNINGS=YES diff --git a/examples/Jamfile b/examples/Jamfile index e1b85e0e..367158c4 100644 --- a/examples/Jamfile +++ b/examples/Jamfile @@ -5,15 +5,21 @@ # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +require-b2 5.0.1 ; + +import-search /boost/config/checks ; + import testing ; -import ../../config/checks/config : requires ; +import config : requires ; project : requirements + /boost/histogram//boost_histogram [ requires cxx14_constexpr cxx14_decltype_auto cxx14_generic_lambdas cxx14_return_type_deduction cxx11_user_defined_literals # list could go on... ] + /boost/format//boost_format ; alias cxx14 : diff --git a/include/boost/histogram/axis/variant.hpp b/include/boost/histogram/axis/variant.hpp index 95cf71b6..0797539c 100644 --- a/include/boost/histogram/axis/variant.hpp +++ b/include/boost/histogram/axis/variant.hpp @@ -253,7 +253,7 @@ template decltype(auto) get(variant&& v) { auto tp = get_if(&v); if (!tp) BOOST_THROW_EXCEPTION(std::runtime_error("T is not the held type")); - return std::move(*tp); + return *tp; } /// Return const reference to T, throws unspecified exception if type does not match. diff --git a/test/Jamfile b/test/Jamfile index 6cebf317..f4aa5524 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -6,11 +6,15 @@ # Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +require-b2 5.0.1 ; + +import-search /boost/config/checks ; + import python ; import os ; import regex ; import testing ; -import ../../config/checks/config : requires ; +import config : requires ; if ! [ python.configured ] { @@ -21,6 +25,7 @@ path-constant THIS_PATH : . ; project : requirements + /boost/histogram//boost_histogram [ requires cxx14_constexpr cxx14_decltype_auto cxx14_generic_lambdas cxx14_return_type_deduction cxx11_user_defined_literals # list could go on... @@ -144,14 +149,14 @@ alias threading : # warnings are off for these other boost libraries, which tend to be not warning-free alias math : - [ run detail_normal_test.cpp ] - [ run utility_clopper_pearson_interval_test.cpp ] - [ run utility_jeffreys_interval_test.cpp ] + [ run detail_normal_test.cpp : : : /boost/math//boost_math ] + [ run utility_clopper_pearson_interval_test.cpp : : : /boost/math//boost_math ] + [ run utility_jeffreys_interval_test.cpp : : : /boost/math//boost_math ] : off ; -alias accumulators : [ run boost_accumulators_support_test.cpp ] : off ; -alias range : [ run boost_range_support_test.cpp ] : off ; -alias units : [ run boost_units_support_test.cpp ] : off ; +alias accumulators : [ run boost_accumulators_support_test.cpp : : : /boost/accumulators//boost_accumulators ] : off ; +alias range : [ run boost_range_support_test.cpp : : : /boost/range//boost_range ] : off ; +alias units : [ run boost_units_support_test.cpp : : : /boost/units//boost_units ] : off ; alias serialization : [ run accumulators_serialization_test.cpp libserial : $(THIS_PATH) ] [ run detail_array_wrapper_serialization_test.cpp libserial ]