Remove Boost.StaticAssert

This commit is contained in:
Christian Mazakas 2023-09-01 15:03:49 -07:00
parent 15318f0e46
commit d881d4d5e2
5 changed files with 26 additions and 12 deletions

View File

@ -19,7 +19,6 @@
#include <boost/core/serialization.hpp> #include <boost/core/serialization.hpp>
#include <boost/cstdint.hpp> #include <boost/cstdint.hpp>
#include <boost/mp11/tuple.hpp> #include <boost/mp11/tuple.hpp>
#include <boost/static_assert.hpp>
#include <boost/throw_exception.hpp> #include <boost/throw_exception.hpp>
#include <boost/unordered/detail/archive_constructed.hpp> #include <boost/unordered/detail/archive_constructed.hpp>
#include <boost/unordered/detail/bad_archive_exception.hpp> #include <boost/unordered/detail/bad_archive_exception.hpp>
@ -28,6 +27,7 @@
#include <boost/unordered/detail/foa/rw_spinlock.hpp> #include <boost/unordered/detail/foa/rw_spinlock.hpp>
#include <boost/unordered/detail/foa/tuple_rotate_right.hpp> #include <boost/unordered/detail/foa/tuple_rotate_right.hpp>
#include <boost/unordered/detail/serialization_version.hpp> #include <boost/unordered/detail/serialization_version.hpp>
#include <boost/unordered/detail/static_assert.hpp>
#include <cstddef> #include <cstddef>
#include <functional> #include <functional>
#include <initializer_list> #include <initializer_list>
@ -88,7 +88,7 @@ private:
static constexpr std::size_t element_offset= static constexpr std::size_t element_offset=
(sizeof(T)+cacheline_size-1)/cacheline_size*cacheline_size; (sizeof(T)+cacheline_size-1)/cacheline_size*cacheline_size;
BOOST_STATIC_ASSERT(alignof(T)<=cacheline_size); BOOST_UNORDERED_STATIC_ASSERT(alignof(T)<=cacheline_size);
T* data(std::size_t pos)noexcept T* data(std::size_t pos)noexcept
{ {
@ -341,7 +341,7 @@ struct concurrent_table_arrays:table_arrays<Value,Group,SizePolicy,Allocator>
struct atomic_size_control struct atomic_size_control
{ {
static constexpr auto atomic_size_t_size=sizeof(std::atomic<std::size_t>); static constexpr auto atomic_size_t_size=sizeof(std::atomic<std::size_t>);
BOOST_STATIC_ASSERT(atomic_size_t_size<cacheline_size); BOOST_UNORDERED_STATIC_ASSERT(atomic_size_t_size<cacheline_size);
atomic_size_control(std::size_t ml_,std::size_t size_): atomic_size_control(std::size_t ml_,std::size_t size_):
pad0_{},ml{ml_},pad1_{},size{size_}{} pad0_{},ml{ml_},pad1_{},size{size_}{}

View File

@ -22,13 +22,13 @@
#include <boost/core/pointer_traits.hpp> #include <boost/core/pointer_traits.hpp>
#include <boost/cstdint.hpp> #include <boost/cstdint.hpp>
#include <boost/predef.h> #include <boost/predef.h>
#include <boost/static_assert.hpp>
#include <boost/type_traits/has_trivial_constructor.hpp> #include <boost/type_traits/has_trivial_constructor.hpp>
#include <boost/type_traits/has_trivial_copy.hpp> #include <boost/type_traits/has_trivial_copy.hpp>
#include <boost/type_traits/has_trivial_assign.hpp> #include <boost/type_traits/has_trivial_assign.hpp>
#include <boost/type_traits/is_nothrow_swappable.hpp> #include <boost/type_traits/is_nothrow_swappable.hpp>
#include <boost/unordered/detail/narrow_cast.hpp> #include <boost/unordered/detail/narrow_cast.hpp>
#include <boost/unordered/detail/mulx.hpp> #include <boost/unordered/detail/mulx.hpp>
#include <boost/unordered/detail/static_assert.hpp>
#include <boost/unordered/hash_traits.hpp> #include <boost/unordered/hash_traits.hpp>
#include <climits> #include <climits>
#include <cmath> #include <cmath>
@ -311,7 +311,7 @@ struct group15
private: private:
using slot_type=IntegralWrapper<unsigned char>; using slot_type=IntegralWrapper<unsigned char>;
BOOST_STATIC_ASSERT(sizeof(slot_type)==1); BOOST_UNORDERED_STATIC_ASSERT(sizeof(slot_type)==1);
static constexpr unsigned char available_=0, static constexpr unsigned char available_=0,
sentinel_=1; sentinel_=1;
@ -514,7 +514,7 @@ struct group15
private: private:
using slot_type=IntegralWrapper<unsigned char>; using slot_type=IntegralWrapper<unsigned char>;
BOOST_STATIC_ASSERT(sizeof(slot_type)==1); BOOST_UNORDERED_STATIC_ASSERT(sizeof(slot_type)==1);
static constexpr unsigned char available_=0, static constexpr unsigned char available_=0,
sentinel_=1; sentinel_=1;
@ -707,7 +707,7 @@ struct group15
private: private:
using word_type=IntegralWrapper<uint64_t>; using word_type=IntegralWrapper<uint64_t>;
BOOST_STATIC_ASSERT(sizeof(word_type)==8); BOOST_UNORDERED_STATIC_ASSERT(sizeof(word_type)==8);
static constexpr unsigned char available_=0, static constexpr unsigned char available_=0,
sentinel_=1; sentinel_=1;

View File

@ -17,6 +17,7 @@
#include <boost/unordered/detail/fca.hpp> #include <boost/unordered/detail/fca.hpp>
#include <boost/unordered/detail/fwd.hpp> #include <boost/unordered/detail/fwd.hpp>
#include <boost/unordered/detail/serialize_tracked_address.hpp> #include <boost/unordered/detail/serialize_tracked_address.hpp>
#include <boost/unordered/detail/static_assert.hpp>
#include <boost/unordered/detail/type_traits.hpp> #include <boost/unordered/detail/type_traits.hpp>
#include <boost/assert.hpp> #include <boost/assert.hpp>
@ -2132,7 +2133,7 @@ namespace boost {
void merge_unique(boost::unordered::detail::table<Types2>& other) void merge_unique(boost::unordered::detail::table<Types2>& other)
{ {
typedef boost::unordered::detail::table<Types2> other_table; typedef boost::unordered::detail::table<Types2> other_table;
BOOST_STATIC_ASSERT(( BOOST_UNORDERED_STATIC_ASSERT((
boost::is_same<node_type, typename other_table::node_type>::value)); boost::is_same<node_type, typename other_table::node_type>::value));
BOOST_ASSERT(this->node_alloc() == other.node_alloc()); BOOST_ASSERT(this->node_alloc() == other.node_alloc());

View File

@ -9,8 +9,9 @@
#ifndef BOOST_UNORDERED_DETAIL_NARROW_CAST_HPP #ifndef BOOST_UNORDERED_DETAIL_NARROW_CAST_HPP
#define BOOST_UNORDERED_DETAIL_NARROW_CAST_HPP #define BOOST_UNORDERED_DETAIL_NARROW_CAST_HPP
#include <boost/unordered/detail/static_assert.hpp>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/static_assert.hpp>
#include <boost/type_traits/is_integral.hpp> #include <boost/type_traits/is_integral.hpp>
#include <boost/type_traits/make_unsigned.hpp> #include <boost/type_traits/make_unsigned.hpp>
@ -21,9 +22,9 @@ namespace detail{
template<typename To,typename From> template<typename To,typename From>
constexpr To narrow_cast(From x) noexcept constexpr To narrow_cast(From x) noexcept
{ {
BOOST_STATIC_ASSERT(boost::is_integral<From>::value); BOOST_UNORDERED_STATIC_ASSERT(boost::is_integral<From>::value);
BOOST_STATIC_ASSERT(boost::is_integral<To>::value); BOOST_UNORDERED_STATIC_ASSERT(boost::is_integral<To>::value);
BOOST_STATIC_ASSERT(sizeof(From)>=sizeof(To)); BOOST_UNORDERED_STATIC_ASSERT(sizeof(From)>=sizeof(To));
return static_cast<To>( return static_cast<To>(
x x

View File

@ -0,0 +1,12 @@
#ifndef BOOST_UNORDERED_DETAIL_STATIC_ASSERT_HPP
#define BOOST_UNORDERED_DETAIL_STATIC_ASSERT_HPP
#include <boost/config.hpp>
#if defined(BOOST_HAS_PRAGMA_ONCE)
#pragma once
#endif
#define BOOST_UNORDERED_STATIC_ASSERT(...) \
static_assert(__VA_ARGS__, #__VA_ARGS__)
#endif // BOOST_UNORDERED_DETAIL_STATIC_ASSERT_HPP