diff --git a/.travis.yml b/.travis.yml index 28eb73a6..4ae01655 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,10 @@ +# 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) # -# Copyright Hans Dembinski 2019. -# -# Based on original work by Antony Polukhin, see https://svn.boost.org/trac/boost/wiki/TravisCoveralss +# Based on original work by Antony Polukhin, see https://svn.boost.org/trac/boost/wiki/TravisCoverals language: cpp os: linux diff --git a/CMakeLists.txt b/CMakeLists.txt index a0694986..05d21972 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,8 @@ -# Copyright 2018-2019 Peter Dimov, Hans Dembinski +# Copyright Peter Dimov, Hans Dembinski 2018-2019 # 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 -# Beware: Boost-CMake support is experimental; testing works, install target doesn't +# Warning: Boost-CMake support is incomplete; testing works, install target doesn't cmake_minimum_required(VERSION 3.6) diff --git a/Jamfile b/Jamfile index 1139f255..a540a0be 100644 --- a/Jamfile +++ b/Jamfile @@ -1,4 +1,4 @@ -# Copyright (c) 2018 Mateusz Loskot +# Copyright Mateusz Loskot 2018 # Copyright Klemens David Morgenstern, Hans P. Dembinski 2016-2017 # # Use, modification and distribution is subject to the Boost Software License, diff --git a/README.md b/README.md index 2dd4a62d..7e3e098c 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,10 @@ + + # Histogram **Fast multi-dimensional histogram with convenient interface for C++14** diff --git a/benchmark/disable_cpu_scaling.sh b/benchmark/disable_cpu_scaling.sh index e2c4e92a..f945e180 100755 --- a/benchmark/disable_cpu_scaling.sh +++ b/benchmark/disable_cpu_scaling.sh @@ -1,2 +1,7 @@ -#/bin/bash +#!/bin/bash + +# Copyright Hans Dembinski 2019 +# 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 + for cpu in /sys/devices/system/cpu/cpu? ; do echo performance > $cpu/cpufreq/scaling_governor; done diff --git a/benchmark/enable_cpu_scaling.sh b/benchmark/enable_cpu_scaling.sh index f75c1455..d0a463eb 100755 --- a/benchmark/enable_cpu_scaling.sh +++ b/benchmark/enable_cpu_scaling.sh @@ -1,2 +1,7 @@ -#/bin/bash +#!/bin/bash + +# Copyright Hans Dembinski 2019 +# 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 + for cpu in /sys/devices/system/cpu/cpu? ; do echo powersave > $cpu/cpufreq/scaling_governor; done diff --git a/benchmark/histogram_filling_experiments.cpp b/benchmark/histogram_filling_experiments.cpp index 2b893e0e..8e76b1c8 100644 --- a/benchmark/histogram_filling_experiments.cpp +++ b/benchmark/histogram_filling_experiments.cpp @@ -59,8 +59,8 @@ void fill_c(const Axes& axes, const std::size_t* strides, Storage& storage, const Tuple& t) { using namespace boost::mp11; std::size_t index = 0; - assert(boost::histogram::detail::axes_rank(axes) == - boost::histogram::detail::axes_rank(t)); + BOOST_ASSERT(boost::histogram::detail::axes_rank(axes) == + boost::histogram::detail::axes_rank(t)); mp_for_each>>([&](auto i) { const auto& a = boost::histogram::detail::axis_get(axes); const auto& v = std::get(t); @@ -137,9 +137,9 @@ static void fill_2d_c(benchmark::State& state) { generator gen; auto storage = make_storage(axes); auto strides = make_strides(axes); - assert(strides.size() == 3); - assert(strides[0] == 1); - assert(strides[1] == 102); + BOOST_ASSERT(strides.size() == 3); + BOOST_ASSERT(strides[0] == 1); + BOOST_ASSERT(strides[1] == 102); for (auto _ : state) { fill_c(axes, strides.data(), storage, std::forward_as_tuple(gen(), gen())); } @@ -151,9 +151,9 @@ static void fill_2d_c_dyn(benchmark::State& state) { generator gen; auto storage = make_storage(axes); auto strides = make_strides(axes); - assert(strides.size() == 3); - assert(strides[0] == 1); - assert(strides[1] == 102); + BOOST_ASSERT(strides.size() == 3); + BOOST_ASSERT(strides[0] == 1); + BOOST_ASSERT(strides[1] == 102); for (auto _ : state) { fill_c(axes, strides.data(), storage, std::forward_as_tuple(gen(), gen())); } diff --git a/benchmark/plot_benchmarks.py b/benchmark/plot_benchmarks.py index 4356dce0..2661549f 100755 --- a/benchmark/plot_benchmarks.py +++ b/benchmark/plot_benchmarks.py @@ -1,4 +1,9 @@ #!/usr/bin/env python3 + +# Copyright Hans Dembinski 2019 +# 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 + from matplotlib import pyplot as plt, lines import shelve import json diff --git a/benchmark/run_benchmarks.py b/benchmark/run_benchmarks.py index 439c4396..03dcf5a2 100755 --- a/benchmark/run_benchmarks.py +++ b/benchmark/run_benchmarks.py @@ -1,4 +1,9 @@ #!/usr/bin/env python3 + +# Copyright Hans Dembinski 2019 +# 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 + """ Run this from a special build directory that uses the benchmark folder as root diff --git a/doc/benchmarks.qbk b/doc/benchmarks.qbk index edd82c59..9ee22c1f 100644 --- a/doc/benchmarks.qbk +++ b/doc/benchmarks.qbk @@ -1,3 +1,10 @@ +[/ + Copyright Hans Dembinski 2018 - 2019. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + https://www.boost.org/LICENSE_1_0.txt) +] + [section:benchmarks Benchmarks] The library is designed to be fast. When configured correctly, it is one of the fastest libraries on the market. If you find a library that is faster than Boost.Histogram, please submit an issue on Github. We care about performance. diff --git a/doc/changelog.qbk b/doc/changelog.qbk index ec7ba37e..d9b9d804 100644 --- a/doc/changelog.qbk +++ b/doc/changelog.qbk @@ -1,3 +1,10 @@ +[/ + Copyright Hans Dembinski 2018 - 2019. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + https://www.boost.org/LICENSE_1_0.txt) +] + [section:history Revision history] [heading Boost 1.71] diff --git a/doc/concepts.qbk b/doc/concepts.qbk index a9f6edd5..89b2c1e8 100644 --- a/doc/concepts.qbk +++ b/doc/concepts.qbk @@ -1,3 +1,10 @@ +[/ + Copyright Hans Dembinski 2018 - 2019. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + https://www.boost.org/LICENSE_1_0.txt) +] + [section:concepts Concepts] Users can extend the library with various new types whose concepts are defined here. diff --git a/doc/concepts/Accumulator.qbk b/doc/concepts/Accumulator.qbk index ff6df8b2..60ef5774 100644 --- a/doc/concepts/Accumulator.qbk +++ b/doc/concepts/Accumulator.qbk @@ -1,3 +1,10 @@ +[/ + Copyright Hans Dembinski 2018 - 2019. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + https://www.boost.org/LICENSE_1_0.txt) +] + [section:Accumulator Accumulator] An [*Accumulator] is a functor which consumes the argument to update some internal state. The state can be read with member functions or free functions. Must be [@https://en.cppreference.com/w/cpp/named_req/DefaultConstructible DefaultConstructible], [@https://en.cppreference.com/w/cpp/named_req/CopyConstructible CopyConstructible], and [@https://en.cppreference.com/w/cpp/named_req/CopyAssignable CopyAssignable]. diff --git a/doc/concepts/Axis.qbk b/doc/concepts/Axis.qbk index c3819d46..6a26255a 100644 --- a/doc/concepts/Axis.qbk +++ b/doc/concepts/Axis.qbk @@ -1,3 +1,10 @@ +[/ + Copyright Hans Dembinski 2018 - 2019. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + https://www.boost.org/LICENSE_1_0.txt) +] + [section:Axis Axis] An [*Axis] maps input values to indices. It holds state specific to that axis, like the number of bins and any metadata. Must be [@https://en.cppreference.com/w/cpp/named_req/CopyConstructible CopyConstructible], [@https://en.cppreference.com/w/cpp/named_req/CopyAssignable CopyAssignable], and *nothrow* [@https://en.cppreference.com/w/cpp/named_req/MoveAssignable MoveAssignable]. diff --git a/doc/concepts/DiscreteAxis.qbk b/doc/concepts/DiscreteAxis.qbk index 707e9a7c..2cd1ba55 100644 --- a/doc/concepts/DiscreteAxis.qbk +++ b/doc/concepts/DiscreteAxis.qbk @@ -1,3 +1,10 @@ +[/ + Copyright Hans Dembinski 2018 - 2019. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + https://www.boost.org/LICENSE_1_0.txt) +] + [section:DiscreteAxis DiscreteAxis] A [*DiscreteAxis] is one of two optional refinements of the [link histogram.concepts.Axis [*Axis]] concept, the other one is the [link histogram.concepts.IntervalAxis IntervalAxis]. This concept is for values that do not form intervals, and for axes with intervals that contain exactly one value. diff --git a/doc/concepts/IntervalAxis.qbk b/doc/concepts/IntervalAxis.qbk index 76ffc184..15ea840b 100644 --- a/doc/concepts/IntervalAxis.qbk +++ b/doc/concepts/IntervalAxis.qbk @@ -1,3 +1,10 @@ +[/ + Copyright Hans Dembinski 2018 - 2019. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + https://www.boost.org/LICENSE_1_0.txt) +] + [section:IntervalAxis IntervalAxis] A [*IntervalAxis] is one of two optional refinements of the [link histogram.concepts.Axis [*Axis]] concept, the other one is the [link histogram.concepts.DiscreteAxis DiscreteAxis]. It is for ordered values that form intervals with a well-defined lower and upper edge, and a center. Each bin represents an interval of values. diff --git a/doc/concepts/Storage.qbk b/doc/concepts/Storage.qbk index 88703ce9..6ed78f64 100644 --- a/doc/concepts/Storage.qbk +++ b/doc/concepts/Storage.qbk @@ -1,3 +1,10 @@ +[/ + Copyright Hans Dembinski 2018 - 2019. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + https://www.boost.org/LICENSE_1_0.txt) +] + [section:Storage Storage] A [*Storage] handles memory for the bin counters and provides a uniform vector-like interface for accessing cell values for reading and writing. Must be [@https://en.cppreference.com/w/cpp/named_req/DefaultConstructible DefaultConstructible], [@https://en.cppreference.com/w/cpp/named_req/CopyConstructible CopyConstructible], and [@https://en.cppreference.com/w/cpp/named_req/CopyAssignable CopyAssignable]. diff --git a/doc/concepts/Transform.qbk b/doc/concepts/Transform.qbk index d7ace360..931c7fb8 100644 --- a/doc/concepts/Transform.qbk +++ b/doc/concepts/Transform.qbk @@ -1,3 +1,10 @@ +[/ + Copyright Hans Dembinski 2018 - 2019. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + https://www.boost.org/LICENSE_1_0.txt) +] + [section:Transform Transform] A [*Transform] implements a monotonic mapping between two real-valued domains, external and internal. It is used to extend the [classref boost::histogram::axis::regular regular axis]. The bins in the internal domain are of equal width, while the bins in the external domain are non-equal width. Must be [@https://en.cppreference.com/w/cpp/named_req/DefaultConstructible DefaultConstructible], [@https://en.cppreference.com/w/cpp/named_req/CopyConstructible CopyConstructible], and [@https://en.cppreference.com/w/cpp/named_req/CopyAssignable CopyAssignable]. diff --git a/doc/doxygen_postprocessing.py b/doc/doxygen_postprocessing.py index 03c25906..3584346b 100644 --- a/doc/doxygen_postprocessing.py +++ b/doc/doxygen_postprocessing.py @@ -1,3 +1,8 @@ +# Copyright Hans Dembinski 2018 - 2019. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# https://www.boost.org/LICENSE_1_0.txt) + from __future__ import print_function import sys import xml.etree.ElementTree as ET diff --git a/doc/fill_performance.py b/doc/fill_performance.py index 661a1f2f..0ec815d0 100755 --- a/doc/fill_performance.py +++ b/doc/fill_performance.py @@ -1,4 +1,10 @@ #!/usr/bin/env python3 + +# Copyright Hans Dembinski 2018 - 2019. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# https://www.boost.org/LICENSE_1_0.txt) + import os import numpy as np import glob diff --git a/doc/getting_started.qbk b/doc/getting_started.qbk index 6e57bdee..c58fcb8c 100644 --- a/doc/getting_started.qbk +++ b/doc/getting_started.qbk @@ -1,3 +1,10 @@ +[/ + Copyright Hans Dembinski 2018 - 2019. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + https://www.boost.org/LICENSE_1_0.txt) +] + [section:getting_started Getting started] Here are some commented examples to copy-paste from, this should allow you to kick off a project with Boost.Histogram. If you prefer a traditional structured exposition, go to the [link histogram.guide user guide]. diff --git a/doc/guide.qbk b/doc/guide.qbk index f0fcfb8f..34c26094 100644 --- a/doc/guide.qbk +++ b/doc/guide.qbk @@ -1,3 +1,10 @@ +[/ + Copyright Hans Dembinski 2018 - 2019. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + https://www.boost.org/LICENSE_1_0.txt) +] + [section:guide User guide] Boost.Histogram is designed to make simple things simple, yet complex things possible. Correspondingly, this guides covers the basic usage first, and the advanced usage in later sections. For an alternative quick start guide, have a look at the [link histogram.getting_started Getting started] section. diff --git a/doc/histogram.qbk b/doc/histogram.qbk index 34b537e8..bad9b7cf 100644 --- a/doc/histogram.qbk +++ b/doc/histogram.qbk @@ -1,3 +1,10 @@ +[/ + Copyright Hans Dembinski 2016 - 2019. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + https://www.boost.org/LICENSE_1_0.txt) +] + [library Boost.Histogram [quickbook 1.6] [copyright 2016 - 2019 Hans Dembinski] diff --git a/doc/iteration_performance.py b/doc/iteration_performance.py index e7038280..da1d399b 100644 --- a/doc/iteration_performance.py +++ b/doc/iteration_performance.py @@ -1,3 +1,10 @@ +#!/usr/bin/env python3 + +# Copyright Hans Dembinski 2018 - 2019. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# https://www.boost.org/LICENSE_1_0.txt) + import numpy as np import json from collections import defaultdict diff --git a/doc/overview.qbk b/doc/overview.qbk index 0e46135c..ea0d4502 100644 --- a/doc/overview.qbk +++ b/doc/overview.qbk @@ -1,3 +1,10 @@ +[/ + Copyright Hans Dembinski 2018 - 2019. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + https://www.boost.org/LICENSE_1_0.txt) +] + [section:overview Overview] [section:introduction Introduction] diff --git a/doc/rationale.qbk b/doc/rationale.qbk index 2e6083ab..25bedc1d 100644 --- a/doc/rationale.qbk +++ b/doc/rationale.qbk @@ -1,3 +1,10 @@ +[/ + Copyright Hans Dembinski 2018 - 2019. + Distributed under the Boost Software License, Version 1.0. + (See accompanying file LICENSE_1_0.txt or copy at + https://www.boost.org/LICENSE_1_0.txt) +] + [section:rationale Rationale] [section:guidelines Guidelines] diff --git a/include/boost/histogram/algorithm/reduce.hpp b/include/boost/histogram/algorithm/reduce.hpp index ba71cb72..591e0648 100644 --- a/include/boost/histogram/algorithm/reduce.hpp +++ b/include/boost/histogram/algorithm/reduce.hpp @@ -206,7 +206,7 @@ decltype(auto) reduce(const Histogram& hist, const Iterable& options) { o_out.begin = o_in.begin; o_out.end = o_in.end; } - o_out.merge = std::max(o_in.merge, o_out.merge); + o_out.merge = (std::max)(o_in.merge, o_out.merge); } // make new axes container with default-constructed axis instances @@ -231,8 +231,8 @@ decltype(auto) reduce(const Histogram& hist, const Iterable& options) { [&o](auto&& aout, const auto& ain) { using A = std::decay_t; if (o.indices_set) { - o.begin = std::max(0, o.begin); - o.end = std::min(o.end, ain.size()); + o.begin = (std::max)(0, o.begin); + o.end = (std::min)(o.end, ain.size()); } else { o.begin = 0; o.end = ain.size(); diff --git a/include/boost/histogram/axis/variable.hpp b/include/boost/histogram/axis/variable.hpp index 10641c96..cd53821a 100644 --- a/include/boost/histogram/axis/variable.hpp +++ b/include/boost/histogram/axis/variable.hpp @@ -152,13 +152,13 @@ public: if (0 <= i) { if (i < size()) return std::make_pair(i, 0); const auto d = value(size()) - value(size() - 0.5); - x = std::nextafter(x, std::numeric_limits::max()); - x = std::max(x, vec.back() + d); + x = std::nextafter(x, (std::numeric_limits::max)()); + x = (std::max)(x, vec.back() + d); vec.push_back(x); return std::make_pair(i, -1); } const auto d = value(0.5) - value(0); - x = std::min(x, value(0) - d); + x = (std::min)(x, value(0) - d); vec.insert(vec.begin(), x); return std::make_pair(0, -i); } diff --git a/include/boost/histogram/detail/large_int.hpp b/include/boost/histogram/detail/large_int.hpp index 2259cbda..8c3981cb 100644 --- a/include/boost/histogram/detail/large_int.hpp +++ b/include/boost/histogram/detail/large_int.hpp @@ -30,7 +30,7 @@ using is_unsigned_integral = mp11::mp_and, std::is_unsigned< template bool safe_increment(T& t) { - if (t < std::numeric_limits::max()) { + if (t < (std::numeric_limits::max)()) { ++t; return true; } @@ -41,7 +41,7 @@ template bool safe_radd(T& t, const U& u) { static_assert(is_unsigned_integral::value, "T must be unsigned integral type"); static_assert(is_unsigned_integral::value, "T must be unsigned integral type"); - if (static_cast(std::numeric_limits::max() - t) >= u) { + if (static_cast((std::numeric_limits::max)() - t) >= u) { t += static_cast(u); // static_cast to suppress conversion warning return true; } @@ -212,7 +212,7 @@ struct large_int : totally_ordered, large_int>, // in decimal system it would look like this: // 8 + 8 = 6 = 8 - (9 - 8) - 1 // 9 + 1 = 0 = 9 - (9 - 1) - 1 - auto tmp = std::numeric_limits::max(); + auto tmp = (std::numeric_limits::max)(); tmp -= o; --d -= tmp; } diff --git a/include/boost/histogram/detail/limits.hpp b/include/boost/histogram/detail/limits.hpp index 23b8a6f1..532a5082 100644 --- a/include/boost/histogram/detail/limits.hpp +++ b/include/boost/histogram/detail/limits.hpp @@ -30,7 +30,7 @@ constexpr float lowest() { template constexpr T highest() { - return std::numeric_limits::max(); + return (std::numeric_limits::max)(); } template <> diff --git a/include/boost/histogram/detail/linearize.hpp b/include/boost/histogram/detail/linearize.hpp index b24be8ef..66e062fe 100644 --- a/include/boost/histogram/detail/linearize.hpp +++ b/include/boost/histogram/detail/linearize.hpp @@ -185,7 +185,7 @@ void grow_storage(const A& axes, S& storage, const axis::index_type* shifts) { } // we are in a normal bin: // move storage pointer to index position, apply positive shifts - ns += (dit->idx + std::max(*sit, 0)) * dit->new_stride; + ns += (dit->idx + (std::max)(*sit, 0)) * dit->new_stride; ++dit; ++sit; }); diff --git a/include/boost/histogram/storage_adaptor.hpp b/include/boost/histogram/storage_adaptor.hpp index 4e278a69..ea231f2a 100644 --- a/include/boost/histogram/storage_adaptor.hpp +++ b/include/boost/histogram/storage_adaptor.hpp @@ -55,7 +55,7 @@ struct vector_impl : T { using value_type = typename T::value_type; const auto old_size = T::size(); T::resize(n, value_type()); - std::fill_n(T::begin(), std::min(n, old_size), value_type()); + std::fill_n(T::begin(), (std::min)(n, old_size), value_type()); } }; // namespace detail diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 532128cd..315b5d8b 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright 2019 Hans Dembinski +# Copyright Hans Dembinski 2019 # 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 diff --git a/test/axis_integer_test.cpp b/test/axis_integer_test.cpp index 0d275006..a7749e4a 100644 --- a/test/axis_integer_test.cpp +++ b/test/axis_integer_test.cpp @@ -61,8 +61,8 @@ int main() { // axis::integer with int type { axis::integer a{-1, 2}; - BOOST_TEST_EQ(a.bin(-2), std::numeric_limits::min()); - BOOST_TEST_EQ(a.bin(4), std::numeric_limits::max()); + BOOST_TEST_EQ(a.bin(-2), (std::numeric_limits::min)()); + BOOST_TEST_EQ(a.bin(4), (std::numeric_limits::max)()); BOOST_TEST_EQ(a.index(-10), -1); BOOST_TEST_EQ(a.index(-2), -1); BOOST_TEST_EQ(a.index(-1), 0); diff --git a/test/axis_variant_serialization_test.xml b/test/axis_variant_serialization_test.xml index bf6c0078..9504c511 100644 --- a/test/axis_variant_serialization_test.xml +++ b/test/axis_variant_serialization_test.xml @@ -1,3 +1,11 @@ + + diff --git a/test/check_cmake_version.cpp b/test/check_cmake_version.cpp index 2fd46483..160db585 100644 --- a/test/check_cmake_version.cpp +++ b/test/check_cmake_version.cpp @@ -3,7 +3,6 @@ // Copyright 2018 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 @@ -11,17 +10,16 @@ #include #include -int main( int ac, char const* av[] ) -{ - BOOST_TEST_EQ( ac, 2 ); +int main(int ac, char const* av[]) { + BOOST_TEST_EQ(ac, 2); - if( ac >= 2 ) - { - char version[ 64 ]; - std::sprintf( version, "%d.%d.%d", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100 ); + if (ac >= 2) { + char version[64]; + std::sprintf(version, "%d.%d.%d", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, + BOOST_VERSION % 100); - BOOST_TEST_CSTR_EQ( av[1], version ); - } + BOOST_TEST_CSTR_EQ(av[1], version); + } - return boost::report_errors(); + return boost::report_errors(); } diff --git a/test/detail_axes_test.cpp b/test/detail_axes_test.cpp index 74c5e601..b2a1f781 100644 --- a/test/detail_axes_test.cpp +++ b/test/detail_axes_test.cpp @@ -130,7 +130,7 @@ int main() { // bincount overflow { auto v = std::vector>( - 100, axis::integer<>(0, std::numeric_limits::max() - 2)); + 100, axis::integer<>(0, (std::numeric_limits::max)() - 2)); BOOST_TEST_THROWS(detail::bincount(v), std::overflow_error); } diff --git a/test/detail_large_int_test.cpp b/test/detail_large_int_test.cpp index f777af91..7e50fcef 100644 --- a/test/detail_large_int_test.cpp +++ b/test/detail_large_int_test.cpp @@ -54,7 +54,7 @@ int main() { BOOST_TEST_EQ(c, 255); } - const auto vmax = std::numeric_limits::max(); + const auto vmax = (std::numeric_limits::max)(); // ctors, assign { diff --git a/test/detail_limits_test.cpp b/test/detail_limits_test.cpp index f77adcb3..dc0d0417 100644 --- a/test/detail_limits_test.cpp +++ b/test/detail_limits_test.cpp @@ -12,11 +12,11 @@ using namespace boost::histogram::detail; int main() { - BOOST_TEST_EQ(lowest(), std::numeric_limits::min()); + BOOST_TEST_EQ(lowest(), (std::numeric_limits::min)()); BOOST_TEST_EQ(lowest(), -std::numeric_limits::infinity()); BOOST_TEST_EQ(lowest(), -std::numeric_limits::infinity()); - BOOST_TEST_EQ(highest(), std::numeric_limits::max()); + BOOST_TEST_EQ(highest(), (std::numeric_limits::max)()); BOOST_TEST_EQ(highest(), std::numeric_limits::infinity()); BOOST_TEST_EQ(highest(), std::numeric_limits::infinity()); diff --git a/test/histogram_growing_test.cpp b/test/histogram_growing_test.cpp index bbcc5697..52857991 100644 --- a/test/histogram_growing_test.cpp +++ b/test/histogram_growing_test.cpp @@ -34,7 +34,7 @@ public: const auto x = std::get<0>(xy); const auto y = std::get<1>(xy); const auto r = std::sqrt(x * x + y * y); - return std::min(static_cast(r), size()); + return (std::min)(static_cast(r), size()); } auto update(std::tuple xy) { diff --git a/test/histogram_serialization_test_dynamic.xml b/test/histogram_serialization_test_dynamic.xml index ccd5441e..3411c758 100644 --- a/test/histogram_serialization_test_dynamic.xml +++ b/test/histogram_serialization_test_dynamic.xml @@ -1,3 +1,11 @@ + + diff --git a/test/histogram_serialization_test_static.xml b/test/histogram_serialization_test_static.xml index 3d22ae4a..95699780 100644 --- a/test/histogram_serialization_test_static.xml +++ b/test/histogram_serialization_test_static.xml @@ -1,3 +1,11 @@ + + diff --git a/test/storage_adaptor_serialization_test_array_unsigned.xml b/test/storage_adaptor_serialization_test_array_unsigned.xml index 15c01e0f..180d322b 100644 --- a/test/storage_adaptor_serialization_test_array_unsigned.xml +++ b/test/storage_adaptor_serialization_test_array_unsigned.xml @@ -1,3 +1,11 @@ + + diff --git a/test/storage_adaptor_serialization_test_map_double.xml b/test/storage_adaptor_serialization_test_map_double.xml index 67118ae3..ddf960f3 100644 --- a/test/storage_adaptor_serialization_test_map_double.xml +++ b/test/storage_adaptor_serialization_test_map_double.xml @@ -1,3 +1,11 @@ + + diff --git a/test/storage_adaptor_serialization_test_vector_int.xml b/test/storage_adaptor_serialization_test_vector_int.xml index 5229d07e..c1e6de0c 100644 --- a/test/storage_adaptor_serialization_test_vector_int.xml +++ b/test/storage_adaptor_serialization_test_vector_int.xml @@ -1,3 +1,11 @@ + + diff --git a/test/storage_adaptor_serialization_test_vector_thread_safe_int.xml b/test/storage_adaptor_serialization_test_vector_thread_safe_int.xml index 55a7ff37..50a18365 100644 --- a/test/storage_adaptor_serialization_test_vector_thread_safe_int.xml +++ b/test/storage_adaptor_serialization_test_vector_thread_safe_int.xml @@ -1,3 +1,11 @@ + + diff --git a/test/unlimited_storage_serialization_test_double.xml b/test/unlimited_storage_serialization_test_double.xml index 29a166d1..8532503e 100644 --- a/test/unlimited_storage_serialization_test_double.xml +++ b/test/unlimited_storage_serialization_test_double.xml @@ -1,3 +1,11 @@ + + diff --git a/test/unlimited_storage_serialization_test_large_int.xml b/test/unlimited_storage_serialization_test_large_int.xml index 0d2ca6b7..e77ec437 100644 --- a/test/unlimited_storage_serialization_test_large_int.xml +++ b/test/unlimited_storage_serialization_test_large_int.xml @@ -1,3 +1,11 @@ + + diff --git a/test/unlimited_storage_serialization_test_u16.xml b/test/unlimited_storage_serialization_test_u16.xml index a3e7d752..c29f8600 100644 --- a/test/unlimited_storage_serialization_test_u16.xml +++ b/test/unlimited_storage_serialization_test_u16.xml @@ -1,3 +1,11 @@ + + diff --git a/test/unlimited_storage_serialization_test_u32.xml b/test/unlimited_storage_serialization_test_u32.xml index f38572fb..709ad01a 100644 --- a/test/unlimited_storage_serialization_test_u32.xml +++ b/test/unlimited_storage_serialization_test_u32.xml @@ -1,3 +1,11 @@ + + diff --git a/test/unlimited_storage_serialization_test_u64.xml b/test/unlimited_storage_serialization_test_u64.xml index 529fac3d..a6fed6ff 100644 --- a/test/unlimited_storage_serialization_test_u64.xml +++ b/test/unlimited_storage_serialization_test_u64.xml @@ -1,3 +1,11 @@ + + diff --git a/test/unlimited_storage_serialization_test_u8.xml b/test/unlimited_storage_serialization_test_u8.xml index f603f7c0..80dd69b7 100644 --- a/test/unlimited_storage_serialization_test_u8.xml +++ b/test/unlimited_storage_serialization_test_u8.xml @@ -1,3 +1,11 @@ + + diff --git a/test/unlimited_storage_test.cpp b/test/unlimited_storage_test.cpp index e1882b1c..48704fea 100644 --- a/test/unlimited_storage_test.cpp +++ b/test/unlimited_storage_test.cpp @@ -49,13 +49,13 @@ unlimited_storage_type prepare(std::size_t n, T x = T{}) { } template -auto max() { - return std::numeric_limits::max(); +auto limits_max() { + return (std::numeric_limits::max)(); } template <> -inline auto max() { - return large_int(std::numeric_limits::max()); +inline auto limits_max() { + return large_int(limits_max()); } template @@ -97,7 +97,7 @@ void equal_2() { template void increase_and_grow() { - auto tmax = max(); + auto tmax = limits_max(); auto s = prepare(2, tmax); auto n = s; auto n2 = s; @@ -205,7 +205,7 @@ struct adder { // LHS is never downgraded, only upgraded to RHS. // If RHS is normal integer, LHS doesn't change. BOOST_TEST_EQ(unsafe_access::unlimited_storage_buffer(a).type, - iRHS < 4 ? iLHS : std::max(iLHS, iRHS)); + iRHS < 4 ? iLHS : (std::max)(iLHS, iRHS)); BOOST_TEST_EQ(a[0], 2); } { @@ -224,7 +224,7 @@ struct adder { // If RHS is normal integer, LHS doesn't change. a[0] += b[0]; BOOST_TEST_EQ(unsafe_access::unlimited_storage_buffer(a).type, - iRHS < 4 ? iLHS : std::max(iLHS, iRHS)); + iRHS < 4 ? iLHS : (std::max)(iLHS, iRHS)); BOOST_TEST_EQ(a[0], 2); a[0] -= b[0]; BOOST_TEST_EQ(a[0], 0); @@ -233,17 +233,17 @@ struct adder { } { auto a = prepare(1); - auto b = max(); + auto b = limits_max(); // LHS is never downgraded, only upgraded to RHS. // If RHS is normal integer, LHS doesn't change. a[0] += b; // BOOST_TEST_EQ(unsafe_access::unlimited_storage_buffer(a).type, // iRHS < 4 ? iLHS : std::max(iLHS, iRHS)); - BOOST_TEST_EQ(a[0], max()); + BOOST_TEST_EQ(a[0], limits_max()); a[0] += prepare(1, b)[0]; // BOOST_TEST_EQ(unsafe_access::unlimited_storage_buffer(a).type, // iRHS < 4 ? iLHS + 1 : std::max(iLHS, iRHS)); - BOOST_TEST_EQ(a[0], 2 * double(max())); + BOOST_TEST_EQ(a[0], 2 * double(limits_max())); } } }; @@ -471,7 +471,7 @@ int main() { // test failure in buffer.make(n, iter), AT::construct s.reset(3); - s[1] = std::numeric_limits::max(); + s[1] = (std::numeric_limits::max)(); db.failure_countdown = 2; const auto old_ptr = buffer.ptr; BOOST_TEST_THROWS(++s[1], std::bad_alloc); diff --git a/test/utility_serialization.hpp b/test/utility_serialization.hpp index 734fd549..75ab38d9 100644 --- a/test/utility_serialization.hpp +++ b/test/utility_serialization.hpp @@ -9,8 +9,8 @@ #include #include +#include #include -#include #include #include #include @@ -30,7 +30,13 @@ std::string join(const char* a, const char* b) { template void load_xml(const std::string& filename, T& t) { std::ifstream ifs(filename); - assert(ifs.is_open()); + BOOST_ASSERT(ifs.is_open()); + // manually skip XML comments at the beginning of the stream, because of + // https://github.com/boostorg/serialization/issues/169 + char line[128]; + do { + ifs.getline(line, 128); + } while (!ifs.fail() && !ifs.eof() && std::strstr(line, "-->") == nullptr); boost::archive::xml_iarchive ia(ifs); ia >> boost::serialization::make_nvp("item", t); } diff --git a/tools/add_boilerplate.py b/tools/add_boilerplate.py index d161f66c..3ba81c4d 100755 --- a/tools/add_boilerplate.py +++ b/tools/add_boilerplate.py @@ -1,4 +1,9 @@ #!/usr/bin/env python3 + +# Copyright Hans Dembinski 2019 +# 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 + import sys from os.path import abspath, join import re @@ -8,7 +13,7 @@ project_dir = "/".join(abspath(__file__).split("/")[:-2]) filename = abspath(sys.argv[1]) -copyright = """// Copyright {} Hans Dembinski +copyright = """// Copyright Hans Dembinski {} // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt diff --git a/tools/build_check.py b/tools/check_build_system.py similarity index 78% rename from tools/build_check.py rename to tools/check_build_system.py index 03572bca..f18d8354 100755 --- a/tools/build_check.py +++ b/tools/check_build_system.py @@ -1,4 +1,9 @@ #!/usr/bin/env python3 + +# Copyright Hans Dembinski 2019 +# 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 + from __future__ import print_function import sys import glob diff --git a/tools/cov.sh b/tools/cov.sh index 163a862c..34594982 100755 --- a/tools/cov.sh +++ b/tools/cov.sh @@ -1,5 +1,10 @@ #!/bin/sh # must be executed in project root folder + +# Copyright Hans Dembinski 2018-2019 +# 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 + if [ -z $GCOV ]; then for i in 9 8 5; do if test $(which gcov-$i); then diff --git a/tools/llvm-gcov.sh b/tools/llvm-gcov.sh index 84023e48..3b1fff46 100755 --- a/tools/llvm-gcov.sh +++ b/tools/llvm-gcov.sh @@ -1,2 +1,7 @@ #!/bin/sh + +# Copyright Hans Dembinski 2018-2019 +# 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 + exec llvm-cov gcov "$@"