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/compiler/preprocessor/ExpressionParser.cpp b/src/compiler/preprocessor/ExpressionParser.cpp
index 4a90322..616f4d7 100644
--- a/src/compiler/preprocessor/ExpressionParser.cpp
+++ b/src/compiler/preprocessor/ExpressionParser.cpp
@@ -86,7 +86,7 @@
#pragma GCC diagnostic ignored "-Wuninitialized"
#endif
#elif defined(_MSC_VER)
-#pragma warning(disable: 4065 4244 4701 4702)
+#pragma warning(disable: 4065 4701 4702)
#endif
#include "ExpressionParser.h"
diff --git a/src/compiler/preprocessor/ExpressionParser.y b/src/compiler/preprocessor/ExpressionParser.y
index 0933736..8caf36b 100644
--- a/src/compiler/preprocessor/ExpressionParser.y
+++ b/src/compiler/preprocessor/ExpressionParser.y
@@ -28,7 +28,7 @@
#pragma GCC diagnostic ignored "-Wuninitialized"
#endif
#elif defined(_MSC_VER)
-#pragma warning(disable: 4065 4244 4701 4702)
+#pragma warning(disable: 4065 4701 4702)
#endif
#include "ExpressionParser.h"
diff --git a/src/compiler/preprocessor/Tokenizer.cpp b/src/compiler/preprocessor/Tokenizer.cpp
index ae16938..713d86d 100644
--- a/src/compiler/preprocessor/Tokenizer.cpp
+++ b/src/compiler/preprocessor/Tokenizer.cpp
@@ -548,8 +548,6 @@
#if defined(__GNUC__)
// Triggered by the auto-generated yy_fatal_error function.
#pragma GCC diagnostic ignored "-Wmissing-noreturn"
-#else if defined(_MSC_VER)
-#pragma warning(disable: 4244)
#endif
typedef std::string YYSTYPE;
diff --git a/src/compiler/preprocessor/Tokenizer.l b/src/compiler/preprocessor/Tokenizer.l
index 8c0d56d..89cb5c8 100644
--- a/src/compiler/preprocessor/Tokenizer.l
+++ b/src/compiler/preprocessor/Tokenizer.l
@@ -31,8 +31,6 @@
#if defined(__GNUC__)
// Triggered by the auto-generated yy_fatal_error function.
#pragma GCC diagnostic ignored "-Wmissing-noreturn"
-#else if defined(_MSC_VER)
-#pragma warning(disable: 4244)
#endif
typedef std::string YYSTYPE;
diff --git a/src/compiler/translator/InitializeVariables.cpp b/src/compiler/translator/InitializeVariables.cpp
index 2bb609a..0e3e2eb 100644
--- a/src/compiler/translator/InitializeVariables.cpp
+++ b/src/compiler/translator/InitializeVariables.cpp
@@ -13,7 +13,7 @@
TIntermConstantUnion *constructFloatConstUnionNode(const TType &type)
{
TType myType = type;
- unsigned char size = static_cast<unsigned char>(myType.getNominalSize());
+ unsigned char size = myType.getNominalSize();
if (myType.isMatrix())
size *= size;
ConstantUnion *u = new ConstantUnion[size];
diff --git a/src/compiler/translator/IntermNode.cpp b/src/compiler/translator/IntermNode.cpp
index 708dcb3..266e3c8 100644
--- a/src/compiler/translator/IntermNode.cpp
+++ b/src/compiler/translator/IntermNode.cpp
@@ -448,13 +448,13 @@
{
mOp = EOpVectorTimesMatrix;
setType(TType(basicType, higherPrecision, EvqTemporary,
- static_cast<unsigned char>(mRight->getCols()), 1));
+ mRight->getCols(), 1));
}
else
{
mOp = EOpMatrixTimesScalar;
setType(TType(basicType, higherPrecision, EvqTemporary,
- static_cast<unsigned char>(mRight->getCols()), static_cast<unsigned char>(mRight->getRows())));
+ mRight->getCols(), mRight->getRows()));
}
}
else if (mLeft->isMatrix() && !mRight->isMatrix())
@@ -463,7 +463,7 @@
{
mOp = EOpMatrixTimesVector;
setType(TType(basicType, higherPrecision, EvqTemporary,
- static_cast<unsigned char>(mLeft->getRows()), 1));
+ mLeft->getRows(), 1));
}
else
{
@@ -474,7 +474,7 @@
{
mOp = EOpMatrixTimesMatrix;
setType(TType(basicType, higherPrecision, EvqTemporary,
- static_cast<unsigned char>(mRight->getCols()), static_cast<unsigned char>(mLeft->getRows())));
+ mRight->getCols(), mLeft->getRows()));
}
else if (!mLeft->isMatrix() && !mRight->isMatrix())
{
@@ -486,7 +486,7 @@
{
mOp = EOpVectorTimesScalar;
setType(TType(basicType, higherPrecision, EvqTemporary,
- static_cast<unsigned char>(nominalSize), 1));
+ nominalSize, 1));
}
}
else
@@ -529,7 +529,7 @@
{
mOp = EOpMatrixTimesMatrixAssign;
setType(TType(basicType, higherPrecision, EvqTemporary,
- static_cast<unsigned char>(mRight->getCols()), static_cast<unsigned char>(mLeft->getRows())));
+ mRight->getCols(), mLeft->getRows()));
}
else if (!mLeft->isMatrix() && !mRight->isMatrix())
{
@@ -543,7 +543,7 @@
return false;
mOp = EOpVectorTimesScalarAssign;
setType(TType(basicType, higherPrecision, EvqTemporary,
- static_cast<unsigned char>(mLeft->getNominalSize()), 1));
+ mLeft->getNominalSize(), 1));
}
}
else
@@ -613,7 +613,7 @@
const int secondarySize = std::max(
mLeft->getSecondarySize(), mRight->getSecondarySize());
setType(TType(basicType, higherPrecision, EvqTemporary,
- static_cast<unsigned char>(nominalSize), static_cast<unsigned char>(secondarySize)));
+ nominalSize, secondarySize));
if (mLeft->isArray())
{
ASSERT(mLeft->getArraySize() == mRight->getArraySize());
@@ -747,8 +747,8 @@
}
// update return type for matrix product
- returnType.setPrimarySize(static_cast<unsigned char>(resultCols));
- returnType.setSecondarySize(static_cast<unsigned char>(resultRows));
+ returnType.setPrimarySize(resultCols);
+ returnType.setSecondarySize(resultRows);
}
break;
@@ -868,7 +868,7 @@
}
returnType = node->getType();
- returnType.setPrimarySize(static_cast<unsigned char>(matrixRows));
+ returnType.setPrimarySize(matrixRows);
tempNode = new TIntermConstantUnion(tempConstArray, returnType);
tempNode->setLine(getLine());
@@ -903,7 +903,7 @@
}
}
- returnType.setPrimarySize(static_cast<unsigned char>(matrixCols));
+ returnType.setPrimarySize(matrixCols);
}
break;
diff --git a/src/compiler/translator/ParseContext.cpp b/src/compiler/translator/ParseContext.cpp
index fbd0ba8..4387011 100644
--- a/src/compiler/translator/ParseContext.cpp
+++ b/src/compiler/translator/ParseContext.cpp
@@ -2163,8 +2163,7 @@
}
else
{
- indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(), EvqTemporary,
- static_cast<unsigned char>(baseExpression->getNominalSize()), static_cast<unsigned char>(baseExpression->getSecondarySize())));
+ indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(), EvqTemporary, baseExpression->getNominalSize(), baseExpression->getSecondarySize()));
}
if (baseExpression->getType().getQualifier() == EvqConst)
@@ -2175,7 +2174,7 @@
else if (baseExpression->isMatrix())
{
TQualifier qualifier = baseExpression->getType().getQualifier() == EvqConst ? EvqConst : EvqTemporary;
- indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(), qualifier, static_cast<unsigned char>(baseExpression->getRows())));
+ indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(), qualifier, baseExpression->getRows()));
}
else if (baseExpression->isVector())
{
@@ -2221,7 +2220,7 @@
}
else
{
- indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(), EvqConst, (unsigned char) (fieldString).size()));
+ indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(), EvqConst, (int) (fieldString).size()));
}
}
else
@@ -2229,7 +2228,7 @@
TString vectorString = fieldString;
TIntermTyped* index = intermediate.addSwizzle(fields, fieldLocation);
indexedExpression = intermediate.addIndex(EOpVectorSwizzle, baseExpression, index, dotLocation);
- indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(), EvqTemporary, (unsigned char) vectorString.size()));
+ indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(), EvqTemporary, (int) vectorString.size()));
}
}
else if (baseExpression->isMatrix())
@@ -2252,8 +2251,7 @@
unionArray->setIConst(0);
TIntermTyped* index = intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConst), fieldLocation);
indexedExpression = intermediate.addIndex(EOpIndexDirect, baseExpression, index, dotLocation);
- indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(),EvqTemporary,
- static_cast<unsigned char>(baseExpression->getCols()), static_cast<unsigned char>(baseExpression->getRows())));
+ indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(),EvqTemporary, baseExpression->getCols(), baseExpression->getRows()));
}
else
{
diff --git a/src/compiler/translator/SymbolTable.cpp b/src/compiler/translator/SymbolTable.cpp
index 9525040..0eb663f 100644
--- a/src/compiler/translator/SymbolTable.cpp
+++ b/src/compiler/translator/SymbolTable.cpp
@@ -152,10 +152,10 @@
switch(type->getBasicType())
{
- case EbtGenType: return new TType(EbtFloat, static_cast<unsigned char>(size));
- case EbtGenIType: return new TType(EbtInt, static_cast<unsigned char>(size));
- case EbtGenUType: return new TType(EbtUInt, static_cast<unsigned char>(size));
- case EbtGenBType: return new TType(EbtBool, static_cast<unsigned char>(size));
+ case EbtGenType: return new TType(EbtFloat, size);
+ case EbtGenIType: return new TType(EbtInt, size);
+ case EbtGenUType: return new TType(EbtUInt, size);
+ case EbtGenBType: return new TType(EbtBool, size);
default: return type;
}
}
@@ -173,10 +173,10 @@
switch(type->getBasicType())
{
- case EbtVec: return new TType(EbtFloat, static_cast<unsigned char>(size));
- case EbtIVec: return new TType(EbtInt, static_cast<unsigned char>(size));
- case EbtUVec: return new TType(EbtUInt, static_cast<unsigned char>(size));
- case EbtBVec: return new TType(EbtBool, static_cast<unsigned char>(size));
+ case EbtVec: return new TType(EbtFloat, size);
+ case EbtIVec: return new TType(EbtInt, size);
+ case EbtUVec: return new TType(EbtUInt, size);
+ case EbtBVec: return new TType(EbtBool, size);
default: return type;
}
}
diff --git a/src/compiler/translator/glslang.l b/src/compiler/translator/glslang.l
index 023ac5b..ee4d28b 100644
--- a/src/compiler/translator/glslang.l
+++ b/src/compiler/translator/glslang.l
@@ -30,7 +30,6 @@
#elif defined(_MSC_VER)
#pragma warning(disable: 4065)
#pragma warning(disable: 4189)
-#pragma warning(disable: 4244)
#pragma warning(disable: 4505)
#pragma warning(disable: 4701)
#pragma warning(disable: 4702)
diff --git a/src/compiler/translator/glslang.y b/src/compiler/translator/glslang.y
index cc2fa4c..8af9633 100644
--- a/src/compiler/translator/glslang.y
+++ b/src/compiler/translator/glslang.y
@@ -30,7 +30,6 @@
#elif defined(_MSC_VER)
#pragma warning(disable: 4065)
#pragma warning(disable: 4189)
-#pragma warning(disable: 4244)
#pragma warning(disable: 4505)
#pragma warning(disable: 4701)
#pragma warning(disable: 4702)
diff --git a/src/compiler/translator/glslang_lex.cpp b/src/compiler/translator/glslang_lex.cpp
index 600d8bd..66d3df9 100644
--- a/src/compiler/translator/glslang_lex.cpp
+++ b/src/compiler/translator/glslang_lex.cpp
@@ -15,7 +15,6 @@
#elif defined(_MSC_VER)
#pragma warning(disable: 4065)
#pragma warning(disable: 4189)
-#pragma warning(disable: 4244)
#pragma warning(disable: 4505)
#pragma warning(disable: 4701)
#pragma warning(disable: 4702)
diff --git a/src/compiler/translator/glslang_tab.cpp b/src/compiler/translator/glslang_tab.cpp
index 50e2319..5ea6852 100644
--- a/src/compiler/translator/glslang_tab.cpp
+++ b/src/compiler/translator/glslang_tab.cpp
@@ -80,7 +80,6 @@
#elif defined(_MSC_VER)
#pragma warning(disable: 4065)
#pragma warning(disable: 4189)
-#pragma warning(disable: 4244)
#pragma warning(disable: 4505)
#pragma warning(disable: 4701)
#pragma warning(disable: 4702)