Skip to content
This repository has been archived by the owner on Dec 26, 2023. It is now read-only.

Commit

Permalink
No ; to prevent -Wextra-semi-stmt
Browse files Browse the repository at this point in the history
  • Loading branch information
martinus committed Nov 13, 2020
1 parent 628cfdd commit 7121a27
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/include/robin_hood.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
#ifdef ROBIN_HOOD_LOG_ENABLED
# include <iostream>
# define ROBIN_HOOD_LOG(...) \
std::cout << __FUNCTION__ << "@" << __LINE__ << ": " << __VA_ARGS__ << std::endl
std::cout << __FUNCTION__ << "@" << __LINE__ << ": " << __VA_ARGS__ << std::endl;
#else
# define ROBIN_HOOD_LOG(x)
#endif
Expand All @@ -64,7 +64,7 @@
#ifdef ROBIN_HOOD_TRACE_ENABLED
# include <iostream>
# define ROBIN_HOOD_TRACE(...) \
std::cout << __FUNCTION__ << "@" << __LINE__ << ": " << __VA_ARGS__ << std::endl
std::cout << __FUNCTION__ << "@" << __LINE__ << ": " << __VA_ARGS__ << std::endl;
#else
# define ROBIN_HOOD_TRACE(x)
#endif
Expand Down Expand Up @@ -392,7 +392,7 @@ class BulkPoolAllocator {
void reset() noexcept {
while (mListForFree) {
T* tmp = *mListForFree;
ROBIN_HOOD_LOG("std::free");
ROBIN_HOOD_LOG("std::free")
std::free(mListForFree);
mListForFree = reinterpret_cast_no_cast_align_warning<T**>(tmp);
}
Expand Down Expand Up @@ -428,10 +428,10 @@ class BulkPoolAllocator {
// calculate number of available elements in ptr
if (numBytes < ALIGNMENT + ALIGNED_SIZE) {
// not enough data for at least one element. Free and return.
ROBIN_HOOD_LOG("std::free");
ROBIN_HOOD_LOG("std::free")
std::free(ptr);
} else {
ROBIN_HOOD_LOG("add to buffer");
ROBIN_HOOD_LOG("add to buffer")
add(ptr, numBytes);
}
}
Expand Down Expand Up @@ -497,7 +497,7 @@ class BulkPoolAllocator {
// alloc new memory: [prev |T, T, ... T]
size_t const bytes = ALIGNMENT + ALIGNED_SIZE * numElementsToAlloc;
ROBIN_HOOD_LOG("std::malloc " << bytes << " = " << ALIGNMENT << " + " << ALIGNED_SIZE
<< " * " << numElementsToAlloc);
<< " * " << numElementsToAlloc)
add(assertNotNull<std::bad_alloc>(std::malloc(bytes)), bytes);
return mHead;
}
Expand Down Expand Up @@ -534,7 +534,7 @@ struct NodeAllocator<T, MinSize, MaxSize, true> {

// we are not using the data, so just free it.
void addOrFree(void* ptr, size_t ROBIN_HOOD_UNUSED(numBytes) /*unused*/) noexcept {
ROBIN_HOOD_LOG("std::free");
ROBIN_HOOD_LOG("std::free")
std::free(ptr);
}
};
Expand Down Expand Up @@ -1580,7 +1580,7 @@ class Table
auto const numBytesTotal = calcNumBytesTotal(numElementsWithBuffer);

ROBIN_HOOD_LOG("std::malloc " << numBytesTotal << " = calcNumBytesTotal("
<< numElementsWithBuffer << ")");
<< numElementsWithBuffer << ")")
mKeyVals = static_cast<Node*>(
detail::assertNotNull<std::bad_alloc>(std::malloc(numBytesTotal)));
// no need for calloc because clonData does memcpy
Expand Down Expand Up @@ -1630,14 +1630,14 @@ class Table
// no luck: we don't have the same array size allocated, so we need to realloc.
if (0 != mMask) {
// only deallocate if we actually have data!
ROBIN_HOOD_LOG("std::free");
ROBIN_HOOD_LOG("std::free")
std::free(mKeyVals);
}

auto const numElementsWithBuffer = calcNumElementsWithBuffer(o.mMask + 1);
auto const numBytesTotal = calcNumBytesTotal(numElementsWithBuffer);
ROBIN_HOOD_LOG("std::malloc " << numBytesTotal << " = calcNumBytesTotal("
<< numElementsWithBuffer << ")");
<< numElementsWithBuffer << ")")
mKeyVals = static_cast<Node*>(
detail::assertNotNull<std::bad_alloc>(std::malloc(numBytesTotal)));

Expand Down Expand Up @@ -2091,7 +2091,7 @@ class Table
throwOverflowError();
}

ROBIN_HOOD_LOG("newSize > mMask + 1: " << newSize << " > " << mMask << " + 1");
ROBIN_HOOD_LOG("newSize > mMask + 1: " << newSize << " > " << mMask << " + 1")

// only actually do anything when the new size is bigger than the old one. This prevents to
// continuously allocate for each reserve() call.
Expand Down Expand Up @@ -2172,7 +2172,7 @@ class Table
// calloc also zeroes everything
auto const numBytesTotal = calcNumBytesTotal(numElementsWithBuffer);
ROBIN_HOOD_LOG("std::calloc " << numBytesTotal << " = calcNumBytesTotal("
<< numElementsWithBuffer << ")");
<< numElementsWithBuffer << ")")
mKeyVals = reinterpret_cast<Node*>(
detail::assertNotNull<std::bad_alloc>(std::calloc(1, numBytesTotal)));
mInfo = reinterpret_cast<uint8_t*>(mKeyVals + numElementsWithBuffer);
Expand Down Expand Up @@ -2298,7 +2298,7 @@ class Table
bool try_increase_info() {
ROBIN_HOOD_LOG("mInfoInc=" << mInfoInc << ", numElements=" << mNumElements
<< ", maxNumElementsAllowed="
<< calcMaxNumElementsAllowed(mMask + 1));
<< calcMaxNumElementsAllowed(mMask + 1))
if (mInfoInc <= 2) {
// need to be > 2 so that shift works (otherwise undefined behavior!)
return false;
Expand Down Expand Up @@ -2338,7 +2338,7 @@ class Table
ROBIN_HOOD_LOG("mNumElements=" << mNumElements << ", maxNumElementsAllowed="
<< maxNumElementsAllowed << ", load="
<< (static_cast<double>(mNumElements) * 100.0 /
(static_cast<double>(mMask) + 1)));
(static_cast<double>(mMask) + 1)))
// it seems we have a really bad hash function! don't try to resize again
if (mNumElements * 2 < calcMaxNumElementsAllowed(mMask + 1)) {
throwOverflowError();
Expand All @@ -2361,7 +2361,7 @@ class Table
// reports a compile error: attempt to free a non-heap object 'fm'
// [-Werror=free-nonheap-object]
if (mKeyVals != reinterpret_cast_no_cast_align_warning<Node*>(&mMask)) {
ROBIN_HOOD_LOG("std::free");
ROBIN_HOOD_LOG("std::free")
std::free(mKeyVals);
}
}
Expand Down

0 comments on commit 7121a27

Please sign in to comment.