Skip to content

Commit

Permalink
Hack around g++ bogus name conflict (issue #1499).
Browse files Browse the repository at this point in the history
  • Loading branch information
evoskuil committed Jul 16, 2024
1 parent 971d5d2 commit 0592b10
Show file tree
Hide file tree
Showing 10 changed files with 56 additions and 56 deletions.
8 changes: 4 additions & 4 deletions include/bitcoin/system/impl/stream/streamers/byte_reader.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ data_array_cptr<Size> byte_reader<IStream>::read_forward_cptr() NOEXCEPT
if (!valid())
return {};

const auto cptr = to_allocated<data_array<Size>>(arena());
const auto cptr = to_allocated<data_array<Size>>(get_arena());
if (!cptr)
{
invalidate();
Expand Down Expand Up @@ -400,7 +400,7 @@ chunk_cptr byte_reader<IStream>::read_bytes_cptr(size_t size) NOEXCEPT
return {};

// TODO: bypass vector byte fill.
const auto cptr = to_allocated<data_chunk>(arena(), size);
const auto cptr = to_allocated<data_chunk>(get_arena(), size);
if (!cptr)
{
invalidate();
Expand Down Expand Up @@ -609,14 +609,14 @@ bool byte_reader<IStream>::operator!() const NOEXCEPT

template <typename IStream>
typename byte_reader<IStream>::memory_arena
byte_reader<IStream>::arena() const NOEXCEPT
byte_reader<IStream>::get_arena() const NOEXCEPT
{
return allocator_.resource();
}

template <typename IStream>
typename byte_reader<IStream>::memory_allocator&
byte_reader<IStream>::allocator() const NOEXCEPT
byte_reader<IStream>::get_allocator() const NOEXCEPT
{
return allocator_;
}
Expand Down
4 changes: 2 additions & 2 deletions include/bitcoin/system/stream/streamers/byte_reader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ class byte_reader
void invalidate() NOEXCEPT override;

/// Memory resource used to populate vectors.
memory_arena arena() const NOEXCEPT override;
memory_arena get_arena() const NOEXCEPT override;

/// Memory allocator used to construct objects.
memory_allocator& allocator() const NOEXCEPT override;
memory_allocator& get_allocator() const NOEXCEPT override;

/// The stream is valid.
operator bool() const NOEXCEPT override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ class bytereader
virtual void invalidate() NOEXCEPT = 0;

/// Memory resource used to populate vectors.
virtual memory_arena arena() const NOEXCEPT = 0;
virtual memory_arena get_arena() const NOEXCEPT = 0;

/// Memory allocator used to construct objects.
virtual memory_allocator& allocator() const NOEXCEPT = 0;
virtual memory_allocator& get_allocator() const NOEXCEPT = 0;

/// The stream is valid.
virtual operator bool() const NOEXCEPT = 0;
Expand Down
22 changes: 11 additions & 11 deletions src/chain/block.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ block::block(reader&& source, bool witness) NOEXCEPT
block::block(reader& source, bool witness) NOEXCEPT
////: block(from_data(source, witness))
: header_(
source.allocator().new_object<chain::header>(source),
source.allocator().deleter<chain::header>(source.arena())),
source.get_allocator().new_object<chain::header>(source),
source.get_allocator().deleter<chain::header>(source.get_arena())),
txs_(
source.allocator().new_object<transaction_cptrs>(),
source.allocator().deleter<transaction_cptrs>(source.arena()))
source.get_allocator().new_object<transaction_cptrs>(),
source.get_allocator().deleter<transaction_cptrs>(source.get_arena()))
{
assign_data(source, witness);
}
Expand Down Expand Up @@ -150,7 +150,7 @@ bool block::operator!=(const block& other) const NOEXCEPT
//// const auto read_transactions = [witness](reader& source) NOEXCEPT
//// {
//// // Allocate arena ctxs shared_ptr and std_vector(captures arena).
//// auto ctxs = to_allocated<transaction_cptrs>(source.arena());
//// auto ctxs = to_allocated<transaction_cptrs>(source.get_arena());
////
//// BC_PUSH_WARNING(NO_UNGUARDED_POINTERS)
//// auto txs = to_non_const_raw_ptr(ctxs);
Expand All @@ -163,7 +163,7 @@ bool block::operator!=(const block& other) const NOEXCEPT
//// // Allocate each shared_ptr<tx> and move ptr to reservation.
//// // Each tx is constructed in place as allocated by/with its pointer.
//// for (size_t tx = 0; tx < capacity; ++tx)
//// txs->push_back(to_allocated<transaction>(source.arena(),
//// txs->push_back(to_allocated<transaction>(source.get_arena(),
//// source, witness));
////
//// return ctxs;
Expand All @@ -173,7 +173,7 @@ bool block::operator!=(const block& other) const NOEXCEPT
//// return
//// {
//// // Allocate header shared_ptr with header struct.
//// to_allocated<chain::header>(source.arena(), source),
//// to_allocated<chain::header>(source.get_arena(), source),
//// read_transactions(source),
//// source
//// };
Expand All @@ -183,15 +183,15 @@ bool block::operator!=(const block& other) const NOEXCEPT
BC_PUSH_WARNING(NO_UNGUARDED_POINTERS)
void block::assign_data(reader& source, bool witness) NOEXCEPT
{
auto& allocator = source.allocator();
auto& allocator = source.get_allocator();

////allocator.construct<chain::header::cptr>(&header_,
//// allocator.new_object<chain::header>(source),
//// allocator.deleter<chain::header>(source.arena()));
//// allocator.deleter<chain::header>(source.get_arena()));
////
////allocator.construct<transactions_cptr>(&txs_,
//// allocator.new_object<transaction_cptrs>(),
//// allocator.deleter<transaction_cptrs>(source.arena()));
//// allocator.deleter<transaction_cptrs>(source.get_arena()));

const auto count = source.read_size(max_block_size);
auto txs = to_non_const_raw_ptr(txs_);
Expand All @@ -200,7 +200,7 @@ void block::assign_data(reader& source, bool witness) NOEXCEPT
for (size_t tx = 0; tx < count; ++tx)
txs->emplace_back(
allocator.new_object<transaction>(source, witness),
allocator.deleter<transaction>(source.arena()));
allocator.deleter<transaction>(source.get_arena()));

size_ = serialized_size(*txs_);
valid_ = source;
Expand Down
24 changes: 12 additions & 12 deletions src/chain/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,14 @@ input::input(reader&& source) NOEXCEPT
input::input(reader& source) NOEXCEPT
////: input(from_data(source))
: point_(
source.allocator().new_object<chain::point>(source),
source.allocator().deleter<chain::point>(source.arena())),
source.get_allocator().new_object<chain::point>(source),
source.get_allocator().deleter<chain::point>(source.get_arena())),
script_(
source.allocator().new_object<chain::script>(source, true),
source.allocator().deleter<chain::script>(source.arena())),
source.get_allocator().new_object<chain::script>(source, true),
source.get_allocator().deleter<chain::script>(source.get_arena())),
witness_(
source.allocator().new_object<chain::witness>(/*empty*/),
source.allocator().deleter<chain::witness>(source.arena())),
source.get_allocator().new_object<chain::witness>(/*empty*/),
source.get_allocator().deleter<chain::witness>(source.get_arena())),
sequence_(source.read_4_bytes_little_endian()),
valid_(source),
size_(serialized_size(*script_, *witness_))
Expand Down Expand Up @@ -209,20 +209,20 @@ bool input::operator!=(const input& other) const NOEXCEPT
// private
void input::assign_data(reader&) NOEXCEPT
{
////auto& allocator = source.allocator();
////auto& allocator = source.get_allocator();
////
////allocator.construct<chain::point::cptr>(&point_,
//// allocator.new_object<chain::point>(source),
//// allocator.deleter<chain::point>(source.arena()));
//// allocator.deleter<chain::point>(source.get_arena()));
////
////allocator.construct<chain::script::cptr>(&script_,
//// allocator.new_object<chain::script>(source, true),
//// allocator.deleter<chain::script>(source.arena()));
//// allocator.deleter<chain::script>(source.get_arena()));
////
////// Witness is deserialized and assigned by transaction.
////allocator.construct<chain::witness::cptr>(&witness_,
//// allocator.new_object<chain::witness>(/*empty*/),
//// allocator.deleter<chain::witness>(source.arena()));
//// allocator.deleter<chain::witness>(source.get_arena()));
////
////sequence_ = source.read_4_bytes_little_endian();
////size_ = serialized_size(*script_, *witness_);
Expand Down Expand Up @@ -304,11 +304,11 @@ size_t input::witnessed_size() const NOEXCEPT

void input::set_witness(reader& source) NOEXCEPT
{
auto& allocator = source.allocator();
auto& allocator = source.get_allocator();

witness_.reset(
allocator.new_object<chain::witness>(source, true),
allocator.deleter<chain::witness>(source.arena()));
allocator.deleter<chain::witness>(source.get_arena()));

size_.witnessed = ceilinged_add(size_.nominal,
witness_->serialized_size(true));
Expand Down
4 changes: 2 additions & 2 deletions src/chain/operation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ bool operation::operator!=(const operation& other) const NOEXCEPT
// private
void operation::assign_data(reader& source) NOEXCEPT
{
auto& allocator = source.allocator();
auto& allocator = source.get_allocator();

// Guard against resetting a previously-invalid stream.
if (!source)
Expand Down Expand Up @@ -201,7 +201,7 @@ void operation::assign_data(reader& source) NOEXCEPT
// An invalid source.read_bytes_raw returns nullptr.
allocator.construct<chunk_cptr>(&data_,
source.read_bytes_raw(size),
allocator.deleter<data_chunk>(source.arena()));
allocator.deleter<data_chunk>(source.get_arena()));

underflow_ = !source;

Expand Down
8 changes: 4 additions & 4 deletions src/chain/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ output::output(reader& source) NOEXCEPT
////: output(from_data(source))
: value_(source.read_8_bytes_little_endian()),
script_(
source.allocator().new_object<chain::script>(source, true),
source.allocator().deleter<chain::script>(source.arena())),
source.get_allocator().new_object<chain::script>(source, true),
source.get_allocator().deleter<chain::script>(source.get_arena())),
valid_(source),
size_(serialized_size(*script_, value_))
{
Expand Down Expand Up @@ -143,13 +143,13 @@ bool output::operator!=(const output& other) const NOEXCEPT
// private
void output::assign_data(reader&) NOEXCEPT
{
////auto& allocator = source.allocator();
////auto& allocator = source.get_allocator();
////
////value_ = source.read_8_bytes_little_endian();
////
////allocator.construct<chain::script::cptr>(&script_,
//// allocator.new_object<chain::script>(source, true),
//// allocator.deleter<chain::script>(source.arena()));
//// allocator.deleter<chain::script>(source.get_arena()));
////
////size_ = serialized_size(*script_, value_);
////valid_ = source;
Expand Down
4 changes: 2 additions & 2 deletions src/chain/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ script::script(reader&& source, bool prefix) NOEXCEPT

script::script(reader& source, bool prefix) NOEXCEPT
////: script(from_data(source, prefix))
: ops_(source.arena())
: ops_(source.get_arena())
{
assign_data(source, prefix);
}
Expand Down Expand Up @@ -252,7 +252,7 @@ void script::assign_data(reader& source, bool prefix) NOEXCEPT
source.set_limit(expected);
}

////auto& allocator = source.allocator();
////auto& allocator = source.get_allocator();
////allocator.destroy<operations>(&ops_);
////allocator.construct<operations>(&ops_);
ops_.reserve(op_count(source));
Expand Down
26 changes: 13 additions & 13 deletions src/chain/transaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ transaction::transaction(reader& source, bool witness) NOEXCEPT
////: transaction(from_data(source, witness))
: version_(source.read_4_bytes_little_endian()),
inputs_(
source.allocator().new_object<input_cptrs>(),
source.allocator().deleter<input_cptrs>(source.arena())),
source.get_allocator().new_object<input_cptrs>(),
source.get_allocator().deleter<input_cptrs>(source.get_arena())),
outputs_(
source.allocator().new_object<output_cptrs>(),
source.allocator().deleter<output_cptrs>(source.arena()))
source.get_allocator().new_object<output_cptrs>(),
source.get_allocator().deleter<output_cptrs>(source.get_arena()))
{
assign_data(source, witness);
}
Expand Down Expand Up @@ -256,7 +256,7 @@ bool transaction::operator!=(const transaction& other) const NOEXCEPT
////{
//// // Allocate arena cputs shared_ptr and std_vector(captures arena).
//// using puts_type = std_vector<std::shared_ptr<const Put>>;
//// auto cputs = to_allocated<puts_type>(source.arena());
//// auto cputs = to_allocated<puts_type>(source.get_arena());
////
//// BC_PUSH_WARNING(NO_UNGUARDED_POINTERS)
//// auto puts = to_non_const_raw_ptr(cputs);
Expand All @@ -269,7 +269,7 @@ bool transaction::operator!=(const transaction& other) const NOEXCEPT
//// // Allocate each shared_ptr<put> and move ptr to reservation.
//// // Each put is constructed in place as allocated by/with its pointer.
//// for (size_t put = 0; put < capacity; ++put)
//// puts->push_back(to_allocated<Put>(source.arena(), source));
//// puts->push_back(to_allocated<Put>(source.get_arena(), source));
////
//// return cputs;
////}
Expand Down Expand Up @@ -325,15 +325,15 @@ bool transaction::operator!=(const transaction& other) const NOEXCEPT
BC_PUSH_WARNING(NO_UNGUARDED_POINTERS)
void transaction::assign_data(reader& source, bool witness) NOEXCEPT
{
auto& allocator = source.allocator();
auto& allocator = source.get_allocator();

////allocator.construct<inputs_cptr>(&inputs_,
//// allocator.new_object<input_cptrs>(),
//// allocator.deleter<input_cptrs>(source.arena()));
//// allocator.deleter<input_cptrs>(source.get_arena()));
////
////allocator.construct<outputs_cptr>(&outputs_,
//// allocator.new_object<output_cptrs>(),
//// allocator.deleter<output_cptrs>(source.arena()));
//// allocator.deleter<output_cptrs>(source.get_arena()));
////
////version_ = source.read_4_bytes_little_endian();

Expand All @@ -343,7 +343,7 @@ void transaction::assign_data(reader& source, bool witness) NOEXCEPT
for (size_t in = 0; in < count; ++in)
ins->emplace_back(
allocator.new_object<input>(source),
allocator.deleter<input>(source.arena()));
allocator.deleter<input>(source.get_arena()));

// Expensive repeated recomputation, so cache segregated state.
// Detect witness as no inputs (marker) and expected flag (bip144).
Expand All @@ -361,15 +361,15 @@ void transaction::assign_data(reader& source, bool witness) NOEXCEPT
for (size_t in = 0; in < count; ++in)
ins->emplace_back(
allocator.new_object<input>(source),
allocator.deleter<input>(source.arena()));
allocator.deleter<input>(source.get_arena()));

auto outs = to_non_const_raw_ptr(outputs_);
count = source.read_size(max_block_size);
outs->reserve(count);
for (size_t out = 0; out < count; ++out)
outs->emplace_back(
allocator.new_object<output>(source),
allocator.deleter<output>(source.arena()));
allocator.deleter<output>(source.get_arena()));

// Read or skip witnesses as specified.
if (witness)
Expand All @@ -392,7 +392,7 @@ void transaction::assign_data(reader& source, bool witness) NOEXCEPT
for (size_t out = 0; out < count; ++out)
outs->emplace_back(
allocator.new_object<output>(source),
allocator.deleter<output>(source.arena()));
allocator.deleter<output>(source.get_arena()));
}

locktime_ = source.read_4_bytes_little_endian();
Expand Down
8 changes: 4 additions & 4 deletions src/chain/witness.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ witness::witness(reader&& source, bool prefix) NOEXCEPT

witness::witness(reader& source, bool prefix) NOEXCEPT
////: witness(from_data(source, prefix))
: stack_(source.arena())
: stack_(source.get_arena())
{
assign_data(source, prefix);
}
Expand Down Expand Up @@ -168,7 +168,7 @@ void witness::skip(reader& source, bool prefix) NOEXCEPT
void witness::assign_data(reader& source, bool prefix) NOEXCEPT
{
size_ = zero;
const auto& allocator = source.allocator();
const auto& allocator = source.get_allocator();
////allocator.destroy<chunk_cptrs>(&stack_);
////allocator.construct<chunk_cptrs>(&stack_);

Expand All @@ -182,7 +182,7 @@ void witness::assign_data(reader& source, bool prefix) NOEXCEPT
const auto size = source.read_size(max_block_weight);
stack_.emplace_back(
source.read_bytes_raw(size),
allocator.deleter<data_chunk>(source.arena()));
allocator.deleter<data_chunk>(source.get_arena()));
size_ = element_size(size_, stack_.back());
}
}
Expand All @@ -193,7 +193,7 @@ void witness::assign_data(reader& source, bool prefix) NOEXCEPT
const auto size = source.read_size(max_block_weight);
stack_.emplace_back(
source.read_bytes_raw(size),
allocator.deleter<data_chunk>(source.arena()));
allocator.deleter<data_chunk>(source.get_arena()));
size_ = element_size(size_, stack_.back());
}
}
Expand Down

0 comments on commit 0592b10

Please sign in to comment.