Skip to content

Commit 427baa6

Browse files
committed
remove dependency on StaticAssert
1 parent 49ae797 commit 427baa6

35 files changed

+276
-200
lines changed

build.jam

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ constant boost_dependencies :
1919
/boost/describe//boost_describe
2020
/boost/endian//boost_endian
2121
/boost/mp11//boost_mp11
22-
/boost/static_assert//boost_static_assert
2322
/boost/system//boost_system
2423
/boost/throw_exception//boost_throw_exception ;
2524

include/boost/json/detail/config.hpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <boost/config.hpp>
1414
#include <boost/config/pragma_message.hpp>
1515
#include <boost/assert.hpp>
16-
#include <boost/static_assert.hpp>
1716
#include <boost/throw_exception.hpp>
1817
#include <cstdint>
1918
#include <type_traits>

include/boost/json/detail/impl/stack.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#ifndef BOOST_JSON_DETAIL_IMPL_STACK_HPP
1111
#define BOOST_JSON_DETAIL_IMPL_STACK_HPP
1212

13-
#include <boost/static_assert.hpp>
13+
#include <boost/core/detail/static_assert.hpp>
1414
#include <memory>
1515

1616
namespace boost {
@@ -68,7 +68,7 @@ stack::
6868
push_unchecked(T const& t)
6969
{
7070
constexpr std::size_t n = sizeof(T);
71-
BOOST_STATIC_ASSERT( is_trivially_copy_assignable<T>::value );
71+
BOOST_CORE_STATIC_ASSERT( is_trivially_copy_assignable<T>::value );
7272
BOOST_ASSERT( n <= cap_ - size_ );
7373
std::memcpy( base_ + size_, &t, n );
7474
size_ += n;
@@ -80,7 +80,7 @@ stack::
8080
peek(T& t)
8181
{
8282
constexpr std::size_t n = sizeof(T);
83-
BOOST_STATIC_ASSERT( is_trivially_copy_assignable<T>::value );
83+
BOOST_CORE_STATIC_ASSERT( is_trivially_copy_assignable<T>::value );
8484
BOOST_ASSERT( size_ >= n );
8585
std::memcpy( &t, base_ + size_ - n, n );
8686
}
@@ -104,7 +104,7 @@ void
104104
stack::
105105
push(T&& t, std::false_type)
106106
{
107-
BOOST_STATIC_ASSERT( ! is_trivially_copy_assignable<T>::value );
107+
BOOST_CORE_STATIC_ASSERT( ! is_trivially_copy_assignable<T>::value );
108108

109109
using Holder = non_trivial< remove_cvref<T> >;
110110
constexpr std::size_t size = sizeof(Holder);

include/boost/json/detail/sbo_buffer.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#ifndef BOOST_JSON_DETAIL_SBO_BUFFER_HPP
1212
#define BOOST_JSON_DETAIL_SBO_BUFFER_HPP
1313

14+
#include <boost/core/detail/static_assert.hpp>
1415
#include <boost/json/detail/config.hpp>
1516
#include <boost/json/detail/except.hpp>
1617
#include <string>
@@ -28,7 +29,7 @@ class sbo_buffer
2829
std::size_t size;
2930
char* ptr;
3031
};
31-
BOOST_STATIC_ASSERT( N >= sizeof(size_ptr_pair) );
32+
BOOST_CORE_STATIC_ASSERT( N >= sizeof(size_ptr_pair) );
3233

3334
union {
3435
std::array<char, N> buffer_;

include/boost/json/detail/string_impl.hpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#ifndef BOOST_JSON_DETAIL_STRING_IMPL_HPP
1212
#define BOOST_JSON_DETAIL_STRING_IMPL_HPP
1313

14+
#include <boost/core/detail/static_assert.hpp>
1415
#include <boost/json/detail/config.hpp>
1516
#include <boost/json/kind.hpp>
1617
#include <boost/json/storage_ptr.hpp>
@@ -85,13 +86,13 @@ class string_impl
8586
};
8687

8788
#if BOOST_JSON_ARCH == 64
88-
BOOST_STATIC_ASSERT(sizeof(sbo) <= 16);
89-
BOOST_STATIC_ASSERT(sizeof(pointer) <= 16);
90-
BOOST_STATIC_ASSERT(sizeof(key) <= 16);
89+
BOOST_CORE_STATIC_ASSERT( sizeof(sbo) <= 16 );
90+
BOOST_CORE_STATIC_ASSERT( sizeof(pointer) <= 16 );
91+
BOOST_CORE_STATIC_ASSERT( sizeof(key) <= 16 );
9192
#elif BOOST_JSON_ARCH == 32
92-
BOOST_STATIC_ASSERT(sizeof(sbo) <= 24);
93-
BOOST_STATIC_ASSERT(sizeof(pointer) <= 24);
94-
BOOST_STATIC_ASSERT(sizeof(key) <= 24);
93+
BOOST_CORE_STATIC_ASSERT( sizeof(sbo) <= 24 );
94+
BOOST_CORE_STATIC_ASSERT( sizeof(pointer) <= 24 );
95+
BOOST_CORE_STATIC_ASSERT( sizeof(key) <= 24 );
9596
#endif
9697

9798
public:

include/boost/json/detail/value_to.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#ifndef BOOST_JSON_DETAIL_VALUE_TO_HPP
1313
#define BOOST_JSON_DETAIL_VALUE_TO_HPP
1414

15+
#include <boost/core/detail/static_assert.hpp>
1516
#include <boost/json/value.hpp>
1617
#include <boost/json/conversion.hpp>
1718
#include <boost/json/result_for.hpp>
@@ -406,7 +407,7 @@ value_to_impl(
406407
value const& jv,
407408
Ctx const& ctx )
408409
{
409-
BOOST_STATIC_ASSERT( std::is_default_constructible<T>::value );
410+
BOOST_CORE_STATIC_ASSERT( std::is_default_constructible<T>::value );
410411
system::result<T> res;
411412

412413
auto* obj = jv.if_object();

include/boost/json/impl/array.hpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#ifndef BOOST_JSON_IMPL_ARRAY_HPP
1111
#define BOOST_JSON_IMPL_ARRAY_HPP
1212

13+
#include <boost/core/detail/static_assert.hpp>
1314
#include <boost/json/value.hpp>
1415
#include <boost/json/detail/except.hpp>
1516
#include <algorithm>
@@ -142,9 +143,8 @@ array(
142143
std::move(sp),
143144
iter_cat<InputIt>{})
144145
{
145-
BOOST_STATIC_ASSERT(
146-
std::is_constructible<value,
147-
decltype(*first)>::value);
146+
BOOST_CORE_STATIC_ASSERT((
147+
std::is_constructible<value, decltype(*first)>::value));
148148
}
149149

150150
//----------------------------------------------------------
@@ -161,9 +161,8 @@ insert(
161161
InputIt first, InputIt last) ->
162162
iterator
163163
{
164-
BOOST_STATIC_ASSERT(
165-
std::is_constructible<value,
166-
decltype(*first)>::value);
164+
BOOST_CORE_STATIC_ASSERT((
165+
std::is_constructible<value, decltype(*first)>::value));
167166
return insert(pos, first, last,
168167
iter_cat<InputIt>{});
169168
}

include/boost/json/impl/array.ipp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#ifndef BOOST_JSON_IMPL_ARRAY_IPP
1111
#define BOOST_JSON_IMPL_ARRAY_IPP
1212

13+
#include <boost/core/detail/static_assert.hpp>
1314
#include <boost/container_hash/hash.hpp>
1415
#include <boost/json/array.hpp>
1516
#include <boost/json/pilfer.hpp>
@@ -178,8 +179,7 @@ array::
178179
array(detail::unchecked_array&& ua)
179180
: sp_(ua.storage())
180181
{
181-
BOOST_STATIC_ASSERT(
182-
alignof(table) == alignof(value));
182+
BOOST_CORE_STATIC_ASSERT( alignof(table) == alignof(value) );
183183
if(ua.size() == 0)
184184
{
185185
t_ = &empty_;

include/boost/json/impl/object.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#ifndef BOOST_JSON_IMPL_OBJECT_HPP
1111
#define BOOST_JSON_IMPL_OBJECT_HPP
1212

13+
#include <boost/core/detail/static_assert.hpp>
1314
#include <boost/json/value.hpp>
1415
#include <iterator>
1516
#include <cmath>
@@ -29,9 +30,8 @@ constexpr
2930
std::size_t
3031
small_object_size_ = 18;
3132

32-
BOOST_STATIC_ASSERT(
33-
small_object_size_ <
34-
BOOST_JSON_MAX_STRUCTURED_SIZE);
33+
BOOST_CORE_STATIC_ASSERT(
34+
small_object_size_ < BOOST_JSON_MAX_STRUCTURED_SIZE);
3535

3636
} // detail
3737

@@ -48,8 +48,7 @@ struct alignas(key_value_pair)
4848
// VFALCO If we make key_value_pair smaller,
4949
// then we might want to revisit this
5050
// padding.
51-
BOOST_STATIC_ASSERT(
52-
sizeof(key_value_pair) == 32);
51+
BOOST_CORE_STATIC_ASSERT( sizeof(key_value_pair) == 32 );
5352
char pad[4] = {}; // silence warnings
5453
#endif
5554

include/boost/json/impl/object.ipp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#ifndef BOOST_JSON_IMPL_OBJECT_IPP
1111
#define BOOST_JSON_IMPL_OBJECT_IPP
1212

13+
#include <boost/core/detail/static_assert.hpp>
1314
#include <boost/container_hash/hash.hpp>
1415
#include <boost/json/object.hpp>
1516
#include <boost/json/detail/digest.hpp>
@@ -128,9 +129,8 @@ allocate(
128129
std::uintptr_t salt,
129130
storage_ptr const& sp)
130131
{
131-
BOOST_STATIC_ASSERT(
132-
alignof(key_value_pair) >=
133-
alignof(index_t));
132+
BOOST_CORE_STATIC_ASSERT(
133+
alignof(key_value_pair) >= alignof(index_t));
134134
BOOST_ASSERT(capacity > 0);
135135
BOOST_ASSERT(capacity <= max_size());
136136
table* p;

0 commit comments

Comments
 (0)