Revert "Fix and enable warning C4244 (Conversion from 'type1' to 'type2', possible loss of data)"
Causing a build failure on Mac/Clang:
./Tokenizer.cpp:551:7: error: extra tokens at end of #else directive [-Werror,-Wextra-tokens]
#else if defined(_MSC_VER)
http://build.chromium.org/p/chromium.gpu.fyi/builders/GPU%20Mac%20Builder/builds/29136
This reverts commit 3b26e231d99154814eb428f75a67bbe7a21adadc.
Change-Id: I2d11ddcc18130d908fd2ec3d6f5ab890cfccd5e7
Reviewed-on: https://chromium-review.googlesource.com/264983
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Tested-by: Jamie Madill <jmadill@chromium.org>
diff --git a/src/tests/deqp.gypi b/src/tests/deqp.gypi
index fdfefd1..c70833c 100644
--- a/src/tests/deqp.gypi
+++ b/src/tests/deqp.gypi
@@ -604,7 +604,6 @@
'AdditionalOptions':
[
'/wd4131', # old-style declarator
- '/wd4244', # Conversion from 'type1' to 'type2', possible loss of data
'/wd4324', # structure was padded
'/wd4701', # potentially uninit used
'/wd4996', # deprecated
@@ -663,7 +662,6 @@
'/wd4028', # parameter differs from decl
'/wd4101', # unreferenced local
'/wd4189', # unreferenced but initted
- '/wd4244', # Conversion from 'type1' to 'type2', possible loss of data
],
},
},
diff --git a/src/tests/end2end_tests/BlendMinMaxTest.cpp b/src/tests/end2end_tests/BlendMinMaxTest.cpp
index 56a0877..8c02c5b 100644
--- a/src/tests/end2end_tests/BlendMinMaxTest.cpp
+++ b/src/tests/end2end_tests/BlendMinMaxTest.cpp
@@ -28,7 +28,7 @@
static GLubyte getExpected(bool blendMin, float curColor, GLubyte prevColor)
{
- GLubyte curAsUbyte = static_cast<GLubyte>((curColor * std::numeric_limits<GLubyte>::max()) + 0.5f);
+ GLubyte curAsUbyte = (curColor * std::numeric_limits<GLubyte>::max()) + 0.5f;
return blendMin ? std::min<GLubyte>(curAsUbyte, prevColor) : std::max<GLubyte>(curAsUbyte, prevColor);
}
diff --git a/src/tests/end2end_tests/BufferDataTest.cpp b/src/tests/end2end_tests/BufferDataTest.cpp
index 5dcf29f..7f47935 100644
--- a/src/tests/end2end_tests/BufferDataTest.cpp
+++ b/src/tests/end2end_tests/BufferDataTest.cpp
@@ -362,7 +362,7 @@
uint8_t srcBytes[numBytes];
for (size_t i = 0; i < numBytes; ++i)
{
- srcBytes[i] = static_cast<uint8_t>(i);
+ srcBytes[i] = i;
}
void *dest = glMapBufferRange(GL_ARRAY_BUFFER, 0, numBytes, GL_MAP_WRITE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT);
diff --git a/src/tests/end2end_tests/IndexedPointsTest.cpp b/src/tests/end2end_tests/IndexedPointsTest.cpp
index 026db32..043ba28 100644
--- a/src/tests/end2end_tests/IndexedPointsTest.cpp
+++ b/src/tests/end2end_tests/IndexedPointsTest.cpp
@@ -103,8 +103,8 @@
for (size_t i = 0; i < mPointCount; i++)
{
- GLuint x = static_cast<GLuint>(viewportSize[0] + (getIndexPositionX(i) * 0.5f + 0.5f) * (viewportSize[2] - viewportSize[0]));
- GLuint y = static_cast<GLuint>(viewportSize[1] + (getIndexPositionY(i) * 0.5f + 0.5f) * (viewportSize[3] - viewportSize[1]));
+ GLuint x = viewportSize[0] + (getIndexPositionX(i) * 0.5f + 0.5f) * (viewportSize[2] - viewportSize[0]);
+ GLuint y = viewportSize[1] + (getIndexPositionY(i) * 0.5f + 0.5f) * (viewportSize[3] - viewportSize[1]);
if (i < firstIndex)
{
diff --git a/src/tests/end2end_tests/InstancingTest.cpp b/src/tests/end2end_tests/InstancingTest.cpp
index 1bfdcd9..68fcc07 100644
--- a/src/tests/end2end_tests/InstancingTest.cpp
+++ b/src/tests/end2end_tests/InstancingTest.cpp
@@ -221,8 +221,8 @@
{
unsigned int baseOffset = quadIndex * 3;
- int quadx = static_cast<int>(((mInstances[baseOffset + 0]) * 0.5f + 0.5f) * getWindowWidth());
- int quady = static_cast<int>(((mInstances[baseOffset + 1]) * 0.5f + 0.5f) * getWindowHeight());
+ float quadx = ((mInstances[baseOffset + 0]) * 0.5f + 0.5f) * getWindowWidth();
+ float quady = ((mInstances[baseOffset + 1]) * 0.5f + 0.5f) * getWindowHeight();
EXPECT_PIXEL_EQ(quadx, quady, 255, 0, 0, 255);
}
diff --git a/src/tests/end2end_tests/LineLoopTest.cpp b/src/tests/end2end_tests/LineLoopTest.cpp
index e6c4a73..6f9217c 100644
--- a/src/tests/end2end_tests/LineLoopTest.cpp
+++ b/src/tests/end2end_tests/LineLoopTest.cpp
@@ -69,7 +69,7 @@
ANGLETest::TearDown();
}
- void runTest(GLenum indexType, GLuint indexBuffer, const GLvoid *indexPtr)
+ void runTest(GLenum indexType, GLubyte indexBuffer, const GLvoid *indexPtr)
{
static const GLfloat loopPositions[] =
{
diff --git a/src/tests/end2end_tests/MipmapTest.cpp b/src/tests/end2end_tests/MipmapTest.cpp
index 49a17fe..7c842f6 100644
--- a/src/tests/end2end_tests/MipmapTest.cpp
+++ b/src/tests/end2end_tests/MipmapTest.cpp
@@ -150,9 +150,9 @@
for (int i = 0; i < width * height; i+=1)
{
- data[3 * i + 0] = static_cast<GLubyte>(r);
- data[3 * i + 1] = static_cast<GLubyte>(g);
- data[3 * i + 2] = static_cast<GLubyte>(b);
+ data[3 * i + 0] = r;
+ data[3 * i + 1] = g;
+ data[3 * i + 2] = b;
}
return data;
@@ -386,9 +386,9 @@
// Complete the texture by initializing the remaining levels.
int n = 1;
- while (getWindowWidth() / (1U << n) >= 1)
+ while (getWindowWidth() / pow(2, n) >= 1)
{
- glTexImage2D(GL_TEXTURE_2D, n, GL_RGB, getWindowWidth() / (1U << n), getWindowWidth() / (1U << n), 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
+ glTexImage2D(GL_TEXTURE_2D, n, GL_RGB, getWindowWidth() / pow(2, n), getWindowWidth() / pow(2, n), 0, GL_RGB, GL_UNSIGNED_BYTE, NULL);
ASSERT_GL_NO_ERROR();
n+=1;
}
diff --git a/src/tests/end2end_tests/PointSpritesTest.cpp b/src/tests/end2end_tests/PointSpritesTest.cpp
index 4fad700..4590d6c 100644
--- a/src/tests/end2end_tests/PointSpritesTest.cpp
+++ b/src/tests/end2end_tests/PointSpritesTest.cpp
@@ -84,8 +84,8 @@
maxPointSize = std::min(maxPointSize, 64.0f);
GLfloat pointWidth = maxPointSize / windowWidth;
- GLint step = static_cast<GLint>(floorf(maxPointSize / 4));
- GLint pointStep = std::max<GLint>(1, step);
+ GLfloat step = floorf(maxPointSize / 4);
+ GLfloat pointStep = std::max<GLfloat>(1.0f, step);
GLint pointSizeLoc = glGetUniformLocation(program, "uPointSize");
ASSERT_GL_NO_ERROR();
@@ -102,10 +102,10 @@
glBindBuffer(GL_ARRAY_BUFFER, vertexObject);
ASSERT_GL_NO_ERROR();
- GLfloat thePoints[] = { -0.5f + pixelOffset, -0.5f + pixelOffset,
- 0.5f + pixelOffset, -0.5f + pixelOffset,
- -0.5f + pixelOffset, 0.5f + pixelOffset,
- 0.5f + pixelOffset, 0.5f + pixelOffset };
+ GLfloat thePoints[] = { -0.5 + pixelOffset, -0.5 + pixelOffset,
+ 0.5 + pixelOffset, -0.5 + pixelOffset,
+ -0.5 + pixelOffset, 0.5 + pixelOffset,
+ 0.5 + pixelOffset, 0.5 + pixelOffset };
glBufferData(GL_ARRAY_BUFFER, sizeof(thePoints), thePoints, GL_STATIC_DRAW);
ASSERT_GL_NO_ERROR();
@@ -123,8 +123,8 @@
std::string debugText;
for (float py = 0; py < 2; ++py) {
for (float px = 0; px < 2; ++px) {
- float pointX = -0.5f + px + pixelOffset;
- float pointY = -0.5f + py + pixelOffset;
+ float pointX = -0.5 + px + pixelOffset;
+ float pointY = -0.5 + py + pixelOffset;
for (int yy = 0; yy < maxPointSize; yy += pointStep) {
for (int xx = 0; xx < maxPointSize; xx += pointStep) {
// formula for s and t from OpenGL ES 2.0 spec section 3.3
@@ -132,11 +132,11 @@
float yw = s2p(pointY);
float u = xx / maxPointSize * 2 - 1;
float v = yy / maxPointSize * 2 - 1;
- int xf = static_cast<int>(floorf(s2p(pointX + u * pointWidth)));
- int yf = static_cast<int>(floorf(s2p(pointY + v * pointWidth)));
- float s = 0.5f + (xf + 0.5f - xw) / maxPointSize;
- float t = 0.5f + (yf + 0.5f - yw) / maxPointSize;
- GLubyte color[4] = { static_cast<GLubyte>(floorf(s * 255)), static_cast<GLubyte>(floorf((1 - t) * 255)), 0, 255 };
+ float xf = floorf(s2p(pointX + u * pointWidth));
+ float yf = floorf(s2p(pointY + v * pointWidth));
+ float s = 0.5 + (xf + 0.5 - xw) / maxPointSize;
+ float t = 0.5 + (yf + 0.5 - yw) / maxPointSize;
+ GLubyte color[4] = { floorf(s * 255), floorf((1 - t) * 255), 0, 255 };
EXPECT_PIXEL_NEAR(xf, yf, color[0], color[1], color[2], color[3], 4);
}
}
diff --git a/src/tests/perf_tests/BufferSubData.cpp b/src/tests/perf_tests/BufferSubData.cpp
index 3ad5dd2..ddc6854 100644
--- a/src/tests/perf_tests/BufferSubData.cpp
+++ b/src/tests/perf_tests/BufferSubData.cpp
@@ -254,11 +254,11 @@
}
std::vector<uint8_t> data;
- GLsizei triDataSize = static_cast<GLsizei>(GetVertexData(params.vertexType,
- params.vertexComponentCount,
- params.vertexNormalized, &data));
+ GLsizei triDataSize = GetVertexData(params.vertexType,
+ params.vertexComponentCount,
+ params.vertexNormalized, &data);
- mNumTris = static_cast<int>(params.updateSize / triDataSize);
+ mNumTris = params.updateSize / triDataSize;
for (int i = 0, offset = 0; i < mNumTris; ++i)
{
memcpy(mUpdateData + offset, &data[0], triDataSize);
diff --git a/src/tests/tests.gyp b/src/tests/tests.gyp
index c1d2fb2..31d3fa5 100644
--- a/src/tests/tests.gyp
+++ b/src/tests/tests.gyp
@@ -178,10 +178,6 @@
],
},
},
- 'msvs_disabled_warnings':
- [
- 4244, # Conversion from 'type1' to 'type2', possible loss of data
- ],
},
],
'conditions':