kudu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [kudu] 03/07: [util] fix compilation warnings in RELEASE mode
Date Sun, 29 Dec 2019 18:58:44 GMT
This is an automated email from the ASF dual-hosted git repository.

adar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kudu.git

commit cfe9a3f6a0f8aa4148a23fddcc74b849c7bf20a6
Author: Alexey Serbin <alexey@apache.org>
AuthorDate: Fri Dec 27 22:57:35 2019 -0800

    [util] fix compilation warnings in RELEASE mode
    
    Prior to this fix, compiling in RELEASE mode with 3rd-party clang would
    output warning messages like below:
    
      src/kudu/util/block_bloom_filter.cc:171:18: \
          warning: expression result unused [-Wunused-value]
          DCHECK_NOTNULL(directory_);
    
    This patch addresses that, placing the DCHECK_NOTNULL() macro
    into expressions which use directory_ member field.
    
    Change-Id: Ia059413ad2962a22a32ab92773a2d6871809830a
    Reviewed-on: http://gerrit.cloudera.org:8080/14956
    Tested-by: Kudu Jenkins
    Reviewed-by: Bankim Bhavsar <bankim@cloudera.com>
    Reviewed-by: Adar Dembo <adar@cloudera.com>
---
 src/kudu/util/block_bloom_filter.cc | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/src/kudu/util/block_bloom_filter.cc b/src/kudu/util/block_bloom_filter.cc
index a175abc..4112f8f 100644
--- a/src/kudu/util/block_bloom_filter.cc
+++ b/src/kudu/util/block_bloom_filter.cc
@@ -110,7 +110,8 @@ void BlockBloomFilter::BucketInsert(const uint32_t bucket_idx, const uint32_t
ha
   }
   for (int i = 0; i < 2; ++i) {
     __m128i new_bucket_sse = _mm_load_si128(reinterpret_cast<__m128i*>(new_bucket +
4 * i));
-    __m128i* existing_bucket = reinterpret_cast<__m128i*>(&directory_[bucket_idx][4
* i]);
+    __m128i* existing_bucket = reinterpret_cast<__m128i*>(
+        &DCHECK_NOTNULL(directory_)[bucket_idx][4 * i]);
     *existing_bucket = _mm_or_si128(*existing_bucket, new_bucket_sse);
   }
 }
@@ -121,7 +122,7 @@ bool BlockBloomFilter::BucketFind(
   for (int i = 0; i < kBucketWords; ++i) {
     BucketWord hval = (kRehash[i] * hash) >> ((1 << kLogBucketWordBits) - kLogBucketWordBits);
     hval = 1U << hval;
-    if (!(directory_[bucket_idx][i] & hval)) {
+    if (!(DCHECK_NOTNULL(directory_)[bucket_idx][i] & hval)) {
       return false;
     }
   }
@@ -168,7 +169,6 @@ void BlockBloomFilter::InsertNoAvx2(const uint32_t hash) noexcept {
 // the advantage of requiring fewer random bits: log2(32) * 8 = 5 * 8 = 40 random bits for
 // a split Bloom filter, but log2(256) * 8 = 64 random bits for a standard Bloom filter.
 void BlockBloomFilter::Insert(const uint32_t hash) noexcept {
-  DCHECK_NOTNULL(directory_);
   always_false_ = false;
   const uint32_t bucket_idx = Rehash32to32(hash) & directory_mask_;
   (this->*bucket_insert_func_ptr_)(bucket_idx, hash);
@@ -178,7 +178,6 @@ bool BlockBloomFilter::Find(const uint32_t hash) const noexcept {
   if (always_false_) {
     return false;
   }
-  DCHECK_NOTNULL(directory_);
   const uint32_t bucket_idx = Rehash32to32(hash) & directory_mask_;
   return (this->*bucket_find_func_ptr_)(bucket_idx, hash);
 }
@@ -190,8 +189,7 @@ Status DefaultBlockBloomFilterBufferAllocator::AllocateBuffer(size_t bytes,
void
 }
 
 void DefaultBlockBloomFilterBufferAllocator::FreeBuffer(void* ptr) {
-  DCHECK_NOTNULL(ptr);
-  free(ptr);
+  free(DCHECK_NOTNULL(ptr));
 }
 
 DefaultBlockBloomFilterBufferAllocator* DefaultBlockBloomFilterBufferAllocator::GetSingleton()
{


Mime
View raw message