Commit e97a31e2 by Alexis Hetu Committed by Alexis Hétu

Fixed clang warnings and unmuted these warnings

A few warnings were fixed: - 2 sets of virtual flip/blit functions were colliding, so I added pure virtual function overrides so that both definitions appear within FrameBufferWin - Moved a few variables within ASSERT inside the ASSERT statement in order to remove unused variable warnings - Removed stack option from glslang.l and removed comments handling code, which is actually already done by the preprocessor (tested in dEQP) - Removed unused yyscanner variable from glslang.l - Ifdefed debug only code in main.cpp Removed all related muted warnings from BUILD.gn files. Change-Id: Idf9e7eed00431cc747b689b5d1931fd0c1e8d506 Reviewed-on: https://swiftshader-review.googlesource.com/8010Tested-by: 's avatarAlexis Hétu <sugoi@google.com> Reviewed-by: 's avatarNico Weber <thakis@google.com> Reviewed-by: 's avatarNicolas Capens <capn@google.com>
parent e1d85307
...@@ -19,7 +19,6 @@ config("swiftshader_main_private_config") { ...@@ -19,7 +19,6 @@ config("swiftshader_main_private_config") {
if (is_clang) { if (is_clang) {
cflags += [ cflags += [
"-Wno-overloaded-virtual",
"-Wno-string-conversion", "-Wno-string-conversion",
"-Wno-sign-compare", "-Wno-sign-compare",
] ]
......
...@@ -33,6 +33,9 @@ namespace sw ...@@ -33,6 +33,9 @@ namespace sw
virtual ~FrameBufferWin(); virtual ~FrameBufferWin();
void flip(void *source, Format sourceFormat, size_t sourceStride) override = 0;
void blit(void *source, const Rect *sourceRect, const Rect *destRect, Format sourceFormat, size_t sourceStride) override = 0;
virtual void flip(HWND windowOverride, void *source, Format sourceFormat, size_t sourceStride) = 0; virtual void flip(HWND windowOverride, void *source, Format sourceFormat, size_t sourceStride) = 0;
virtual void blit(HWND windowOverride, void *source, const Rect *sourceRect, const Rect *destRect, Format sourceFormat, size_t sourceStride) = 0; virtual void blit(HWND windowOverride, void *source, const Rect *sourceRect, const Rect *destRect, Format sourceFormat, size_t sourceStride) = 0;
......
...@@ -19,10 +19,6 @@ config("swiftshader_opengl_common_private_config") { ...@@ -19,10 +19,6 @@ config("swiftshader_opengl_common_private_config") {
"/wd4201", # nameless struct/union "/wd4201", # nameless struct/union
"/wd4324", # structure was padded due to alignment specifier "/wd4324", # structure was padded due to alignment specifier
] ]
if (is_clang) {
cflags += [ "-Wno-delete-incomplete" ]
}
} else { } else {
cflags = [ "-DLOG_TAG=\"swiftshader_opengl_common\"" ] cflags = [ "-DLOG_TAG=\"swiftshader_opengl_common\"" ]
} }
......
...@@ -25,13 +25,6 @@ config("swiftshader_opengl_compiler_private_config") { ...@@ -25,13 +25,6 @@ config("swiftshader_opengl_compiler_private_config") {
if (!is_debug) { if (!is_debug) {
cflags += [ "/wd4189" ] # local variable is initialized but not referenced (variables only used in ASSERTS) cflags += [ "/wd4189" ] # local variable is initialized but not referenced (variables only used in ASSERTS)
} }
if (is_clang) {
cflags += [
"-Wno-unused-function",
"-Wno-unused-variable",
]
}
} else { } else {
cflags = [ cflags = [
"-DLOG_TAG=\"swiftshader_opengl_compiler\"", "-DLOG_TAG=\"swiftshader_opengl_compiler\"",
......
...@@ -1508,8 +1508,8 @@ namespace glsl ...@@ -1508,8 +1508,8 @@ namespace glsl
if(visit == PostVisit) if(visit == PostVisit)
{ {
TIntermTyped *arg0 = arg[0]->getAsTyped(); TIntermTyped *arg0 = arg[0]->getAsTyped();
TIntermTyped *arg1 = arg[1]->getAsTyped(); ASSERT((arg0->getNominalSize() == arg[1]->getAsTyped()->getNominalSize()) &&
ASSERT((arg0->getNominalSize() == arg1->getNominalSize()) && (arg0->getSecondarySize() == arg1->getSecondarySize())); (arg0->getSecondarySize() == arg[1]->getAsTyped()->getSecondarySize()));
int size = arg0->getNominalSize(); int size = arg0->getNominalSize();
for(int i = 0; i < size; i++) for(int i = 0; i < size; i++)
...@@ -2169,8 +2169,7 @@ namespace glsl ...@@ -2169,8 +2169,7 @@ namespace glsl
if(memberType.getBasicType() == EbtBool) if(memberType.getBasicType() == EbtBool)
{ {
int arraySize = (memberType.isArray() ? memberType.getArraySize() : 1); ASSERT(argumentInfo.clampedIndex < (memberType.isArray() ? memberType.getArraySize() : 1)); // index < arraySize
ASSERT(argumentInfo.clampedIndex < arraySize);
// Convert the packed bool, which is currently an int, to a true bool // Convert the packed bool, which is currently an int, to a true bool
Instruction *instruction = new Instruction(sw::Shader::OPCODE_I2B); Instruction *instruction = new Instruction(sw::Shader::OPCODE_I2B);
...@@ -2189,9 +2188,8 @@ namespace glsl ...@@ -2189,9 +2188,8 @@ namespace glsl
{ {
int numCols = memberType.getNominalSize(); int numCols = memberType.getNominalSize();
int numRows = memberType.getSecondarySize(); int numRows = memberType.getSecondarySize();
int arraySize = (memberType.isArray() ? memberType.getArraySize() : 1);
ASSERT(argumentInfo.clampedIndex < (numCols * arraySize)); ASSERT(argumentInfo.clampedIndex < (numCols * (memberType.isArray() ? memberType.getArraySize() : 1))); // index < cols * arraySize
unsigned int dstIndex = registerIndex(&unpackedUniform); unsigned int dstIndex = registerIndex(&unpackedUniform);
unsigned int srcSwizzle = (argumentInfo.clampedIndex % numCols) * 0x55; unsigned int srcSwizzle = (argumentInfo.clampedIndex % numCols) * 0x55;
......
...@@ -84,7 +84,6 @@ static int floatsuffix_check(TParseContext* context); ...@@ -84,7 +84,6 @@ static int floatsuffix_check(TParseContext* context);
%option noyywrap nounput never-interactive %option noyywrap nounput never-interactive
%option yylineno reentrant bison-bridge bison-locations %option yylineno reentrant bison-bridge bison-locations
%option stack
%option extra-type="TParseContext*" %option extra-type="TParseContext*"
%x COMMENT FIELDS %x COMMENT FIELDS
...@@ -100,15 +99,6 @@ O [0-7] ...@@ -100,15 +99,6 @@ O [0-7]
TParseContext* context = yyextra; TParseContext* context = yyextra;
%} %}
/* Single-line comments */
"//"[^\n]* ;
/* Multi-line comments */
"/*" { yy_push_state(COMMENT, yyscanner); }
<COMMENT>. |
<COMMENT>\n ;
<COMMENT>"*/" { yy_pop_state(yyscanner); }
"invariant" { return(INVARIANT); } "invariant" { return(INVARIANT); }
"highp" { return(HIGH_PRECISION); } "highp" { return(HIGH_PRECISION); }
"mediump" { return(MEDIUM_PRECISION); } "mediump" { return(MEDIUM_PRECISION); }
...@@ -494,7 +484,6 @@ int ES2_identifier_ES3_keyword(TParseContext *context, int token) ...@@ -494,7 +484,6 @@ int ES2_identifier_ES3_keyword(TParseContext *context, int token)
int uint_constant(TParseContext *context) int uint_constant(TParseContext *context)
{ {
struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner(); struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
yyscan_t yyscanner = (yyscan_t) context->getScanner();
if (context->getShaderVersion() < 300) if (context->getShaderVersion() < 300)
{ {
......
...@@ -704,34 +704,34 @@ static const yytype_uint8 yytranslate[] = ...@@ -704,34 +704,34 @@ static const yytype_uint8 yytranslate[] =
/* YYRLINE[YYN] -- Source line where rule number YYN was defined. */ /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] = static const yytype_uint16 yyrline[] =
{ {
0, 213, 213, 232, 235, 240, 245, 250, 255, 261, 0, 229, 229, 248, 251, 256, 261, 266, 271, 277,
264, 267, 270, 273, 276, 282, 290, 301, 305, 313, 280, 283, 286, 289, 292, 298, 306, 317, 321, 329,
316, 322, 326, 333, 339, 348, 356, 362, 369, 379, 332, 338, 342, 349, 355, 364, 372, 378, 385, 395,
382, 385, 388, 398, 399, 400, 401, 409, 410, 414, 398, 401, 404, 414, 415, 416, 417, 425, 426, 430,
418, 426, 427, 430, 436, 437, 441, 448, 449, 452, 434, 442, 443, 446, 452, 453, 457, 464, 465, 468,
455, 458, 464, 465, 468, 474, 475, 482, 483, 490, 471, 474, 480, 481, 484, 490, 491, 498, 499, 506,
491, 498, 499, 505, 506, 512, 513, 519, 520, 526, 507, 514, 515, 521, 522, 528, 529, 535, 536, 542,
527, 535, 536, 537, 538, 540, 541, 542, 545, 548, 543, 551, 552, 553, 554, 556, 557, 558, 561, 564,
551, 554, 560, 563, 574, 582, 590, 593, 599, 606, 567, 570, 576, 579, 590, 598, 606, 609, 615, 622,
610, 614, 618, 625, 631, 634, 641, 649, 670, 696, 626, 630, 634, 641, 647, 650, 657, 665, 686, 712,
706, 734, 739, 749, 754, 764, 767, 770, 773, 779, 722, 750, 755, 765, 770, 780, 783, 786, 789, 795,
786, 789, 793, 797, 802, 807, 814, 818, 822, 826, 802, 805, 809, 813, 818, 823, 830, 834, 838, 842,
831, 836, 840, 847, 857, 863, 866, 872, 878, 885, 847, 852, 856, 863, 873, 879, 882, 888, 894, 901,
894, 903, 911, 914, 921, 925, 929, 934, 942, 945, 910, 919, 927, 930, 937, 941, 945, 950, 958, 961,
949, 953, 962, 971, 979, 989, 1001, 1004, 1007, 1013, 965, 969, 978, 987, 995, 1005, 1017, 1020, 1023, 1029,
1020, 1023, 1029, 1032, 1035, 1041, 1044, 1049, 1064, 1068, 1036, 1039, 1045, 1048, 1051, 1057, 1060, 1065, 1080, 1084,
1072, 1076, 1080, 1084, 1089, 1094, 1099, 1104, 1109, 1114, 1088, 1092, 1096, 1100, 1105, 1110, 1115, 1120, 1125, 1130,
1119, 1124, 1129, 1134, 1139, 1144, 1150, 1156, 1162, 1168, 1135, 1140, 1145, 1150, 1155, 1160, 1166, 1172, 1178, 1184,
1174, 1180, 1186, 1192, 1198, 1203, 1208, 1217, 1222, 1227, 1190, 1196, 1202, 1208, 1214, 1219, 1224, 1233, 1238, 1243,
1232, 1237, 1242, 1247, 1252, 1257, 1262, 1267, 1272, 1277, 1248, 1253, 1258, 1263, 1268, 1273, 1278, 1283, 1288, 1293,
1282, 1287, 1300, 1300, 1303, 1303, 1309, 1312, 1328, 1331, 1298, 1303, 1316, 1316, 1319, 1319, 1325, 1328, 1344, 1347,
1340, 1344, 1350, 1357, 1372, 1376, 1380, 1381, 1387, 1388, 1356, 1360, 1366, 1373, 1388, 1392, 1396, 1397, 1403, 1404,
1389, 1390, 1391, 1392, 1393, 1397, 1398, 1398, 1398, 1408, 1405, 1406, 1407, 1408, 1409, 1413, 1414, 1414, 1414, 1424,
1409, 1413, 1413, 1414, 1414, 1419, 1422, 1432, 1435, 1441, 1425, 1429, 1429, 1430, 1430, 1435, 1438, 1448, 1451, 1457,
1442, 1446, 1454, 1458, 1465, 1465, 1472, 1475, 1482, 1487, 1458, 1462, 1470, 1474, 1481, 1481, 1488, 1491, 1498, 1503,
1502, 1502, 1507, 1507, 1514, 1514, 1522, 1525, 1531, 1534, 1518, 1518, 1523, 1523, 1530, 1530, 1538, 1541, 1547, 1550,
1540, 1544, 1551, 1554, 1557, 1560, 1563, 1572, 1576, 1583, 1556, 1560, 1567, 1570, 1573, 1576, 1579, 1588, 1592, 1599,
1586, 1592, 1592 1602, 1608, 1608
}; };
#endif #endif
...@@ -3215,7 +3215,7 @@ yyreduce: ...@@ -3215,7 +3215,7 @@ yyreduce:
TType type((yyvsp[-2].interm.type)); TType type((yyvsp[-2].interm.type));
function = new TFunction((yyvsp[-1].lex).string, type); function = new TFunction((yyvsp[-1].lex).string, type);
(yyval.interm.function) = function; (yyval.interm.function) = function;
context->symbolTable.push(); context->symbolTable.push();
} }
...@@ -3576,7 +3576,7 @@ yyreduce: ...@@ -3576,7 +3576,7 @@ yyreduce:
{ {
context->error((yylsp[0]), "interpolation qualifier requires a fragment 'in' or vertex 'out' storage qualifier", getQualifierString((yyvsp[0].interm.type).qualifier)); context->error((yylsp[0]), "interpolation qualifier requires a fragment 'in' or vertex 'out' storage qualifier", getQualifierString((yyvsp[0].interm.type).qualifier));
context->recover(); context->recover();
TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary; TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
(yyval.interm.type).setBasic(EbtVoid, qual, (yylsp[0])); (yyval.interm.type).setBasic(EbtVoid, qual, (yylsp[0]));
} }
......
...@@ -22,10 +22,6 @@ config("swiftshader_libEGL_private_config") { ...@@ -22,10 +22,6 @@ config("swiftshader_libEGL_private_config") {
"/wd4201", # nameless struct/union "/wd4201", # nameless struct/union
"/wd4065", # switch statement contains 'default' but no 'case' labels "/wd4065", # switch statement contains 'default' but no 'case' labels
] ]
if (is_clang) {
cflags += [ "-Wno-unused-function" ]
}
} else { } else {
cflags = [ cflags = [
"-DLOG_TAG=\"swiftshader_libEGL\"", "-DLOG_TAG=\"swiftshader_libEGL\"",
......
...@@ -103,6 +103,7 @@ DESTRUCTOR void detachProcess() ...@@ -103,6 +103,7 @@ DESTRUCTOR void detachProcess()
} }
#if defined(_WIN32) #if defined(_WIN32)
#ifndef NDEBUG
static INT_PTR CALLBACK DebuggerWaitDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) static INT_PTR CALLBACK DebuggerWaitDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
RECT rect; RECT rect;
...@@ -139,6 +140,7 @@ static void WaitForDebugger(HINSTANCE instance) ...@@ -139,6 +140,7 @@ static void WaitForDebugger(HINSTANCE instance)
DialogBoxIndirect(instance, dialogTemplate, NULL, DebuggerWaitDialogProc); DialogBoxIndirect(instance, dialogTemplate, NULL, DebuggerWaitDialogProc);
} }
} }
#endif
extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved) extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
{ {
......
...@@ -27,7 +27,6 @@ config("swiftshader_libGLESv2_private_config") { ...@@ -27,7 +27,6 @@ config("swiftshader_libGLESv2_private_config") {
if (is_clang) if (is_clang)
{ {
cflags += [ cflags += [
"-Wno-delete-incomplete",
"-D__STDC_CONSTANT_MACROS", "-D__STDC_CONSTANT_MACROS",
"-D__STDC_LIMIT_MACROS", "-D__STDC_LIMIT_MACROS",
] ]
......
...@@ -19,10 +19,6 @@ config("swiftshader_reactor_private_config") { ...@@ -19,10 +19,6 @@ config("swiftshader_reactor_private_config") {
"/wd4201", # nameless struct/union "/wd4201", # nameless struct/union
"/wd4245", # conversion from int to unsigned int (llvm) "/wd4245", # conversion from int to unsigned int (llvm)
] ]
if (is_clang) {
cflags += [ "-Wno-delete-incomplete" ]
}
} else { } else {
cflags = [ cflags = [
"-DLOG_TAG=\"swiftshader_reactor\"", "-DLOG_TAG=\"swiftshader_reactor\"",
......
...@@ -19,13 +19,6 @@ config("swiftshader_renderer_private_config") { ...@@ -19,13 +19,6 @@ config("swiftshader_renderer_private_config") {
"/wd4201", # nameless struct/union "/wd4201", # nameless struct/union
"/wd4324", # structure was padded due to alignment specifier "/wd4324", # structure was padded due to alignment specifier
] ]
if (is_clang) {
cflags += [
"-Wno-delete-incomplete",
"-Wno-microsoft-template",
]
}
} else { } else {
cflags = [ cflags = [
"-DLOG_TAG=\"swiftshader_renderer\"", "-DLOG_TAG=\"swiftshader_renderer\"",
......
...@@ -23,7 +23,6 @@ config("swiftshader_shader_private_config") { ...@@ -23,7 +23,6 @@ config("swiftshader_shader_private_config") {
if (is_clang) { if (is_clang) {
cflags += [ cflags += [
"-Wno-sign-compare", "-Wno-sign-compare",
"-Wno-delete-incomplete",
] ]
} }
} else { } else {
......
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