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>
This commit is contained in:
Corentin Wallez 2015-09-01 13:56:56 -04:00
Родитель c437046ffc
Коммит 94d099d0fe
1 изменённых файлов: 5 добавлений и 1 удалений

Просмотреть файл

@ -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.