BitSetIterator_unittest: fix an unreachable code warning
Because gtest's FAIL macro does a return, MSVC complained that the
update part of a range-based for loop was unreachable. Fixed this by
having a boolean value set to true if we execute the loop body.
BUG=angleproject:929
Change-Id: I6c1fec7ed6cf1a3aba6f02b68c1015bee2feebfd
Reviewed-on: https://chromium-review.googlesource.com/296730
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/common/BitSetIterator_unittest.cpp b/src/common/BitSetIterator_unittest.cpp
index da913e1..10fd3be 100644
--- a/src/common/BitSetIterator_unittest.cpp
+++ b/src/common/BitSetIterator_unittest.cpp
@@ -49,11 +49,15 @@
// Test an empty iterator.
TEST_F(BitSetIteratorTest, EmptySet)
{
+ // We don't use the FAIL gtest macro here since it returns immediately,
+ // causing an unreachable code warning in MSVS
+ bool sawBit = false;
for (unsigned long bit : IterateBitSet(mStateBits))
{
+ sawBit = true;
UNUSED_TRACE_VARIABLE(bit);
- FAIL() << "Should not be reached";
}
+ EXPECT_FALSE(sawBit);
}
// Test iterating a result of combining two bitsets.