You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kudu.apache.org by to...@apache.org on 2018/05/04 15:16:21 UTC

[3/3] kudu git commit: bitmap-test: fix dangling-else warnings

bitmap-test: fix dangling-else warnings

This squelches the following two warnings:

  [396/750] Building CXX object src/kudu/util/CMakeFiles/bitmap-test.dir/bitmap-test.cc.o
  ../../src/kudu/util/bitmap-test.cc: In member function ‘virtual void kudu::TestBitMap_TestFindBit_Test::TestBody()’:
  ../../src/kudu/util/bitmap-test.cc:187:10: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
         if (expect_set_found) ASSERT_EQ(expected_set_idx, idx);
            ^
  ../../src/kudu/util/bitmap-test.cc:194:10: warning: suggest explicit braces to avoid ambiguous ‘else’ [-Wdangling-else]
         if (expect_zero_found) ASSERT_EQ(expected_zero_idx, idx);
            ^

Change-Id: I0cf567b69c39958acb0c6fc7aa110d38f7b718ef
Reviewed-on: http://gerrit.cloudera.org:8080/10305
Reviewed-by: Alexey Serbin <as...@cloudera.com>
Tested-by: Kudu Jenkins
Reviewed-by: Todd Lipcon <to...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/kudu/repo
Commit: http://git-wip-us.apache.org/repos/asf/kudu/commit/0061f32d
Tree: http://git-wip-us.apache.org/repos/asf/kudu/tree/0061f32d
Diff: http://git-wip-us.apache.org/repos/asf/kudu/diff/0061f32d

Branch: refs/heads/master
Commit: 0061f32d157dacd0cc1e6af341d6d5bf1e82378c
Parents: ea28641
Author: Adar Dembo <ad...@cloudera.com>
Authored: Thu May 3 15:40:38 2018 -0700
Committer: Todd Lipcon <to...@apache.org>
Committed: Fri May 4 15:16:03 2018 +0000

----------------------------------------------------------------------
 src/kudu/util/bitmap-test.cc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kudu/blob/0061f32d/src/kudu/util/bitmap-test.cc
----------------------------------------------------------------------
diff --git a/src/kudu/util/bitmap-test.cc b/src/kudu/util/bitmap-test.cc
index ab79124..089ed3b 100644
--- a/src/kudu/util/bitmap-test.cc
+++ b/src/kudu/util/bitmap-test.cc
@@ -184,14 +184,18 @@ TEST(TestBitMap, TestFindBit) {
       size_t expected_set_idx = (offset + !(offset & 3));
       bool expect_set_found = (expected_set_idx < num_bits);
       ASSERT_EQ(expect_set_found, res);
-      if (expect_set_found) ASSERT_EQ(expected_set_idx, idx);
+      if (expect_set_found) {
+        ASSERT_EQ(expected_set_idx, idx);
+      }
 
       // Find a zero bit
       res = BitmapFindFirstZero(bm, offset, num_bits, &idx);
       size_t expected_zero_idx = offset + ((offset & 3) ? (4 - (offset & 3)) : 0);
       bool expect_zero_found = (expected_zero_idx < num_bits);
       ASSERT_EQ(expect_zero_found, res);
-      if (expect_zero_found) ASSERT_EQ(expected_zero_idx, idx);
+      if (expect_zero_found) {
+        ASSERT_EQ(expected_zero_idx, idx);
+      }
     }
   }
 }