Commit 29eecd37 authored by Adam Simpkins's avatar Adam Simpkins Committed by Jordan DeLong

fix issues when compiling with clang

Summary:
My previous change to re-implement IOBuf's internal storage mechanism
introduced a build failure when compiling with clang.

This fixes the new compilation error in IOBuf.cpp, as well as two
existing build failures in some of the unit tests.

Test Plan: Built the folly/io code with clang.

Reviewed By: andrewjcg@fb.com

FB internal diff: D1082086
parent cb527272
...@@ -123,7 +123,7 @@ void IOBuf::operator delete(void* ptr) { ...@@ -123,7 +123,7 @@ void IOBuf::operator delete(void* ptr) {
} }
void IOBuf::releaseStorage(HeapStorage* storage, uint16_t freeFlags) { void IOBuf::releaseStorage(HeapStorage* storage, uint16_t freeFlags) {
CHECK_EQ(storage->prefix.magic, kHeapMagic); CHECK_EQ(storage->prefix.magic, static_cast<uint16_t>(kHeapMagic));
// Use relaxed memory order here. If we are unlucky and happen to get // Use relaxed memory order here. If we are unlucky and happen to get
// out-of-date data the compare_exchange_weak() call below will catch // out-of-date data the compare_exchange_weak() call below will catch
......
...@@ -749,7 +749,7 @@ TEST(IOBuf, takeOwnershipUniquePtr) { ...@@ -749,7 +749,7 @@ TEST(IOBuf, takeOwnershipUniquePtr) {
destructorCount = 0; destructorCount = 0;
{ {
std::unique_ptr<OwnershipTestClass[], CustomDeleter> std::unique_ptr<OwnershipTestClass[], CustomDeleter>
p(new OwnershipTestClass[2], customDeleteArray); p(new OwnershipTestClass[2], CustomDeleter(customDeleteArray));
std::unique_ptr<IOBuf> buf(IOBuf::takeOwnership(std::move(p), 2)); std::unique_ptr<IOBuf> buf(IOBuf::takeOwnership(std::move(p), 2));
EXPECT_EQ(2 * sizeof(OwnershipTestClass), buf->length()); EXPECT_EQ(2 * sizeof(OwnershipTestClass), buf->length());
EXPECT_EQ(0, destructorCount); EXPECT_EQ(0, destructorCount);
......
...@@ -37,7 +37,6 @@ namespace folly { namespace test { ...@@ -37,7 +37,6 @@ namespace folly { namespace test {
namespace { namespace {
// shortcut // shortcut
ByteRange br(StringPiece sp) { return ByteRange(sp); }
StringPiece sp(ByteRange br) { return StringPiece(br); } StringPiece sp(ByteRange br) { return StringPiece(br); }
template <class T> template <class T>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment