Skip to content

Commit

Permalink
Fix build errors on gcc-8.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cf committed May 29, 2018
1 parent d0416a3 commit 5f38b62
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion container/bloom_filter_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ TEST(BloomFilter, FalsePositiveRate)
}
}
std::cout << "total_conflicts: " << total_conflicts << "\n";
if (total_conflicts > 0)
if (total_conflicts > 0) {
EXPECT_GT(capacity/total_conflicts, 1000) << total_conflicts;
}
}

TEST(BloomFilter, Bitmap)
Expand Down
3 changes: 2 additions & 1 deletion container/lru_cache_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,9 @@ static void ReadThread(LruCache<int, int> *cache) {
while (RealtimeClock.MicroSeconds() - now < 500) {
for (int i = 2; i < 1000; ++i) {
bool r = cache->Get(i, &value);
if (r)
if (r) {
ASSERT_EQ(0, value % i);
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion hash/hash_benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static void MurmurHash64B(int n) {

static void CRC32(int n) {
for (int i = 0; i < n; i++) {
toft::CRC32(test_str);
toft::CRC32::Digest(test_str);
}
}

Expand Down
2 changes: 1 addition & 1 deletion net/uri/uri.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,7 @@ bool URI::WriteToBuffer(char* buffer, size_t buffer_size, size_t* result_size) c
*result_size = static_cast<size_t>(oss.tellp());
buffer[*result_size] = '\0';

return oss;
return oss.good();
}

void URI::Swap(URI* other)
Expand Down
3 changes: 2 additions & 1 deletion net/uri/uri_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,9 @@ TEST_F(BatchTest, Test)
{
bool parse_result = uri.Parse(urls[j]);
EXPECT_TRUE(parse_result) << urls[j];
if (parse_result)
if (parse_result) {
EXPECT_EQ(urls[j], uri.ToString());
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion system/atomic/functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ void EnsureLinkedWithAtomicLibrary();
template <typename T>
T AtomicGet(const T* ptr)
{
return __sync_fetch_and_add(const_cast<volatile T*>(ptr), 0);
__sync_synchronize();
return *ptr;
}

template <typename T>
Expand Down

0 comments on commit 5f38b62

Please sign in to comment.