Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ function(boost_json_setup_properties target)

target_link_libraries(${target}
PUBLIC
Boost::align
Boost::assert
Boost::config
Boost::container
Expand Down
2 changes: 0 additions & 2 deletions build.jam
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import-search [ path.join $(__file__:D) pretty_printers ] ;
using boost-pretty-printers ;

constant boost_dependencies :
/boost/align//boost_align
/boost/assert//boost_assert
/boost/config//boost_config
/boost/container//boost_container
Expand All @@ -20,7 +19,6 @@ constant boost_dependencies :
/boost/describe//boost_describe
/boost/endian//boost_endian
/boost/mp11//boost_mp11
/boost/static_assert//boost_static_assert
/boost/system//boost_system
/boost/throw_exception//boost_throw_exception ;

Expand Down
1 change: 0 additions & 1 deletion include/boost/json/detail/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
#include <boost/config.hpp>
#include <boost/config/pragma_message.hpp>
#include <boost/assert.hpp>
#include <boost/static_assert.hpp>
#include <boost/throw_exception.hpp>
#include <cstdint>
#include <type_traits>
Expand Down
12 changes: 6 additions & 6 deletions include/boost/json/detail/impl/stack.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
#ifndef BOOST_JSON_DETAIL_IMPL_STACK_HPP
#define BOOST_JSON_DETAIL_IMPL_STACK_HPP

#include <boost/align/align.hpp>
#include <boost/static_assert.hpp>
#include <boost/core/detail/static_assert.hpp>
#include <memory>

namespace boost {
namespace json {
Expand Down Expand Up @@ -68,7 +68,7 @@ stack::
push_unchecked(T const& t)
{
constexpr std::size_t n = sizeof(T);
BOOST_STATIC_ASSERT( is_trivially_copy_assignable<T>::value );
BOOST_CORE_STATIC_ASSERT( is_trivially_copy_assignable<T>::value );
BOOST_ASSERT( n <= cap_ - size_ );
std::memcpy( base_ + size_, &t, n );
size_ += n;
Expand All @@ -80,7 +80,7 @@ stack::
peek(T& t)
{
constexpr std::size_t n = sizeof(T);
BOOST_STATIC_ASSERT( is_trivially_copy_assignable<T>::value );
BOOST_CORE_STATIC_ASSERT( is_trivially_copy_assignable<T>::value );
BOOST_ASSERT( size_ >= n );
std::memcpy( &t, base_ + size_ - n, n );
}
Expand All @@ -104,7 +104,7 @@ void
stack::
push(T&& t, std::false_type)
{
BOOST_STATIC_ASSERT( ! is_trivially_copy_assignable<T>::value );
BOOST_CORE_STATIC_ASSERT( ! is_trivially_copy_assignable<T>::value );

using Holder = non_trivial< remove_cvref<T> >;
constexpr std::size_t size = sizeof(Holder);
Expand All @@ -117,7 +117,7 @@ push(T&& t, std::false_type)
std::size_t space = cap_ - size_;
unsigned char* buf = base_ + size_;
ptr = buf;
if( alignment::align(alignment, size, ptr, space) )
if( std::align(alignment, size, ptr, space) )
{
offset = (reinterpret_cast<unsigned char*>(ptr) - buf) + size;
break;
Expand Down
3 changes: 2 additions & 1 deletion include/boost/json/detail/sbo_buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#ifndef BOOST_JSON_DETAIL_SBO_BUFFER_HPP
#define BOOST_JSON_DETAIL_SBO_BUFFER_HPP

#include <boost/core/detail/static_assert.hpp>
#include <boost/json/detail/config.hpp>
#include <boost/json/detail/except.hpp>
#include <string>
Expand All @@ -28,7 +29,7 @@ class sbo_buffer
std::size_t size;
char* ptr;
};
BOOST_STATIC_ASSERT( N >= sizeof(size_ptr_pair) );
BOOST_CORE_STATIC_ASSERT( N >= sizeof(size_ptr_pair) );

union {
std::array<char, N> buffer_;
Expand Down
13 changes: 7 additions & 6 deletions include/boost/json/detail/string_impl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#ifndef BOOST_JSON_DETAIL_STRING_IMPL_HPP
#define BOOST_JSON_DETAIL_STRING_IMPL_HPP

#include <boost/core/detail/static_assert.hpp>
#include <boost/json/detail/config.hpp>
#include <boost/json/kind.hpp>
#include <boost/json/storage_ptr.hpp>
Expand Down Expand Up @@ -85,13 +86,13 @@ class string_impl
};

#if BOOST_JSON_ARCH == 64
BOOST_STATIC_ASSERT(sizeof(sbo) <= 16);
BOOST_STATIC_ASSERT(sizeof(pointer) <= 16);
BOOST_STATIC_ASSERT(sizeof(key) <= 16);
BOOST_CORE_STATIC_ASSERT( sizeof(sbo) <= 16 );
BOOST_CORE_STATIC_ASSERT( sizeof(pointer) <= 16 );
BOOST_CORE_STATIC_ASSERT( sizeof(key) <= 16 );
#elif BOOST_JSON_ARCH == 32
BOOST_STATIC_ASSERT(sizeof(sbo) <= 24);
BOOST_STATIC_ASSERT(sizeof(pointer) <= 24);
BOOST_STATIC_ASSERT(sizeof(key) <= 24);
BOOST_CORE_STATIC_ASSERT( sizeof(sbo) <= 24 );
BOOST_CORE_STATIC_ASSERT( sizeof(pointer) <= 24 );
BOOST_CORE_STATIC_ASSERT( sizeof(key) <= 24 );
#endif

public:
Expand Down
3 changes: 2 additions & 1 deletion include/boost/json/detail/value_to.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#ifndef BOOST_JSON_DETAIL_VALUE_TO_HPP
#define BOOST_JSON_DETAIL_VALUE_TO_HPP

#include <boost/core/detail/static_assert.hpp>
#include <boost/json/value.hpp>
#include <boost/json/conversion.hpp>
#include <boost/json/result_for.hpp>
Expand Down Expand Up @@ -406,7 +407,7 @@ value_to_impl(
value const& jv,
Ctx const& ctx )
{
BOOST_STATIC_ASSERT( std::is_default_constructible<T>::value );
BOOST_CORE_STATIC_ASSERT( std::is_default_constructible<T>::value );
system::result<T> res;

auto* obj = jv.if_object();
Expand Down
11 changes: 5 additions & 6 deletions include/boost/json/impl/array.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef BOOST_JSON_IMPL_ARRAY_HPP
#define BOOST_JSON_IMPL_ARRAY_HPP

#include <boost/core/detail/static_assert.hpp>
#include <boost/json/value.hpp>
#include <boost/json/detail/except.hpp>
#include <algorithm>
Expand Down Expand Up @@ -142,9 +143,8 @@ array(
std::move(sp),
iter_cat<InputIt>{})
{
BOOST_STATIC_ASSERT(
std::is_constructible<value,
decltype(*first)>::value);
BOOST_CORE_STATIC_ASSERT((
std::is_constructible<value, decltype(*first)>::value));
}

//----------------------------------------------------------
Expand All @@ -161,9 +161,8 @@ insert(
InputIt first, InputIt last) ->
iterator
{
BOOST_STATIC_ASSERT(
std::is_constructible<value,
decltype(*first)>::value);
BOOST_CORE_STATIC_ASSERT((
std::is_constructible<value, decltype(*first)>::value));
return insert(pos, first, last,
iter_cat<InputIt>{});
}
Expand Down
4 changes: 2 additions & 2 deletions include/boost/json/impl/array.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef BOOST_JSON_IMPL_ARRAY_IPP
#define BOOST_JSON_IMPL_ARRAY_IPP

#include <boost/core/detail/static_assert.hpp>
#include <boost/container_hash/hash.hpp>
#include <boost/json/array.hpp>
#include <boost/json/pilfer.hpp>
Expand Down Expand Up @@ -178,8 +179,7 @@ array::
array(detail::unchecked_array&& ua)
: sp_(ua.storage())
{
BOOST_STATIC_ASSERT(
alignof(table) == alignof(value));
BOOST_CORE_STATIC_ASSERT( alignof(table) == alignof(value) );
if(ua.size() == 0)
{
t_ = &empty_;
Expand Down
7 changes: 2 additions & 5 deletions include/boost/json/impl/monotonic_resource.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#include <boost/json/monotonic_resource.hpp>
#include <boost/json/detail/except.hpp>
#include <boost/align/align.hpp>
#include <boost/core/max_align.hpp>

#include <memory>
Expand Down Expand Up @@ -120,8 +119,7 @@ do_allocate(
std::size_t n,
std::size_t align)
{
auto p = alignment::align(
align, n, head_->p, head_->avail);
auto p = std::align(align, n, head_->p, head_->avail);
if(p)
{
head_->p = reinterpret_cast<
Expand All @@ -141,8 +139,7 @@ do_allocate(
head_ = b;
next_size_ = next_pow2(next_size_);

p = alignment::align(
align, n, head_->p, head_->avail);
p = std::align(align, n, head_->p, head_->avail);
BOOST_ASSERT(p);
head_->p = reinterpret_cast<
unsigned char*>(p) + n;
Expand Down
9 changes: 4 additions & 5 deletions include/boost/json/impl/object.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef BOOST_JSON_IMPL_OBJECT_HPP
#define BOOST_JSON_IMPL_OBJECT_HPP

#include <boost/core/detail/static_assert.hpp>
#include <boost/json/value.hpp>
#include <iterator>
#include <cmath>
Expand All @@ -29,9 +30,8 @@ constexpr
std::size_t
small_object_size_ = 18;

BOOST_STATIC_ASSERT(
small_object_size_ <
BOOST_JSON_MAX_STRUCTURED_SIZE);
BOOST_CORE_STATIC_ASSERT(
small_object_size_ < BOOST_JSON_MAX_STRUCTURED_SIZE);

} // detail

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

Expand Down
6 changes: 3 additions & 3 deletions include/boost/json/impl/object.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef BOOST_JSON_IMPL_OBJECT_IPP
#define BOOST_JSON_IMPL_OBJECT_IPP

#include <boost/core/detail/static_assert.hpp>
#include <boost/container_hash/hash.hpp>
#include <boost/json/object.hpp>
#include <boost/json/detail/digest.hpp>
Expand Down Expand Up @@ -128,9 +129,8 @@ allocate(
std::uintptr_t salt,
storage_ptr const& sp)
{
BOOST_STATIC_ASSERT(
alignof(key_value_pair) >=
alignof(index_t));
BOOST_CORE_STATIC_ASSERT(
alignof(key_value_pair) >= alignof(index_t));
BOOST_ASSERT(capacity > 0);
BOOST_ASSERT(capacity <= max_size());
table* p;
Expand Down
5 changes: 3 additions & 2 deletions include/boost/json/impl/serializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef BOOST_JSON_IMPL_SERIALIZER_HPP
#define BOOST_JSON_IMPL_SERIALIZER_HPP

#include <boost/core/detail/static_assert.hpp>
#include <boost/describe/enum_to_string.hpp>
#include <boost/json/conversion.hpp>
#include <cstddef>
Expand Down Expand Up @@ -832,8 +833,8 @@ template<class T>
void
serializer::reset(T const* p) noexcept
{
BOOST_STATIC_ASSERT( !std::is_pointer<T>::value );
BOOST_STATIC_ASSERT( std::is_object<T>::value );
BOOST_CORE_STATIC_ASSERT( !std::is_pointer<T>::value );
BOOST_CORE_STATIC_ASSERT( std::is_object<T>::value );

p_ = p;
fn0_ = &detail::write_impl<T, true>;
Expand Down
3 changes: 2 additions & 1 deletion include/boost/json/impl/serializer.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef BOOST_JSON_IMPL_SERIALIZER_IPP
#define BOOST_JSON_IMPL_SERIALIZER_IPP

#include <boost/core/detail/static_assert.hpp>
#include <boost/json/serializer.hpp>
#include <boost/json/detail/format.hpp>
#include <boost/json/detail/sse2.hpp>
Expand Down Expand Up @@ -70,7 +71,7 @@ writer(
, opts_(opts)
{
// ensure room for \uXXXX escape plus one
BOOST_STATIC_ASSERT(sizeof(buf_) >= 7);
BOOST_CORE_STATIC_ASSERT( sizeof(buf_) >= 7 );
}

bool
Expand Down
4 changes: 1 addition & 3 deletions include/boost/json/impl/static_resource.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#include <boost/json/static_resource.hpp>
#include <boost/throw_exception.hpp>
#include <boost/align/align.hpp>
#include <memory>

namespace boost {
Expand Down Expand Up @@ -43,8 +42,7 @@ do_allocate(
std::size_t n,
std::size_t align)
{
auto p = alignment::align(
align, n, p_, n_);
auto p = std::align(align, n, p_, n_);
if(! p)
throw_exception( std::bad_alloc(), BOOST_CURRENT_LOCATION );
p_ = reinterpret_cast<char*>(p) + n;
Expand Down
7 changes: 3 additions & 4 deletions include/boost/json/pilfer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef BOOST_JSON_PILFER_HPP
#define BOOST_JSON_PILFER_HPP

#include <boost/core/detail/static_assert.hpp>
#include <boost/json/detail/config.hpp>
#include <type_traits>
#include <utility>
Expand Down Expand Up @@ -187,8 +188,7 @@ pilfer(T&& t) noexcept ->
{
using U =
typename std::remove_reference<T>::type;
static_assert(
is_pilfer_constructible<U>::value, "");
BOOST_CORE_STATIC_ASSERT( is_pilfer_constructible<U>::value );
return typename std::conditional<
std::is_nothrow_constructible<
U, pilfered<U> >::value &&
Expand All @@ -203,8 +203,7 @@ template<class T>
void
relocate(T* dest, T& src) noexcept
{
static_assert(
is_pilfer_constructible<T>::value, "");
BOOST_CORE_STATIC_ASSERT( is_pilfer_constructible<T>::value );
::new(dest) T(pilfer(src));
src.~T();
}
Expand Down
6 changes: 3 additions & 3 deletions include/boost/json/storage_ptr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef BOOST_JSON_STORAGE_PTR_HPP
#define BOOST_JSON_STORAGE_PTR_HPP

#include <boost/core/detail/static_assert.hpp>
#include <boost/container/pmr/polymorphic_allocator.hpp>
#include <boost/json/detail/config.hpp>
#include <boost/json/detail/shared_resource.hpp>
Expand Down Expand Up @@ -424,9 +425,8 @@ make_shared_resource(Args&&... args)
{
// If this generates an error, it means that
// `T` is not a memory resource.
BOOST_STATIC_ASSERT(
std::is_base_of<
container::pmr::memory_resource, U>::value);
BOOST_CORE_STATIC_ASSERT((
std::is_base_of<container::pmr::memory_resource, U>::value));
return storage_ptr(new
detail::shared_resource_impl<U>(
std::forward<Args>(args)...));
Expand Down
5 changes: 3 additions & 2 deletions include/boost/json/value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#ifndef BOOST_JSON_VALUE_HPP
#define BOOST_JSON_VALUE_HPP

#include <boost/core/detail/static_assert.hpp>
#include <boost/json/detail/config.hpp>
#include <boost/json/array.hpp>
#include <boost/json/kind.hpp>
Expand Down Expand Up @@ -3323,9 +3324,9 @@ class value

// Make sure things are as big as we think they should be
#if BOOST_JSON_ARCH == 64
BOOST_STATIC_ASSERT(sizeof(value) == 24);
BOOST_CORE_STATIC_ASSERT( sizeof(value) == 24 );
#elif BOOST_JSON_ARCH == 32
BOOST_STATIC_ASSERT(sizeof(value) == 16);
BOOST_CORE_STATIC_ASSERT( sizeof(value) == 16 );
#else
# error Unknown architecture
#endif
Expand Down
Loading
Loading