From c622ed7f864fe6a78e4a74951e741821be44b95e Mon Sep 17 00:00:00 2001 From: Patrick Wuttke Date: Wed, 26 Jun 2024 10:02:58 +0200 Subject: [PATCH] Fixed MSVC build warnings. --- .gitignore | 8 + SPIRV/GlslangToSpv.cpp | 66 ++++--- SPIRV/SPVRemapper.cpp | 8 +- SPIRV/SpvBuilder.cpp | 40 +++-- SPIRV/SpvPostProcess.cpp | 14 +- glslang/MachineIndependent/Intermediate.cpp | 4 +- glslang/MachineIndependent/ParseHelper.cpp | 188 +++++++++++--------- glslang/MachineIndependent/ParseHelper.h | 4 +- glslang/MachineIndependent/Scan.cpp | 40 +++-- glslang/MachineIndependent/SymbolTable.h | 4 +- glslang/MachineIndependent/Versions.cpp | 4 +- glslang/MachineIndependent/attribute.cpp | 2 +- glslang/MachineIndependent/iomapper.cpp | 20 +-- glslang/MachineIndependent/limits.cpp | 4 +- glslang/MachineIndependent/reflection.cpp | 16 +- 15 files changed, 239 insertions(+), 183 deletions(-) diff --git a/.gitignore b/.gitignore index 732b3459..70439fb6 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ External/googletest External/spirv-tools out/ CMakeUserPresets.json +*.obj # GN generated files .cipd/ @@ -20,6 +21,13 @@ third_party/ buildtools/ tools/ +# S++ generated files +.spp_script_run + # Random OS stuff .DS_Store ._* + +# Generated files +include/ +glslang/build_info.h diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 576c680f..4b1bc52b 100755 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -1944,14 +1944,16 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(unsigned int spvVersion, const glslang::TSpirvExecutionMode spirvExecutionMode = glslangIntermediate->getSpirvExecutionMode(); // Add spirv_execution_mode - for (auto& mode : spirvExecutionMode.modes) { - if (!mode.second.empty()) { + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + for (auto& spvMode : spirvExecutionMode.modes) { + if (!spvMode.second.empty()) { std::vector literals; - TranslateLiterals(mode.second, literals); - builder.addExecutionMode(shaderEntry, static_cast(mode.first), literals); + TranslateLiterals(spvMode.second, literals); + builder.addExecutionMode(shaderEntry, static_cast(spvMode.first), literals); } else - builder.addExecutionMode(shaderEntry, static_cast(mode.first)); + builder.addExecutionMode(shaderEntry, static_cast(spvMode.first)); } + // END @MEWIN // Add spirv_execution_mode_id for (auto& modeId : spirvExecutionMode.modeIds) { @@ -2741,19 +2743,19 @@ bool TGlslangToSpvTraverser::visitUnary(glslang::TVisit /* visit */, glslang::TI else op = glslang::EOpSub; - spv::Id result = createBinaryOperation(op, decorations, + spv::Id opResult = createBinaryOperation(op, decorations, // @MEWIN - 2024-06-26 - Fixed shadowing warning. convertGlslangToSpvType(node->getType()), operand, one, node->getType().getBasicType()); - assert(result != spv::NoResult); + assert(opResult != spv::NoResult); // @MEWIN - 2024-06-26 - Fixed shadowing warning. // The result of operation is always stored, but conditionally the // consumed result. The consumed result is always an r-value. - builder.accessChainStore(result, + builder.accessChainStore(opResult, // @MEWIN - 2024-06-26 - Fixed shadowing warning. TranslateNonUniformDecoration(builder.getAccessChain().coherentFlags)); builder.clearAccessChain(); if (node->getOp() == glslang::EOpPreIncrement || node->getOp() == glslang::EOpPreDecrement) - builder.setAccessChainRValue(result); + builder.setAccessChainRValue(opResult); // @MEWIN - 2024-06-26 - Fixed shadowing warning. else builder.setAccessChainRValue(operand); } @@ -3663,11 +3665,11 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt spv::Id typeId = builder.getContainedTypeId(builder.getTypeId(operands[0])); assert(builder.isCooperativeMatrixType(typeId)); // do the op - spv::Id result = node->getOp() == glslang::EOpCooperativeMatrixLoad + spv::Id opResult = node->getOp() == glslang::EOpCooperativeMatrixLoad // @MEWIN - 2024-06-26 - Fixed shadowing warning. ? builder.createOp(spv::OpCooperativeMatrixLoadKHR, typeId, idImmOps) : builder.createOp(spv::OpCooperativeMatrixLoadNV, typeId, idImmOps); // store the result to the pointer (out param 'm') - builder.createStore(result, operands[0]); + builder.createStore(opResult, operands[0]); // @MEWIN - 2024-06-26 - Fixed shadowing warning. result = 0; } else if (node->getOp() == glslang::EOpCooperativeMatrixStore || node->getOp() == glslang::EOpCooperativeMatrixStoreNV) { @@ -3701,9 +3703,9 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt spv::Op spvOp = spv::OpRayQueryGetIntersectionTriangleVertexPositionsKHR; - spv::Id result = builder.createOp(spvOp, typeId, idImmOps); + spv::Id opResult = builder.createOp(spvOp, typeId, idImmOps); // @MEWIN - 2024-06-26 - Fixed shadowing warning. // store the result to the pointer (out param 'm') - builder.createStore(result, operands[2]); + builder.createStore(opResult, operands[2]); // @MEWIN - 2024-06-26 - Fixed shadowing warning. result = 0; } else if (node->getOp() == glslang::EOpCooperativeMatrixMulAdd) { uint32_t matrixOperands = 0; @@ -4877,8 +4879,10 @@ void TGlslangToSpvTraverser::decorateStructType(const glslang::TType& type, // Add memory decorations only to top-level members of shader storage block std::vector memory; TranslateMemoryDecoration(memberQualifier, memory, glslangIntermediate->usingVulkanMemoryModel()); - for (unsigned int i = 0; i < memory.size(); ++i) - builder.addMemberDecoration(spvType, member, memory[i]); + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + for (unsigned int j = 0; i < memory.size(); ++j) + builder.addMemberDecoration(spvType, member, memory[j]); + // END @MEWIN } // Location assignment was already completed correctly by the front end, @@ -5992,13 +5996,15 @@ spv::Id TGlslangToSpvTraverser::createImageTextureFunctionCall(glslang::TIntermO builder.addDecoration(pointer, spv::DecorationNonUniformEXT); } - std::vector operands; - operands.push_back(pointer); + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + std::vector opOperands; + opOperands.push_back(pointer); for (; opIt != arguments.end(); ++opIt) - operands.push_back(*opIt); + opOperands.push_back(*opIt); - return createAtomicOperation(node->getOp(), precision, resultType(), operands, typeProxy, + return createAtomicOperation(node->getOp(), precision, resultType(), opOperands, typeProxy, lvalueCoherentFlags); + // END @MEWIN } } @@ -8023,8 +8029,10 @@ spv::Id TGlslangToSpvTraverser::createInvocationsOperation(glslang::TOperator op } for (auto opIt = operands.begin(); opIt != operands.end(); ++opIt) { - spv::IdImmediate op = { true, *opIt }; - spvGroupOperands.push_back(op); + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + spv::IdImmediate opImmediate = { true, *opIt }; + spvGroupOperands.push_back(opImmediate); + // END @MEWIN } switch (op) { @@ -9375,24 +9383,24 @@ spv::Id TGlslangToSpvTraverser::createNoArgOperation(glslang::TOperator op, spv: { builder.addExtension(spv::E_SPV_EXT_shader_tile_image); - spv::Decoration precision; + spv::Decoration precisionDec; // @MEWIN - 2024-06-26 - Fixed shadowing warning. spv::Op spv_op; if (op == glslang::EOpStencilAttachmentReadEXT) { - precision = spv::DecorationRelaxedPrecision; + precisionDec = spv::DecorationRelaxedPrecision; // @MEWIN - 2024-06-26 - Fixed shadowing warning. spv_op = spv::OpStencilAttachmentReadEXT; builder.addCapability(spv::CapabilityTileImageStencilReadAccessEXT); } else { - precision = spv::NoPrecision; + precisionDec = spv::NoPrecision; // @MEWIN - 2024-06-26 - Fixed shadowing warning. spv_op = spv::OpDepthAttachmentReadEXT; builder.addCapability(spv::CapabilityTileImageDepthReadAccessEXT); } std::vector args; // Dummy args spv::Id result = builder.createOp(spv_op, typeId, args); - return builder.setPrecision(result, precision); + return builder.setPrecision(result, precisionDec); // @MEWIN - 2024-06-26 - Fixed shadowing warning. } default: break; @@ -9425,9 +9433,11 @@ spv::Id TGlslangToSpvTraverser::getSymbolId(const glslang::TIntermSymbol* symbol builtIn == spv::BuiltInWorldToObjectKHR; if (mayNeedToReuseBuiltIn) { - auto iter = builtInVariableIds.find(uint32_t(builtIn)); - if (builtInVariableIds.end() != iter) { - id = iter->second; + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + auto iterBuiltin = builtInVariableIds.find(uint32_t(builtIn)); + if (builtInVariableIds.end() != iterBuiltin) { + id = iterBuiltin->second; + // END @MEWIN symbolValues[symbol->getId()] = id; if (forcedType.second != spv::NoType) forceType[id] = forcedType.second; diff --git a/SPIRV/SPVRemapper.cpp b/SPIRV/SPVRemapper.cpp index f8f50a95..053ce784 100644 --- a/SPIRV/SPVRemapper.cpp +++ b/SPIRV/SPVRemapper.cpp @@ -312,14 +312,16 @@ namespace spv { literal.reserve(16); do { - spirword_t word = *pos; + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + spirword_t posWord = *pos; for (int i = 0; i < 4; i++) { - char c = word & 0xff; + char c = posWord & 0xff; if (c == '\0') return literal; literal += c; - word >>= 8; + posWord >>= 8; } + // END @MEWIN pos++; } while (true); } diff --git a/SPIRV/SpvBuilder.cpp b/SPIRV/SpvBuilder.cpp index d42f7288..8f0e2524 100644 --- a/SPIRV/SpvBuilder.cpp +++ b/SPIRV/SpvBuilder.cpp @@ -873,7 +873,7 @@ Id Builder::makeIntegerDebugType(int const width, bool const hasSign) type = groupedDebugTypes[NonSemanticShaderDebugInfo100DebugTypeBasic][t]; if (type->getIdOperand(0) == nameId && type->getIdOperand(1) == static_cast(width) && - type->getIdOperand(2) == (hasSign ? NonSemanticShaderDebugInfo100Signed : NonSemanticShaderDebugInfo100Unsigned)) + type->getIdOperand(2) == static_cast(hasSign ? NonSemanticShaderDebugInfo100Signed : NonSemanticShaderDebugInfo100Unsigned)) // @MEWIN - 2024-06-26 - Fixed comparison warning. return type->getResultId(); } @@ -1156,7 +1156,7 @@ Id Builder::createDebugLocalVariable(Id type, char const*const name, size_t cons inst->addIdOperand(currentDebugScopeId.top()); // scope id inst->addIdOperand(makeUintConstant(NonSemanticShaderDebugInfo100FlagIsLocal)); // flags id if(argNumber != 0) { - inst->addIdOperand(makeUintConstant(argNumber)); + inst->addIdOperand(makeUintConstant(static_cast(argNumber))); // @MEWIN - 2024-06-26 - Fixed cast warning. } constantsTypesGlobals.push_back(std::unique_ptr(inst)); @@ -1945,7 +1945,7 @@ void Builder::addDecoration(Id id, Decoration decoration, const std::vector(dec)); } -void Builder::addDecoration(Id id, Decoration decoration, const std::vector& strings) +void Builder::addDecoration(Id id, Decoration decoration, const std::vector& stringOps) // @MEWIN - 2024-06-26 - Fixed shadowing warning. { if (decoration == spv::DecorationMax) return; @@ -1953,8 +1953,10 @@ void Builder::addDecoration(Id id, Decoration decoration, const std::vectoraddIdOperand(id); dec->addImmediateOperand(decoration); - for (auto string : strings) - dec->addStringOperand(string); + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + for (auto stringOp : stringOps) + dec->addStringOperand(stringOp); + // END @MEWIN decorations.push_back(std::unique_ptr(dec)); } @@ -2041,7 +2043,7 @@ void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decorat decorations.push_back(std::unique_ptr(dec)); } -void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decoration, const std::vector& strings) +void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decoration, const std::vector& stringOps) // @MEWIN - 2024-06-26 - Fixed shadowing warning. { if (decoration == spv::DecorationMax) return; @@ -2050,8 +2052,10 @@ void Builder::addMemberDecoration(Id id, unsigned int member, Decoration decorat dec->addIdOperand(id); dec->addImmediateOperand(member); dec->addImmediateOperand(decoration); - for (auto string : strings) - dec->addStringOperand(string); + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + for (auto stringOp : stringOps) + dec->addStringOperand(stringOp); + // END @MEWIN decorations.push_back(std::unique_ptr(dec)); } @@ -2064,7 +2068,7 @@ Function* Builder::makeEntryPoint(const char* entryPoint) Block* entry; std::vector paramsTypes; std::vector paramNames; - std::vector> decorations; + std::vector> decos; // @MEWIN - 2024-06-26 - Fixed shadowing warning. auto const returnType = makeVoidType(); @@ -2073,7 +2077,7 @@ Function* Builder::makeEntryPoint(const char* entryPoint) emitNonSemanticShaderDebugInfo = false; } - entryPointFunction = makeFunctionEntry(NoPrecision, returnType, entryPoint, LinkageTypeMax, paramsTypes, paramNames, decorations, &entry); + entryPointFunction = makeFunctionEntry(NoPrecision, returnType, entryPoint, LinkageTypeMax, paramsTypes, paramNames, decos, &entry); // @MEWIN - 2024-06-26 - Fixed shadowing warning. emitNonSemanticShaderDebugInfo = restoreNonSemanticShaderDebugInfo; @@ -2083,7 +2087,7 @@ Function* Builder::makeEntryPoint(const char* entryPoint) // Comments in header Function* Builder::makeFunctionEntry(Decoration precision, Id returnType, const char* name, LinkageType linkType, const std::vector& paramTypes, const std::vector& paramNames, - const std::vector>& decorations, Block **entry) + const std::vector>& decos, Block **entry) // @MEWIN - 2024-06-26 - Fixed shadowing warning. { // Make the function and initial instructions in it Id typeId = makeFunctionType(returnType, paramTypes); @@ -2094,10 +2098,12 @@ Function* Builder::makeFunctionEntry(Decoration precision, Id returnType, const // Set up the precisions setPrecision(function->getId(), precision); function->setReturnPrecision(precision); - for (unsigned p = 0; p < (unsigned)decorations.size(); ++p) { - for (int d = 0; d < (int)decorations[p].size(); ++d) { - addDecoration(firstParamId + p, decorations[p][d]); - function->addParamPrecision(p, decorations[p][d]); + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + for (unsigned p = 0; p < (unsigned)decos.size(); ++p) { + for (int d = 0; d < (int)decos[p].size(); ++d) { + addDecoration(firstParamId + p, decos[p][d]); + function->addParamPrecision(p, decos[p][d]); + // END @MEWIN } } @@ -2135,9 +2141,9 @@ Function* Builder::makeFunctionEntry(Decoration precision, Id returnType, const }; auto const& paramName = paramNames[p]; auto const debugLocalVariableId = createDebugLocalVariable(debugId[getParamTypeId(paramTypes[p])], paramName, p+1); - debugId[firstParamId + p] = debugLocalVariableId; + debugId[static_cast(firstParamId + p)] = debugLocalVariableId; // @MEWIN - 2024-06-26 - Fixed cast warning. - makeDebugDeclare(debugLocalVariableId, firstParamId + p); + makeDebugDeclare(debugLocalVariableId, static_cast(firstParamId + p)); // @MEWIN - 2024-06-26 - Fixed cast warning. } } diff --git a/SPIRV/SpvPostProcess.cpp b/SPIRV/SpvPostProcess.cpp index 4da9561e..48b14f1f 100644 --- a/SPIRV/SpvPostProcess.cpp +++ b/SPIRV/SpvPostProcess.cpp @@ -246,9 +246,11 @@ void Builder::postProcess(Instruction& inst) // (set via Builder::AccessChain::alignment) only accounts for the base of // the reference type and any scalar component selection in the accesschain, // and this function computes the rest from the SPIR-V Offset decorations. - Instruction *accessChain = module.getInstruction(inst.getIdOperand(0)); - if (accessChain->getOpCode() == OpAccessChain) { - Instruction *base = module.getInstruction(accessChain->getIdOperand(0)); + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + Instruction *accChain = module.getInstruction(inst.getIdOperand(0)); + if (accChain->getOpCode() == OpAccessChain) { + Instruction *base = module.getInstruction(accChain->getIdOperand(0)); + // END @MEWIN // Get the type of the base of the access chain. It must be a pointer type. Id typeId = base->getTypeId(); Instruction *type = module.getInstruction(typeId); @@ -264,8 +266,10 @@ void Builder::postProcess(Instruction& inst) // Offset/ArrayStride/MatrixStride decorations, and bitwise OR them all // together. int alignment = 0; - for (int i = 1; i < accessChain->getNumOperands(); ++i) { - Instruction *idx = module.getInstruction(accessChain->getIdOperand(i)); + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + for (int i = 1; i < accChain->getNumOperands(); ++i) { + Instruction *idx = module.getInstruction(accChain->getIdOperand(i)); + // END @MEWIN if (type->getOpCode() == OpTypeStruct) { assert(idx->getOpCode() == OpConstant); unsigned int c = idx->getImmediateOperand(0); diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp index 5aaa96bb..ac56fbd3 100644 --- a/glslang/MachineIndependent/Intermediate.cpp +++ b/glslang/MachineIndependent/Intermediate.cpp @@ -2772,7 +2772,7 @@ bool TIntermediate::postProcess(TIntermNode* root, EShLanguage /*language*/) return true; } -void TIntermediate::addSymbolLinkageNodes(TIntermAggregate*& linkage, EShLanguage language, TSymbolTable& symbolTable) +void TIntermediate::addSymbolLinkageNodes(TIntermAggregate*& linkage, EShLanguage linkLanguage, TSymbolTable& symbolTable) // @MEWIN - 2024-06-26 - Fixed shadowing warning. { // Add top-level nodes for declarations that must be checked cross // compilation unit by a linker, yet might not have been referenced @@ -2795,7 +2795,7 @@ void TIntermediate::addSymbolLinkageNodes(TIntermAggregate*& linkage, EShLanguag // addSymbolLinkageNode(root, symbolTable, "gl_ModelViewProjectionMatrix"); //} - if (language == EShLangVertex) { + if (linkLanguage == EShLangVertex) { // @MEWIN - 2024-06-26 - Fixed shadowing warning. // the names won't be found in the symbol table unless the versions are right, // so version logic does not need to be repeated here addSymbolLinkageNode(linkage, symbolTable, "gl_VertexID"); diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 2cb7e0a1..265f0ad1 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -190,10 +190,10 @@ void TParseContext::setLimits(const TBuiltInResource& r) // // Returns true for successful acceptance of the shader, false if any errors. // -bool TParseContext::parseShaderStrings(TPpContext& ppContext, TInputScanner& input, bool versionWillBeError) +bool TParseContext::parseShaderStrings(TPpContext& ppCtx, TInputScanner& input, bool versionWillBeError) // @MEWIN - 2024-06-26 - Fixed shadowing warning. { currentScanner = &input; - ppContext.setInput(input, versionWillBeError); + ppCtx.setInput(input, versionWillBeError); // @MEWIN - 2024-06-26 - Fixed shadowing warning. yyparse(this); finish(); @@ -4918,17 +4918,19 @@ TSymbol* TParseContext::redeclareBuiltinVariable(const TSourceLoc& loc, const TS // Either redeclare the requested block, or give an error message why it can't be done. // // TODO: functionality: explicitly sizing members of redeclared blocks is not giving them an explicit size -void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newTypeList, const TString& blockName, +void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newTypeList, const TString& blkName, // @MEWIN - 2024-06-26 - Fixed shadowing warning. const TString* instanceName, TArraySizes* arraySizes) { const char* feature = "built-in block redeclaration"; profileRequires(loc, EEsProfile, 320, Num_AEP_shader_io_blocks, AEP_shader_io_blocks, feature); profileRequires(loc, ~EEsProfile, 410, E_GL_ARB_separate_shader_objects, feature); - if (blockName != "gl_PerVertex" && blockName != "gl_PerFragment" && - blockName != "gl_MeshPerVertexNV" && blockName != "gl_MeshPerPrimitiveNV" && - blockName != "gl_MeshPerVertexEXT" && blockName != "gl_MeshPerPrimitiveEXT") { - error(loc, "cannot redeclare block: ", "block declaration", blockName.c_str()); + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + if (blkName != "gl_PerVertex" && blkName != "gl_PerFragment" && + blkName != "gl_MeshPerVertexNV" && blkName != "gl_MeshPerPrimitiveNV" && + blkName != "gl_MeshPerVertexEXT" && blkName != "gl_MeshPerPrimitiveEXT") { + error(loc, "cannot redeclare block: ", "block declaration", blkName.c_str()); + // END @MEWIN return; } @@ -4958,7 +4960,7 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT // Built-in blocks cannot be redeclared more than once, which if happened, // we'd be finding the already redeclared one here, rather than the built in. if (! builtIn) { - error(loc, "can only redeclare a built-in block once, and before any use", blockName.c_str(), ""); + error(loc, "can only redeclare a built-in block once, and before any use", blkName.c_str(), ""); // @MEWIN - 2024-06-26 - Fixed shadowing warning. return; } @@ -5101,10 +5103,10 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT } if (numOriginalMembersFound < newTypeList.size()) - error(loc, "block redeclaration has extra members", blockName.c_str(), ""); + error(loc, "block redeclaration has extra members", blkName.c_str(), ""); // @MEWIN - 2024-06-26 - Fixed shadowing warning. if (type.isArray() != (arraySizes != nullptr) || (type.isArray() && arraySizes != nullptr && type.getArraySizes()->getNumDims() != arraySizes->getNumDims())) - error(loc, "cannot change arrayness of redeclared block", blockName.c_str(), ""); + error(loc, "cannot change arrayness of redeclared block", blkName.c_str(), ""); // @MEWIN - 2024-06-26 - Fixed shadowing warning. else if (type.isArray()) { // At this point, we know both are arrays and both have the same number of dimensions. @@ -5119,7 +5121,7 @@ void TParseContext::redeclareBuiltinBlock(const TSourceLoc& loc, TTypeList& newT // Now, they must match in all dimensions. if (type.isSizedArray() && *type.getArraySizes() != *arraySizes) - error(loc, "cannot change array size of redeclared block", blockName.c_str(), ""); + error(loc, "cannot change array size of redeclared block", blkName.c_str(), ""); // @MEWIN - 2024-06-26 - Fixed shadowing warning. } symbolTable.insert(*block); @@ -5521,7 +5523,7 @@ void TParseContext::finish() // This is before we know any type information for error checking. void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publicType, TString& id) { - std::transform(id.begin(), id.end(), id.begin(), ::tolower); + std::transform(id.begin(), id.end(), id.begin(), [](char chr) { return static_cast(::tolower(chr));} ); // @MEWIN - 2024-06-26 - Fixed conversion warning. if (id == TQualifier::getLayoutMatrixString(ElmColumnMajor)) { publicType.qualifier.layoutMatrix = ElmColumnMajor; @@ -5884,18 +5886,18 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi return; } - std::transform(id.begin(), id.end(), id.begin(), ::tolower); + std::transform(id.begin(), id.end(), id.begin(), [](char chr) { return static_cast(::tolower(chr));} ); // @MEWIN - 2024-06-26 - Fixed conversion warning. if (id == "offset") { // "offset" can be for either // - uniform offsets // - atomic_uint offsets - const char* feature = "offset"; + const char* fture = "offset"; // @MEWIN - 2024-06-26 - Fixed shadowing warning. if (spvVersion.spv == 0) { - requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, feature); + requireProfile(loc, EEsProfile | ECoreProfile | ECompatibilityProfile, fture); // @MEWIN - 2024-06-26 - Fixed shadowing warning. const char* exts[2] = { E_GL_ARB_enhanced_layouts, E_GL_ARB_shader_atomic_counters }; - profileRequires(loc, ECoreProfile | ECompatibilityProfile, 420, 2, exts, feature); - profileRequires(loc, EEsProfile, 310, nullptr, feature); + profileRequires(loc, ECoreProfile | ECompatibilityProfile, 420, 2, exts, fture); // @MEWIN - 2024-06-26 - Fixed shadowing warning. + profileRequires(loc, EEsProfile, 310, nullptr, fture); // @MEWIN - 2024-06-26 - Fixed shadowing warning. } publicType.qualifier.layoutOffset = value; publicType.qualifier.explicitOffset = true; @@ -5903,10 +5905,10 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi error(loc, "needs a literal integer", "offset", ""); return; } else if (id == "align") { - const char* feature = "uniform buffer-member align"; + const char* fture = "uniform buffer-member align"; // @MEWIN - 2024-06-26 - Fixed shadowing warning. if (spvVersion.spv == 0) { - requireProfile(loc, ECoreProfile | ECompatibilityProfile, feature); - profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, feature); + requireProfile(loc, ECoreProfile | ECompatibilityProfile, fture); // @MEWIN - 2024-06-26 - Fixed shadowing warning. + profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, fture); // @MEWIN - 2024-06-26 - Fixed shadowing warning. } // "The specified alignment must be a power of 2, or a compile-time error results." if (! IsPow2(value)) @@ -5998,10 +6000,12 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi // capturing mode and hence responsible for describing the transform feedback // setup." intermediate.setXfbMode(); - const char* feature = "transform feedback qualifier"; - requireStage(loc, (EShLanguageMask)(EShLangVertexMask | EShLangGeometryMask | EShLangTessControlMask | EShLangTessEvaluationMask), feature); - requireProfile(loc, ECoreProfile | ECompatibilityProfile, feature); - profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, feature); + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + const char* fture = "transform feedback qualifier"; + requireStage(loc, (EShLanguageMask)(EShLangVertexMask | EShLangGeometryMask | EShLangTessControlMask | EShLangTessEvaluationMask), fture); + requireProfile(loc, ECoreProfile | ECompatibilityProfile, fture); + profileRequires(loc, ECoreProfile | ECompatibilityProfile, 440, E_GL_ARB_enhanced_layouts, fture); + // END @MEWIN if (id == "xfb_buffer") { // "It is a compile-time error to specify an *xfb_buffer* that is greater than // the implementation-dependent constant gl_MaxTransformFeedbackBuffers." @@ -8089,7 +8093,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T case EOpConstructUVec2: if (node->getType().getBasicType() == EbtReference) { requireExtensions(loc, 1, &E_GL_EXT_buffer_reference_uvec2, "reference conversion to uvec2"); - TIntermTyped* newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvPtrToUvec2, true, node, + newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvPtrToUvec2, true, node, // @MEWIN - 2024-06-26 - Fixed shadowing warning. type); return newNode; } else if (node->getType().getBasicType() == EbtSampler) { @@ -8099,7 +8103,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T TIntermTyped* newSrcNode = intermediate.createConversion(EbtUint, node); newSrcNode->getAsTyped()->getWritableType().setVectorSize(2); - TIntermTyped* newNode = + newNode = // @MEWIN - 2024-06-26 - Fixed shadowing warning. intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConstructUVec2, false, newSrcNode, type); return newNode; } @@ -8121,7 +8125,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T node->getType().getVectorSize() == 2) { requireExtensions(loc, 1, &E_GL_ARB_bindless_texture, "ivec2/uvec2 convert to texture handle"); // No matter ivec2 or uvec2, Set EOpPackUint2x32 just to generate an opBitcast op code - TIntermTyped* newNode = + newNode = // @MEWIN - 2024-06-26 - Fixed shadowing warning. intermediate.addBuiltInFunctionCall(node->getLoc(), EOpPackUint2x32, true, node, type); return newNode; } @@ -8275,7 +8279,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T case EOpConstructUint64: if (type.isScalar() && node->getType().isReference()) { - TIntermTyped* newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvPtrToUint64, true, node, type); + newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvPtrToUint64, true, node, type); // @MEWIN - 2024-06-26 - Fixed shadowing warning. return newNode; } // fall through @@ -8297,14 +8301,14 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T return newNode; // construct reference from uint64 } else if (node->getType().isScalar() && node->getType().getBasicType() == EbtUint64) { - TIntermTyped* newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvUint64ToPtr, true, node, + newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvUint64ToPtr, true, node, // @MEWIN - 2024-06-26 - Fixed shadowing warning. type); return newNode; // construct reference from uvec2 } else if (node->getType().isVector() && node->getType().getBasicType() == EbtUint && node->getVectorSize() == 2) { requireExtensions(loc, 1, &E_GL_EXT_buffer_reference_uvec2, "uvec2 conversion to reference"); - TIntermTyped* newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvUvec2ToPtr, true, node, + newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvUvec2ToPtr, true, node, // @MEWIN - 2024-06-26 - Fixed shadowing warning. type); return newNode; } else { @@ -8324,32 +8328,36 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T } node = intermediate.setAggregateOperator(node, op, type, node->getLoc()); } else { - TOperator op = EOpNull; + TOperator nodeOp = EOpNull; // @MEWIN - 2024-06-26 - Fixed shadowing warning. switch (type.getBasicType()) { default: assert(0); break; case EbtInt: switch (node->getType().getBasicType()) { - case EbtFloat: op = EOpConvFloatToInt; break; - case EbtFloat16: op = EOpConvFloat16ToInt; break; - case EbtUint8: op = EOpConvUint8ToInt; break; - case EbtInt8: op = EOpConvInt8ToInt; break; - case EbtUint16: op = EOpConvUint16ToInt; break; - case EbtInt16: op = EOpConvInt16ToInt; break; - case EbtUint: op = EOpConvUintToInt; break; + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + case EbtFloat: nodeOp = EOpConvFloatToInt; break; + case EbtFloat16: nodeOp = EOpConvFloat16ToInt; break; + case EbtUint8: nodeOp = EOpConvUint8ToInt; break; + case EbtInt8: nodeOp = EOpConvInt8ToInt; break; + case EbtUint16: nodeOp = EOpConvUint16ToInt; break; + case EbtInt16: nodeOp = EOpConvInt16ToInt; break; + case EbtUint: nodeOp = EOpConvUintToInt; break; + // END @MEWIN default: assert(0); } break; case EbtUint: switch (node->getType().getBasicType()) { - case EbtFloat: op = EOpConvFloatToUint; break; - case EbtFloat16: op = EOpConvFloat16ToUint; break; - case EbtUint8: op = EOpConvUint8ToUint; break; - case EbtInt8: op = EOpConvInt8ToUint; break; - case EbtUint16: op = EOpConvUint16ToUint; break; - case EbtInt16: op = EOpConvInt16ToUint; break; - case EbtInt: op = EOpConvIntToUint; break; + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + case EbtFloat: nodeOp = EOpConvFloatToUint; break; + case EbtFloat16: nodeOp = EOpConvFloat16ToUint; break; + case EbtUint8: nodeOp = EOpConvUint8ToUint; break; + case EbtInt8: nodeOp = EOpConvInt8ToUint; break; + case EbtUint16: nodeOp = EOpConvUint16ToUint; break; + case EbtInt16: nodeOp = EOpConvInt16ToUint; break; + case EbtInt: nodeOp = EOpConvIntToUint; break; + // END @MEWIN default: assert(0); } break; @@ -8367,61 +8375,71 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T break; case EbtUint16: switch (node->getType().getBasicType()) { - case EbtFloat: op = EOpConvFloatToUint16; break; - case EbtFloat16: op = EOpConvFloat16ToUint16; break; - case EbtUint8: op = EOpConvUint8ToUint16; break; - case EbtInt8: op = EOpConvInt8ToUint16; break; - case EbtInt16: op = EOpConvInt16ToUint16; break; - case EbtInt: op = EOpConvIntToUint16; break; - case EbtUint: op = EOpConvUintToUint16; break; + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + case EbtFloat: nodeOp = EOpConvFloatToUint16; break; + case EbtFloat16: nodeOp = EOpConvFloat16ToUint16; break; + case EbtUint8: nodeOp = EOpConvUint8ToUint16; break; + case EbtInt8: nodeOp = EOpConvInt8ToUint16; break; + case EbtInt16: nodeOp = EOpConvInt16ToUint16; break; + case EbtInt: nodeOp = EOpConvIntToUint16; break; + case EbtUint: nodeOp = EOpConvUintToUint16; break; + // END @MEWIN default: assert(0); } break; case EbtInt8: switch (node->getType().getBasicType()) { - case EbtFloat: op = EOpConvFloatToInt8; break; - case EbtFloat16: op = EOpConvFloat16ToInt8; break; - case EbtUint8: op = EOpConvUint8ToInt8; break; - case EbtInt16: op = EOpConvInt16ToInt8; break; - case EbtUint16: op = EOpConvUint16ToInt8; break; - case EbtInt: op = EOpConvIntToInt8; break; - case EbtUint: op = EOpConvUintToInt8; break; + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + case EbtFloat: nodeOp = EOpConvFloatToInt8; break; + case EbtFloat16: nodeOp = EOpConvFloat16ToInt8; break; + case EbtUint8: nodeOp = EOpConvUint8ToInt8; break; + case EbtInt16: nodeOp = EOpConvInt16ToInt8; break; + case EbtUint16: nodeOp = EOpConvUint16ToInt8; break; + case EbtInt: nodeOp = EOpConvIntToInt8; break; + case EbtUint: nodeOp = EOpConvUintToInt8; break; + // END @MEWIN default: assert(0); } break; case EbtUint8: switch (node->getType().getBasicType()) { - case EbtFloat: op = EOpConvFloatToUint8; break; - case EbtFloat16: op = EOpConvFloat16ToUint8; break; - case EbtInt8: op = EOpConvInt8ToUint8; break; - case EbtInt16: op = EOpConvInt16ToUint8; break; - case EbtUint16: op = EOpConvUint16ToUint8; break; - case EbtInt: op = EOpConvIntToUint8; break; - case EbtUint: op = EOpConvUintToUint8; break; + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + case EbtFloat: nodeOp = EOpConvFloatToUint8; break; + case EbtFloat16: nodeOp = EOpConvFloat16ToUint8; break; + case EbtInt8: nodeOp = EOpConvInt8ToUint8; break; + case EbtInt16: nodeOp = EOpConvInt16ToUint8; break; + case EbtUint16: nodeOp = EOpConvUint16ToUint8; break; + case EbtInt: nodeOp = EOpConvIntToUint8; break; + case EbtUint: nodeOp = EOpConvUintToUint8; break; + // END @MEWIN default: assert(0); } break; case EbtFloat: switch (node->getType().getBasicType()) { - case EbtFloat16: op = EOpConvFloat16ToFloat; break; - case EbtInt8: op = EOpConvInt8ToFloat; break; - case EbtUint8: op = EOpConvUint8ToFloat; break; - case EbtInt16: op = EOpConvInt16ToFloat; break; - case EbtUint16: op = EOpConvUint16ToFloat; break; - case EbtInt: op = EOpConvIntToFloat; break; - case EbtUint: op = EOpConvUintToFloat; break; + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + case EbtFloat16: nodeOp = EOpConvFloat16ToFloat; break; + case EbtInt8: nodeOp = EOpConvInt8ToFloat; break; + case EbtUint8: nodeOp = EOpConvUint8ToFloat; break; + case EbtInt16: nodeOp = EOpConvInt16ToFloat; break; + case EbtUint16: nodeOp = EOpConvUint16ToFloat; break; + case EbtInt: nodeOp = EOpConvIntToFloat; break; + case EbtUint: nodeOp = EOpConvUintToFloat; break; + // END @MEWIN default: assert(0); } break; case EbtFloat16: switch (node->getType().getBasicType()) { - case EbtFloat: op = EOpConvFloatToFloat16; break; - case EbtInt8: op = EOpConvInt8ToFloat16; break; - case EbtUint8: op = EOpConvUint8ToFloat16; break; - case EbtInt16: op = EOpConvInt16ToFloat16; break; - case EbtUint16: op = EOpConvUint16ToFloat16; break; - case EbtInt: op = EOpConvIntToFloat16; break; - case EbtUint: op = EOpConvUintToFloat16; break; + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + case EbtFloat: nodeOp = EOpConvFloatToFloat16; break; + case EbtInt8: nodeOp = EOpConvInt8ToFloat16; break; + case EbtUint8: nodeOp = EOpConvUint8ToFloat16; break; + case EbtInt16: nodeOp = EOpConvInt16ToFloat16; break; + case EbtUint16: nodeOp = EOpConvUint16ToFloat16; break; + case EbtInt: nodeOp = EOpConvIntToFloat16; break; + case EbtUint: nodeOp = EOpConvUintToFloat16; break; + // END @MEWIN default: assert(0); } break; @@ -9730,10 +9748,12 @@ const TTypeList* TParseContext::recordStructCopy(TStructRecord& record, const TT size_t originHash = 0, tmpHash = 0; std::hash hasher; for (size_t i = 0; i < memberCount; i++) { - size_t originMemberHash = hasher(originType->getStruct()->at(i).type->getQualifier().layoutPacking + - originType->getStruct()->at(i).type->getQualifier().layoutMatrix); - size_t tmpMemberHash = hasher(tmpType->getStruct()->at(i).type->getQualifier().layoutPacking + - tmpType->getStruct()->at(i).type->getQualifier().layoutMatrix); + // BEGIN @MEWIN - 2024-06-26 - Fixed cast warnings. + size_t originMemberHash = hasher(static_cast(originType->getStruct()->at(i).type->getQualifier().layoutPacking) + + static_cast(originType->getStruct()->at(i).type->getQualifier().layoutMatrix)); + size_t tmpMemberHash = hasher(static_cast(tmpType->getStruct()->at(i).type->getQualifier().layoutPacking) + + static_cast(tmpType->getStruct()->at(i).type->getQualifier().layoutMatrix)); + // END @MEWIN originHash = hasher((originHash ^ originMemberHash) << 1); tmpHash = hasher((tmpHash ^ tmpMemberHash) << 1); } diff --git a/glslang/MachineIndependent/ParseHelper.h b/glslang/MachineIndependent/ParseHelper.h index 05ebca27..946c31e5 100644 --- a/glslang/MachineIndependent/ParseHelper.h +++ b/glslang/MachineIndependent/ParseHelper.h @@ -136,10 +136,10 @@ public: virtual bool parseShaderStrings(TPpContext&, TInputScanner& input, bool versionWillBeError = false) = 0; - virtual void notifyVersion(int line, int version, const char* type_string) + virtual void notifyVersion(int line, int vers, const char* type_string) // @MEWIN - 2024-06-26 - Fixed shadowing warning. { if (versionCallback) - versionCallback(line, version, type_string); + versionCallback(line, vers, type_string); // @MEWIN - 2024-06-26 - Fixed shadowing warning. } virtual void notifyErrorDirective(int line, const char* error_message) { diff --git a/glslang/MachineIndependent/Scan.cpp b/glslang/MachineIndependent/Scan.cpp index 5c7e2e66..77f0b580 100644 --- a/glslang/MachineIndependent/Scan.cpp +++ b/glslang/MachineIndependent/Scan.cpp @@ -825,15 +825,17 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token) { do { parserToken = &token; - TPpToken ppToken; - int token = pp->tokenize(ppToken); - if (token == EndOfInput) + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + TPpToken ppTkn; + int tkn = pp->tokenize(ppTkn); + if (tkn == EndOfInput) return 0; - tokenText = ppToken.name; - loc = ppToken.loc; + tokenText = ppTkn.name; + loc = ppTkn.loc; parserToken->sType.lex.loc = loc; - switch (token) { + switch (tkn) { + // END @MEWIN case ';': afterType = false; afterBuffer = false; return SEMICOLON; case ',': afterType = false; return COMMA; case ':': return COLON; @@ -894,27 +896,29 @@ int TScanContext::tokenize(TPpContext* pp, TParserToken& token) break; case PpAtomConstString: parserToken->sType.lex.string = NewPoolTString(tokenText); return STRING_LITERAL; - case PpAtomConstInt: parserToken->sType.lex.i = ppToken.ival; return INTCONSTANT; - case PpAtomConstUint: parserToken->sType.lex.i = ppToken.ival; return UINTCONSTANT; - case PpAtomConstFloat: parserToken->sType.lex.d = ppToken.dval; return FLOATCONSTANT; - case PpAtomConstInt16: parserToken->sType.lex.i = ppToken.ival; return INT16CONSTANT; - case PpAtomConstUint16: parserToken->sType.lex.i = ppToken.ival; return UINT16CONSTANT; - case PpAtomConstInt64: parserToken->sType.lex.i64 = ppToken.i64val; return INT64CONSTANT; - case PpAtomConstUint64: parserToken->sType.lex.i64 = ppToken.i64val; return UINT64CONSTANT; - case PpAtomConstDouble: parserToken->sType.lex.d = ppToken.dval; return DOUBLECONSTANT; - case PpAtomConstFloat16: parserToken->sType.lex.d = ppToken.dval; return FLOAT16CONSTANT; + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + case PpAtomConstInt: parserToken->sType.lex.i = ppTkn.ival; return INTCONSTANT; + case PpAtomConstUint: parserToken->sType.lex.i = ppTkn.ival; return UINTCONSTANT; + case PpAtomConstFloat: parserToken->sType.lex.d = ppTkn.dval; return FLOATCONSTANT; + case PpAtomConstInt16: parserToken->sType.lex.i = ppTkn.ival; return INT16CONSTANT; + case PpAtomConstUint16: parserToken->sType.lex.i = ppTkn.ival; return UINT16CONSTANT; + case PpAtomConstInt64: parserToken->sType.lex.i64 = ppTkn.i64val; return INT64CONSTANT; + case PpAtomConstUint64: parserToken->sType.lex.i64 = ppTkn.i64val; return UINT64CONSTANT; + case PpAtomConstDouble: parserToken->sType.lex.d = ppTkn.dval; return DOUBLECONSTANT; + case PpAtomConstFloat16: parserToken->sType.lex.d = ppTkn.dval; return FLOAT16CONSTANT; case PpAtomIdentifier: { - int token = tokenizeIdentifier(); + int tkn2 = tokenizeIdentifier(); field = false; - return token; + return tkn2; } + // END @MEWIN case EndOfInput: return 0; default: char buf[2]; - buf[0] = (char)token; + buf[0] = (char)tkn; // @MEWIN - 2024-06-26 - Fixed shadowing warning. buf[1] = 0; parseContext.error(loc, "unexpected token", buf, ""); break; diff --git a/glslang/MachineIndependent/SymbolTable.h b/glslang/MachineIndependent/SymbolTable.h index 94c3929d..07d48367 100644 --- a/glslang/MachineIndependent/SymbolTable.h +++ b/glslang/MachineIndependent/SymbolTable.h @@ -273,9 +273,9 @@ public: // Install 'this' as the first parameter. // 'this' is reflected in the list of parameters, but not the mangled name. - virtual void addThisParameter(TType& type, const char* name) + virtual void addThisParameter(TType& type, const char* paramName) // @MEWIN - 2024-06-26 - Fixed shadowing warning. { - TParameter p = { NewPoolTString(name), new TType, nullptr }; + TParameter p = { NewPoolTString(paramName), new TType, nullptr }; // @MEWIN - 2024-06-26 - Fixed shadowing warning. p.type->shallowCopy(type); parameters.insert(parameters.begin(), p); } diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index bede7160..eb567811 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -1377,9 +1377,9 @@ void TParseVersions::requireSpv(const TSourceLoc& loc, const char* op) if (spvVersion.spv == 0) error(loc, "only allowed when generating SPIR-V", op, ""); } -void TParseVersions::requireSpv(const TSourceLoc& loc, const char *op, unsigned int version) +void TParseVersions::requireSpv(const TSourceLoc& loc, const char *op, unsigned int vers) // @MEWIN - 2024-06-26 - Fixed shadowing warning. { - if (spvVersion.spv < version) + if (spvVersion.spv < vers) // @MEWIN - 2024-06-26 - Fixed shadowing warning. error(loc, "not supported for current targeted SPIR-V version", op, ""); } diff --git a/glslang/MachineIndependent/attribute.cpp b/glslang/MachineIndependent/attribute.cpp index a167c494..45e4cb20 100644 --- a/glslang/MachineIndependent/attribute.cpp +++ b/glslang/MachineIndependent/attribute.cpp @@ -66,7 +66,7 @@ bool TAttributeArgs::getString(TString& value, int argNum, bool convertToLower) // Convenience. if (convertToLower) - std::transform(value.begin(), value.end(), value.begin(), ::tolower); + std::transform(value.begin(), value.end(), value.begin(), [](char chr) { return static_cast(::tolower(chr));} ); // @MEWIN - 2024-06-26 - Fixed conversion warning. return true; } diff --git a/glslang/MachineIndependent/iomapper.cpp b/glslang/MachineIndependent/iomapper.cpp index 89292cfd..d90b343a 100644 --- a/glslang/MachineIndependent/iomapper.cpp +++ b/glslang/MachineIndependent/iomapper.cpp @@ -219,7 +219,7 @@ struct TResolverUniformAdaptor { } if (ent.symbol->getQualifier().hasBinding()) { - for (uint32_t idx = EShLangVertex; idx < EShLangCount; ++idx) { + for (int32_t idx = EShLangVertex; idx < EShLangCount; ++idx) { // @MEWIN - 2024-06-26 - Fixed sign comparison warning. if (idx == ent.stage || uniformVarMap[idx] == nullptr) continue; auto entKey2 = uniformVarMap[idx]->find(entKey.first); @@ -237,7 +237,7 @@ struct TResolverUniformAdaptor { error = true; } if (ent.symbol->getQualifier().hasSet()) { - for (uint32_t idx = EShLangVertex; idx < EShLangCount; ++idx) { + for (int32_t idx = EShLangVertex; idx < EShLangCount; ++idx) { // @MEWIN - 2024-06-26 - Fixed sign comparison warning. if ((idx == stage) || (uniformVarMap[idx] == nullptr)) continue; auto entKey2 = uniformVarMap[idx]->find(entKey.first); @@ -313,10 +313,10 @@ private: struct TSymbolValidater { - TSymbolValidater(TIoMapResolver& r, TInfoSink& i, TVarLiveMap* in[EShLangCount], TVarLiveMap* out[EShLangCount], + TSymbolValidater(TIoMapResolver& r, TInfoSink& iSink, TVarLiveMap* in[EShLangCount], TVarLiveMap* out[EShLangCount], // @MEWIN - 2024-06-26 - Fixed shadowing warning. TVarLiveMap* uniform[EShLangCount], bool& hadError, EProfile profile, int version) : resolver(r) - , infoSink(i) + , infoSink(iSink) // @MEWIN - 2024-06-26 - Fixed shadowing warning. , hadError(hadError) , profile(profile) , version(version) @@ -511,17 +511,17 @@ struct TSymbolValidater if (type1.getBasicType() == EbtBlock && type1.isStruct() && !type2.isStruct()) { // Iterate through block members tracking layout - glslang::TString name; - type1.getStruct()->begin()->type->appendMangledName(name); - if (name == mangleName2 + glslang::TString typeName; // @MEWIN - 2024-06-26 - Fixed shadowing warning. + type1.getStruct()->begin()->type->appendMangledName(typeName); // @MEWIN - 2024-06-26 - Fixed shadowing warning. + if (typeName == mangleName2 && type1.getQualifier().layoutLocation == type2.getQualifier().layoutLocation) return; } if (type2.getBasicType() == EbtBlock && type2.isStruct() && !type1.isStruct()) { // Iterate through block members tracking layout - glslang::TString name; - type2.getStruct()->begin()->type->appendMangledName(name); - if (name == mangleName1 + glslang::TString typeName; // @MEWIN - 2024-06-26 - Fixed shadowing warning. + type2.getStruct()->begin()->type->appendMangledName(typeName); // @MEWIN - 2024-06-26 - Fixed shadowing warning. + if (typeName == mangleName1 // @MEWIN - 2024-06-26 - Fixed shadowing warning. && type1.getQualifier().layoutLocation == type2.getQualifier().layoutLocation) return; } TString err = "Invalid In/Out variable type : " + entKey.first; diff --git a/glslang/MachineIndependent/limits.cpp b/glslang/MachineIndependent/limits.cpp index 4404beca..8443b240 100644 --- a/glslang/MachineIndependent/limits.cpp +++ b/glslang/MachineIndependent/limits.cpp @@ -129,9 +129,9 @@ bool TInductiveTraverser::visitAggregate(TVisit /* visit */, TIntermAggregate* n // // External function to call for loop check. // -void TParseContext::inductiveLoopBodyCheck(TIntermNode* body, long long loopId, TSymbolTable& symbolTable) +void TParseContext::inductiveLoopBodyCheck(TIntermNode* body, long long loopId, TSymbolTable& symbolTbl) // @MEWIN - 2024-06-26 - Fixed shadowing warning. { - TInductiveTraverser it(loopId, symbolTable); + TInductiveTraverser it(loopId, symbolTbl); // @MEWIN - 2024-06-26 - Fixed shadowing warning. if (body == nullptr) return; diff --git a/glslang/MachineIndependent/reflection.cpp b/glslang/MachineIndependent/reflection.cpp index a029d3cb..1ca03b97 100644 --- a/glslang/MachineIndependent/reflection.cpp +++ b/glslang/MachineIndependent/reflection.cpp @@ -1203,13 +1203,15 @@ bool TReflection::addStage(EShLanguage stage, const TIntermediate& intermediate) TReflectionTraverser it(intermediate, *this); - for (auto& sequnence : intermediate.getTreeRoot()->getAsAggregate()->getSequence()) { - if (sequnence->getAsAggregate() != nullptr) { - if (sequnence->getAsAggregate()->getOp() == glslang::EOpLinkerObjects) { + // BEGIN @MEWIN - 2024-06-26 - Fixed shadowing warning. + for (auto& sequenceA : intermediate.getTreeRoot()->getAsAggregate()->getSequence()) { + if (sequenceA->getAsAggregate() != nullptr) { + if (sequenceA->getAsAggregate()->getOp() == glslang::EOpLinkerObjects) { it.updateStageMasks = false; - TIntermAggregate* linkerObjects = sequnence->getAsAggregate(); - for (auto& sequnence : linkerObjects->getSequence()) { - auto pNode = sequnence->getAsSymbolNode(); + TIntermAggregate* linkerObjects = sequenceA->getAsAggregate(); + for (auto& sequenceB : linkerObjects->getSequence()) { + auto pNode = sequenceB->getAsSymbolNode(); + // END @MEWIN if (pNode != nullptr) { if ((pNode->getQualifier().storage == EvqUniform && (options & EShReflectionSharedStd140UBO)) || @@ -1239,7 +1241,7 @@ bool TReflection::addStage(EShLanguage stage, const TIntermediate& intermediate) // When linke message not been set EShMsgKeepUncalled, linker won't keep uncalled function in AST. // So, travers all function node can equivalent to travers live function. it.updateStageMasks = true; - sequnence->getAsAggregate()->traverse(&it); + sequenceA->getAsAggregate()->traverse(&it); // @MEWIN - 2024-06-26 - Fixed shadowing warning. } } }