Fix GCC warnings

Fix -Wsign-compare warnings.
Fix -Wunused-parameter warnings.
This commit is contained in:
Jeremy Hayes 2021-08-09 14:41:50 -06:00
parent 2fb89a0072
commit 012436d680
7 changed files with 17 additions and 17 deletions

View File

@ -3384,7 +3384,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
const auto& spirvInst = node->getSpirvInstruction(); const auto& spirvInst = node->getSpirvInstruction();
if (spirvInst.set == "") { if (spirvInst.set == "") {
std::vector<spv::IdImmediate> idImmOps; std::vector<spv::IdImmediate> idImmOps;
for (int i = 0; i < glslangOperands.size(); ++i) { for (unsigned int i = 0; i < glslangOperands.size(); ++i) {
if (glslangOperands[i]->getAsTyped()->getQualifier().isSpirvLiteral()) { if (glslangOperands[i]->getAsTyped()->getQualifier().isSpirvLiteral()) {
// Translate the constant to a literal value // Translate the constant to a literal value
std::vector<unsigned> literals; std::vector<unsigned> literals;

View File

@ -531,7 +531,7 @@ TIntermTyped* TIntermConstantUnion::fold(TOperator op, const TType& returnType)
case EbtFloat: newConstArray[i].setDConst(-unionArray[i].getDConst()); break; case EbtFloat: newConstArray[i].setDConst(-unionArray[i].getDConst()); break;
// Note: avoid UBSAN error regarding negating 0x80000000 // Note: avoid UBSAN error regarding negating 0x80000000
case EbtInt: newConstArray[i].setIConst( case EbtInt: newConstArray[i].setIConst(
unionArray[i].getIConst() == 0x80000000 static_cast<unsigned int>(unionArray[i].getIConst()) == 0x80000000
? -0x7FFFFFFF - 1 ? -0x7FFFFFFF - 1
: -unionArray[i].getIConst()); : -unionArray[i].getIConst());
break; break;

View File

@ -241,7 +241,7 @@ protected:
// override this to set the language-specific name // override this to set the language-specific name
virtual const char* getAtomicCounterBlockName() const { return ""; } virtual const char* getAtomicCounterBlockName() const { return ""; }
virtual void setAtomicCounterBlockDefaults(TType&) const {} virtual void setAtomicCounterBlockDefaults(TType&) const {}
virtual void setInvariant(const TSourceLoc& loc, const char* builtin) {} virtual void setInvariant(const TSourceLoc&, const char*) {}
virtual void finalizeAtomicCounterBlockLayout(TVariable&) {} virtual void finalizeAtomicCounterBlockLayout(TVariable&) {}
bool isAtomicCounterBlock(const TSymbol& symbol) { bool isAtomicCounterBlock(const TSymbol& symbol) {
const TVariable* var = symbol.getAsVariable(); const TVariable* var = symbol.getAsVariable();
@ -472,7 +472,7 @@ public:
// Determine loop control from attributes // Determine loop control from attributes
void handleLoopAttributes(const TAttributes& attributes, TIntermNode*); void handleLoopAttributes(const TAttributes& attributes, TIntermNode*);
// Function attributes // Function attributes
void handleFunctionAttributes(const TSourceLoc&, const TAttributes&, TFunction*); void handleFunctionAttributes(const TSourceLoc&, const TAttributes&);
// GL_EXT_spirv_intrinsics // GL_EXT_spirv_intrinsics
TSpirvRequirement* makeSpirvRequirement(const TSourceLoc& loc, const TString& name, TSpirvRequirement* makeSpirvRequirement(const TSourceLoc& loc, const TString& name,

View File

@ -347,7 +347,7 @@ void TParseContext::handleLoopAttributes(const TAttributes& attributes, TIntermN
// //
// Function attributes // Function attributes
// //
void TParseContext::handleFunctionAttributes(const TSourceLoc& loc, const TAttributes& attributes, TFunction* function) void TParseContext::handleFunctionAttributes(const TSourceLoc& loc, const TAttributes& attributes)
{ {
for (auto it = attributes.begin(); it != attributes.end(); ++it) { for (auto it = attributes.begin(); it != attributes.end(); ++it) {
if (it->size() > 0) { if (it->size() > 0) {

View File

@ -983,20 +983,20 @@ function_prototype
$$.function = $1; $$.function = $1;
$$.loc = $2.loc; $$.loc = $2.loc;
parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute"); parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute");
parseContext.handleFunctionAttributes($2.loc, *$3, $$.function); parseContext.handleFunctionAttributes($2.loc, *$3);
} }
| attribute function_declarator RIGHT_PAREN { | attribute function_declarator RIGHT_PAREN {
$$.function = $2; $$.function = $2;
$$.loc = $3.loc; $$.loc = $3.loc;
parseContext.requireExtensions($3.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute"); parseContext.requireExtensions($3.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute");
parseContext.handleFunctionAttributes($3.loc, *$1, $$.function); parseContext.handleFunctionAttributes($3.loc, *$1);
} }
| attribute function_declarator RIGHT_PAREN attribute { | attribute function_declarator RIGHT_PAREN attribute {
$$.function = $2; $$.function = $2;
$$.loc = $3.loc; $$.loc = $3.loc;
parseContext.requireExtensions($3.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute"); parseContext.requireExtensions($3.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute");
parseContext.handleFunctionAttributes($3.loc, *$1, $$.function); parseContext.handleFunctionAttributes($3.loc, *$1);
parseContext.handleFunctionAttributes($3.loc, *$4, $$.function); parseContext.handleFunctionAttributes($3.loc, *$4);
} }
; ;

View File

@ -983,20 +983,20 @@ function_prototype
$$.function = $1; $$.function = $1;
$$.loc = $2.loc; $$.loc = $2.loc;
parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute"); parseContext.requireExtensions($2.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute");
parseContext.handleFunctionAttributes($2.loc, *$3, $$.function); parseContext.handleFunctionAttributes($2.loc, *$3);
} }
| attribute function_declarator RIGHT_PAREN { | attribute function_declarator RIGHT_PAREN {
$$.function = $2; $$.function = $2;
$$.loc = $3.loc; $$.loc = $3.loc;
parseContext.requireExtensions($3.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute"); parseContext.requireExtensions($3.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute");
parseContext.handleFunctionAttributes($3.loc, *$1, $$.function); parseContext.handleFunctionAttributes($3.loc, *$1);
} }
| attribute function_declarator RIGHT_PAREN attribute { | attribute function_declarator RIGHT_PAREN attribute {
$$.function = $2; $$.function = $2;
$$.loc = $3.loc; $$.loc = $3.loc;
parseContext.requireExtensions($3.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute"); parseContext.requireExtensions($3.loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute");
parseContext.handleFunctionAttributes($3.loc, *$1, $$.function); parseContext.handleFunctionAttributes($3.loc, *$1);
parseContext.handleFunctionAttributes($3.loc, *$4, $$.function); parseContext.handleFunctionAttributes($3.loc, *$4);
} }
; ;

View File

@ -6204,7 +6204,7 @@ yyreduce:
(yyval.interm).function = (yyvsp[-2].interm.function); (yyval.interm).function = (yyvsp[-2].interm.function);
(yyval.interm).loc = (yyvsp[-1].lex).loc; (yyval.interm).loc = (yyvsp[-1].lex).loc;
parseContext.requireExtensions((yyvsp[-1].lex).loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute"); parseContext.requireExtensions((yyvsp[-1].lex).loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute");
parseContext.handleFunctionAttributes((yyvsp[-1].lex).loc, *(yyvsp[0].interm.attributes), (yyval.interm).function); parseContext.handleFunctionAttributes((yyvsp[-1].lex).loc, *(yyvsp[0].interm.attributes));
} }
#line 6210 "MachineIndependent/glslang_tab.cpp" #line 6210 "MachineIndependent/glslang_tab.cpp"
break; break;
@ -6215,7 +6215,7 @@ yyreduce:
(yyval.interm).function = (yyvsp[-1].interm.function); (yyval.interm).function = (yyvsp[-1].interm.function);
(yyval.interm).loc = (yyvsp[0].lex).loc; (yyval.interm).loc = (yyvsp[0].lex).loc;
parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute"); parseContext.requireExtensions((yyvsp[0].lex).loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute");
parseContext.handleFunctionAttributes((yyvsp[0].lex).loc, *(yyvsp[-2].interm.attributes), (yyval.interm).function); parseContext.handleFunctionAttributes((yyvsp[0].lex).loc, *(yyvsp[-2].interm.attributes));
} }
#line 6221 "MachineIndependent/glslang_tab.cpp" #line 6221 "MachineIndependent/glslang_tab.cpp"
break; break;
@ -6226,8 +6226,8 @@ yyreduce:
(yyval.interm).function = (yyvsp[-2].interm.function); (yyval.interm).function = (yyvsp[-2].interm.function);
(yyval.interm).loc = (yyvsp[-1].lex).loc; (yyval.interm).loc = (yyvsp[-1].lex).loc;
parseContext.requireExtensions((yyvsp[-1].lex).loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute"); parseContext.requireExtensions((yyvsp[-1].lex).loc, 1, &E_GL_EXT_subgroup_uniform_control_flow, "attribute");
parseContext.handleFunctionAttributes((yyvsp[-1].lex).loc, *(yyvsp[-3].interm.attributes), (yyval.interm).function); parseContext.handleFunctionAttributes((yyvsp[-1].lex).loc, *(yyvsp[-3].interm.attributes));
parseContext.handleFunctionAttributes((yyvsp[-1].lex).loc, *(yyvsp[0].interm.attributes), (yyval.interm).function); parseContext.handleFunctionAttributes((yyvsp[-1].lex).loc, *(yyvsp[0].interm.attributes));
} }
#line 6233 "MachineIndependent/glslang_tab.cpp" #line 6233 "MachineIndependent/glslang_tab.cpp"
break; break;