Bug 1159131 - Work around false positive -Wuninitialized gcc warnings in DEBUG PGO builds of WebGLElementArrayCache.cpp. r=jgilbert

This commit is contained in:
Chris Peterson 2015-04-25 20:24:03 -07:00
parent b10aee369c
commit 91731c29d6
2 changed files with 7 additions and 4 deletions

View File

@ -19,7 +19,10 @@ static void
UpdateUpperBound(uint32_t* const out_upperBound, uint32_t newBound)
{
MOZ_ASSERT(out_upperBound);
*out_upperBound = std::max(*out_upperBound, newBound);
// Move *out_upperBound to a local variable to work around a false positive
// -Wuninitialized gcc warning about std::max() in PGO builds.
uint32_t upperBound = *out_upperBound;
*out_upperBound = std::max(upperBound, newBound);
}
/* WebGLElementArrayCacheTree contains most of the implementation of

View File

@ -115,7 +115,7 @@ CheckSanity()
// ensure we exercise some nontrivial tree-walking
T data[numElems] = {1,0,3,1,2,6,5,4}; // intentionally specify only 8 elements for now
size_t numBytes = numElems * sizeof(T);
MOZ_ASSERT(numBytes == sizeof(data));
MOZ_RELEASE_ASSERT(numBytes == sizeof(data));
GLenum type = GLType<T>();
@ -139,7 +139,7 @@ CheckSanity()
CheckValidate(true, c, type, numElems, 0, numElems);
CheckValidate(false, c, type, numElems - 1, 0, numElems);
MOZ_ASSERT(numElems > 10);
MOZ_RELEASE_ASSERT(numElems > 10);
CheckValidate(true, c, type, numElems - 10, 10, numElems - 10);
CheckValidate(false, c, type, numElems - 11, 10, numElems - 10);
}
@ -156,7 +156,7 @@ CheckUintOverflow()
// ensure we exercise some nontrivial tree-walking
T data[numElems];
size_t numBytes = numElems * sizeof(T);
MOZ_ASSERT(numBytes == sizeof(data));
MOZ_RELEASE_ASSERT(numBytes == sizeof(data));
GLenum type = GLType<T>();