Fix warnings in boost test matrix

* should fix warnings for gcc-6, clang-3.8 to 4.0, msvc-14.1 and 14.2
* should fix errors for clang-6 with cxxstd=17, clang-8 with cxxstd=2a
This commit is contained in:
Hans Dembinski 2019-10-19 15:14:10 +01:00 committed by GitHub
parent b12898a366
commit 307b65b7ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 31 additions and 28 deletions

View File

@ -49,6 +49,7 @@ test_script:
../../b2 $B2_OPTS toolset=gcc-9 cxxstd=latest examples test//all && ../../b2 $B2_OPTS toolset=gcc-9 cxxstd=latest examples test//all &&
../../b2 $B2_OPTS toolset=clang cxxstd=latest variant=histogram_ubasan test//all ../../b2 $B2_OPTS toolset=clang cxxstd=latest variant=histogram_ubasan test//all
on_failure: ## Uncomment the following to stop VM and enable interactive login.
# Uncomment the following line to stop VM and enable interactive login ## Instructions how to log into the Appveyor VM are automatically printed.
- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1')) # on_failure:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

View File

@ -8,12 +8,12 @@
#define BOOST_HISTOGRAM_DETAIL_ARGS_TYPE_HPP #define BOOST_HISTOGRAM_DETAIL_ARGS_TYPE_HPP
#include <boost/config/workaround.hpp> #include <boost/config/workaround.hpp>
#if BOOST_WORKAROUND(BOOST_GCC, >= 60000) #if BOOST_WORKAROUND(BOOST_GCC, >= 65000)
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnoexcept-type" #pragma GCC diagnostic ignored "-Wnoexcept-type"
#endif #endif
#include <boost/callable_traits/args.hpp> #include <boost/callable_traits/args.hpp>
#if BOOST_WORKAROUND(BOOST_GCC, >= 60000) #if BOOST_WORKAROUND(BOOST_GCC, >= 65000)
#pragma GCC diagnostic pop #pragma GCC diagnostic pop
#endif #endif
#include <boost/mp11/list.hpp> // mp_pop_front #include <boost/mp11/list.hpp> // mp_pop_front

View File

@ -19,7 +19,9 @@ using std::span;
} // namespace histogram } // namespace histogram
} // namespace boost } // namespace boost
#else #else // C++17 span not available, so we use our implementation
// to be replaced by boost::span
#include <array> #include <array>
#include <boost/assert.hpp> #include <boost/assert.hpp>
@ -221,13 +223,13 @@ public:
#endif #endif
template <class T> template <class T>
span<T> make_span(T* begin, T* end) { auto make_span(T* begin, T* end) {
return span<T>{begin, end}; return dtl::span<T>{begin, end};
} }
template <class T> template <class T>
span<T> make_span(T* begin, std::size_t size) { auto make_span(T* begin, std::size_t size) {
return span<T>{begin, size}; return dtl::span<T>{begin, size};
} }
template <class Container, class = decltype(dtl::size(std::declval<Container>()), template <class Container, class = decltype(dtl::size(std::declval<Container>()),
@ -237,8 +239,8 @@ auto make_span(const Container& cont) {
} }
template <class T, std::size_t N> template <class T, std::size_t N>
span<T> make_span(T (&arr)[N]) { auto make_span(T (&arr)[N]) {
return span<T>(arr, N); return dtl::span<T>(arr, N);
} }
} // namespace detail } // namespace detail

View File

@ -12,8 +12,7 @@
Forward declarations, tag types and type aliases. Forward declarations, tag types and type aliases.
*/ */
#include <boost/config.hpp> // BOOST_ATTRIBUTE_NODISCARD #include <boost/config.hpp> // BOOST_ATTRIBUTE_NODISCARD
#include <boost/config/workaround.hpp> // BOOST_WORKAROUND
#include <boost/core/use_default.hpp> #include <boost/core/use_default.hpp>
#include <vector> #include <vector>
@ -120,18 +119,19 @@ using weighted_profile_storage = dense_storage<accumulators::weighted_mean<>>;
#ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED #ifndef BOOST_HISTOGRAM_DOXYGEN_INVOKED
#if BOOST_WORKAROUND(BOOST_CLANG, >= 0) // hot-fix until patch is accepted upstream in boost.config
#pragma GCC diagnostic push #ifdef __has_cpp_attribute
#pragma GCC diagnostic ignored "-Wc++17-extensions" #undef BOOST_ATTRIBUTE_NODISCARD
#if __has_cpp_attribute(nodiscard) && !(defined(__clang__) && (__cplusplus < 201700))
#define BOOST_ATTRIBUTE_NODISCARD [[nodiscard]]
#else
#define BOOST_ATTRIBUTE_NODISCARD
#endif
#endif #endif
template <class Axes, class Storage = default_storage> template <class Axes, class Storage = default_storage>
class BOOST_ATTRIBUTE_NODISCARD histogram; class BOOST_ATTRIBUTE_NODISCARD histogram;
#if BOOST_WORKAROUND(BOOST_CLANG, >= 0)
#pragma GCC diagnostic pop
#endif
#endif #endif
} // namespace histogram } // namespace histogram
} // namespace boost } // namespace boost

View File

@ -45,7 +45,7 @@ private:
BOOST_ATTRIBUTE_UNUSED inline void log_impl() {} BOOST_ATTRIBUTE_UNUSED inline void log_impl() {}
template <class T, class... Ts> template <class T, class... Ts>
inline void log_impl(T&& t, Ts&&... ts) { void log_impl(T&& t, Ts&&... ts) {
std::cerr << t; std::cerr << t;
log_impl(std::forward<Ts>(ts)...); log_impl(std::forward<Ts>(ts)...);
} }
@ -81,18 +81,18 @@ struct tracing_allocator {
} else } else
db->log("allocator +", n, " ", boost::histogram::detail::type_name<T>()); db->log("allocator +", n, " ", boost::histogram::detail::type_name<T>());
auto& p = db->at<T>(); auto& p = db->at<T>();
p.first += n; p.first += static_cast<int>(n);
p.second += n; p.second += static_cast<int>(n);
db->first += n * sizeof(T); db->first += static_cast<int>(n * sizeof(T));
db->second += n * sizeof(T); db->second += static_cast<int>(n * sizeof(T));
} }
return static_cast<T*>(::operator new(n * sizeof(T))); return static_cast<T*>(::operator new(n * sizeof(T)));
} }
void deallocate(T* p, std::size_t n) { void deallocate(T* p, std::size_t n) {
if (db) { if (db) {
db->at<T>().first -= n; db->at<T>().first -= static_cast<int>(n);
db->first -= n * sizeof(T); db->first -= static_cast<int>(n * sizeof(T));
db->log("allocator -", n, " ", boost::histogram::detail::type_name<T>()); db->log("allocator -", n, " ", boost::histogram::detail::type_name<T>());
} }
::operator delete((void*)p); ::operator delete((void*)p);