Merge #16161: util: Fix compilation errors in support/lockedpool.cpp

30fb598737f6efb7802d707a1fa989872e7f8b7b Fix segfault in allocator_tests/arena_tests (Jeffrey Czyz)
15c84f53f47bf6e6a9c4c9dfe50c78d98f7ec07f Define ARENA_DEBUG in Travis test runs (Jeffrey Czyz)
ad715488222f2f2ce2e2cff632eae94fd49ea9c5 Fix compilation errors in support/lockedpool.cpp (Jeffrey Czyz)

Pull request description:

  Changes in #12048 cause a compilation error in Arena::walk() when
  ARENA_DEBUG is defined. Specifically, Arena's chunks_free map was
  changed to have a different value type.

  Additionally, missing includes cause other compilation errors when
  ARENA_DEBUG is defined.

  Reproduced with:

  make CPPFLAGS=-DARENA_DEBUG

ACKs for top commit:
  laanwj:
    ACK 30fb598737f6efb7802d707a1fa989872e7f8b7b
  fanquake:
    ACK 30fb598737f6efb7802d707a1fa989872e7f8b7b - thanks for following up jkczyz.

Tree-SHA512: 4eec368a4e9c67e4e2a27bc05608a807c2892d50c60d06ed21490cd274c0369f9671bc05b3006acc2a193316caf4896454c9c299603bfed29bd488f1987ec446
This commit is contained in:
fanquake 2019-11-20 09:36:43 -05:00 committed by pasta
parent 641a666ef1
commit bedce7256a
No known key found for this signature in database
GPG Key ID: 52527BEDABE87984

View File

@ -27,6 +27,10 @@
#endif
#include <algorithm>
#ifdef ARENA_DEBUG
#include <iomanip>
#include <iostream>
#endif
LockedPoolManager* LockedPoolManager::_instance = nullptr;
std::once_flag LockedPoolManager::init_flag;
@ -141,7 +145,7 @@ Arena::Stats Arena::stats() const
}
#ifdef ARENA_DEBUG
void printchunk(char* base, size_t sz, bool used) {
void printchunk(void* base, size_t sz, bool used) {
std::cout <<
"0x" << std::hex << std::setw(16) << std::setfill('0') << base <<
" 0x" << std::hex << std::setw(16) << std::setfill('0') << sz <<
@ -153,7 +157,7 @@ void Arena::walk() const
printchunk(chunk.first, chunk.second, true);
std::cout << std::endl;
for (const auto& chunk: chunks_free)
printchunk(chunk.first, chunk.second, false);
printchunk(chunk.first, chunk.second->first, false);
std::cout << std::endl;
}
#endif