Commit 94d099d0 by Corentin Wallez

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/296730Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent c437046f
......@@ -49,11 +49,15 @@ TEST_F(BitSetIteratorTest, Iterator)
// 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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment