From 29eecd37d773918cc0081938da7562852151c69f Mon Sep 17 00:00:00 2001 From: Adam Simpkins Date: Tue, 3 Dec 2013 19:33:47 -0800 Subject: [PATCH] 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 --- folly/io/IOBuf.cpp | 2 +- folly/io/test/IOBufTest.cpp | 2 +- folly/io/test/RecordIOTest.cpp | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/folly/io/IOBuf.cpp b/folly/io/IOBuf.cpp index cf961e73..65f7624d 100644 --- a/folly/io/IOBuf.cpp +++ b/folly/io/IOBuf.cpp @@ -123,7 +123,7 @@ void IOBuf::operator delete(void* ptr) { } void IOBuf::releaseStorage(HeapStorage* storage, uint16_t freeFlags) { - CHECK_EQ(storage->prefix.magic, kHeapMagic); + CHECK_EQ(storage->prefix.magic, static_cast(kHeapMagic)); // 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 diff --git a/folly/io/test/IOBufTest.cpp b/folly/io/test/IOBufTest.cpp index a9e2ace3..5fc86644 100644 --- a/folly/io/test/IOBufTest.cpp +++ b/folly/io/test/IOBufTest.cpp @@ -749,7 +749,7 @@ TEST(IOBuf, takeOwnershipUniquePtr) { destructorCount = 0; { std::unique_ptr - p(new OwnershipTestClass[2], customDeleteArray); + p(new OwnershipTestClass[2], CustomDeleter(customDeleteArray)); std::unique_ptr buf(IOBuf::takeOwnership(std::move(p), 2)); EXPECT_EQ(2 * sizeof(OwnershipTestClass), buf->length()); EXPECT_EQ(0, destructorCount); diff --git a/folly/io/test/RecordIOTest.cpp b/folly/io/test/RecordIOTest.cpp index 9f4d2699..4c12f817 100644 --- a/folly/io/test/RecordIOTest.cpp +++ b/folly/io/test/RecordIOTest.cpp @@ -37,7 +37,6 @@ namespace folly { namespace test { namespace { // shortcut -ByteRange br(StringPiece sp) { return ByteRange(sp); } StringPiece sp(ByteRange br) { return StringPiece(br); } template -- 2.34.1