diff --git a/SPIRV/SpvPostProcess.cpp b/SPIRV/SpvPostProcess.cpp index b185f61b..d6319d92 100644 --- a/SPIRV/SpvPostProcess.cpp +++ b/SPIRV/SpvPostProcess.cpp @@ -181,6 +181,7 @@ void Builder::postProcessType(const Instruction& inst, Id typeId) else if (width == 8) addCapability(CapabilityInt8); } + [[fallthrough]]; // @MEWIN - 2022-12-07 - Added this to get rid of implicit-fallthrough warning. default: if (basicTypeOp == OpTypeInt) { if (width == 16) diff --git a/SPIRV/doc.h b/SPIRV/doc.h index 7e155995..3729a9ed 100644 --- a/SPIRV/doc.h +++ b/SPIRV/doc.h @@ -239,8 +239,8 @@ public: OperandParameters operands; protected: - int typePresent : 1; - int resultPresent : 1; + unsigned typePresent : 1; // @MEWIN - 2022-12-07 - Changed to unsigned to get rid of -Woverflow warnings. + unsigned resultPresent : 1; // @MEWIN - 2022-12-07 - Changed to unsigned to get rid of -Woverflow warnings. }; // The set of objects that hold all the instruction/operand diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index 53078ec7..5b88a19b 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -150,17 +150,17 @@ EProfile EDesktopProfile = static_cast(ENoProfile | ECoreProfile | ECo #else const Versioning Es300Desktop130Version[] = { { EEsProfile, 0, 300, 0, nullptr }, { EDesktopProfile, 0, 130, 0, nullptr }, - { EBadProfile } }; + { EBadProfile, 0, 0, 0, nullptr } }; // @MEWIN - 2022-12-07 - Added missing initializers. const Versioning* Es300Desktop130 = &Es300Desktop130Version[0]; const Versioning Es310Desktop420Version[] = { { EEsProfile, 0, 310, 0, nullptr }, { EDesktopProfile, 0, 420, 0, nullptr }, - { EBadProfile } }; + { EBadProfile, 0, 0, 0, nullptr } }; // @MEWIN - 2022-12-07 - Added missing initializers. const Versioning* Es310Desktop420 = &Es310Desktop420Version[0]; const Versioning Es310Desktop450Version[] = { { EEsProfile, 0, 310, 0, nullptr }, { EDesktopProfile, 0, 450, 0, nullptr }, - { EBadProfile } }; + { EBadProfile, 0, 0, 0, nullptr } }; // @MEWIN - 2022-12-07 - Added missing initializers. const Versioning* Es310Desktop450 = &Es310Desktop450Version[0]; #endif @@ -269,14 +269,14 @@ const BuiltInFunction BaseFunctions[] = { { EOpMix, "mix", 3, TypeIU, ClassLB, Es310Desktop450 }, #endif - { EOpNull } + { EOpNull, nullptr, 0, TypeB, ClassRegular, nullptr } // @MEWIN - 2022-12-08 - Added missing initializers. }; const BuiltInFunction DerivativeFunctions[] = { { EOpDPdx, "dFdx", 1, TypeF, ClassRegular, nullptr }, { EOpDPdy, "dFdy", 1, TypeF, ClassRegular, nullptr }, { EOpFwidth, "fwidth", 1, TypeF, ClassRegular, nullptr }, - { EOpNull } + { EOpNull, nullptr, 0, TypeB, ClassRegular, nullptr } // @MEWIN - 2022-12-08 - Added missing initializers. }; // For functions declared some other way, but still use the table to relate to operator. @@ -330,7 +330,7 @@ const CustomFunction CustomFunctions[] = { { EOpTextureProjGrad, "textureProjGrad", nullptr }, { EOpTextureProjGradOffset, "textureProjGradOffset", nullptr }, - { EOpNull } + { EOpNull, nullptr, nullptr } // @MEWIN - 2022-12-08 - Added missing initializers. }; // For the given table of functions, add all the indicated prototypes for each diff --git a/glslang/MachineIndependent/Intermediate.cpp b/glslang/MachineIndependent/Intermediate.cpp index e542f90c..7cce3e9a 100644 --- a/glslang/MachineIndependent/Intermediate.cpp +++ b/glslang/MachineIndependent/Intermediate.cpp @@ -1297,6 +1297,7 @@ void TIntermediate::addBiShapeConversion(TOperator op, TIntermTyped*& lhsNode, T // matrix multiply does not change shapes if (lhsNode->isMatrix() && rhsNode->isMatrix()) return; + [[fallthrough]]; // @MEWIN - 2022-12-08 - Added fallthrough to fix compiler warnings. case EOpAdd: case EOpSub: case EOpDiv: diff --git a/glslang/MachineIndependent/ParseHelper.cpp b/glslang/MachineIndependent/ParseHelper.cpp index 99f5533f..3b293da8 100644 --- a/glslang/MachineIndependent/ParseHelper.cpp +++ b/glslang/MachineIndependent/ParseHelper.cpp @@ -7173,7 +7173,7 @@ TIntermTyped* TParseContext::vkRelaxedRemapFunctionCall(const TSourceLoc& loc, T realFunc.addParameter(TParameter().copyParam((*function)[i])); } - TParameter tmpP = { nullptr, &uintType }; + TParameter tmpP = { nullptr, &uintType, nullptr }; // @MEWIN - 2022-12-08 - Added missing initializer. realFunc.addParameter(TParameter().copyParam(tmpP)); arguments = intermediate.growAggregate(arguments, intermediate.addConstantUnion(1, loc, true)); @@ -7190,7 +7190,7 @@ TIntermTyped* TParseContext::vkRelaxedRemapFunctionCall(const TSourceLoc& loc, T realFunc.addParameter(TParameter().copyParam((*function)[i])); } - TParameter tmpP = { nullptr, &uintType }; + TParameter tmpP = { nullptr, &uintType, nullptr }; // @MEWIN - 2022-12-08 - Added missing initializer. realFunc.addParameter(TParameter().copyParam(tmpP)); arguments = intermediate.growAggregate(arguments, intermediate.addConstantUnion(-1, loc, true)); @@ -7989,6 +7989,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConstructUVec2, false, newSrcNode, type); return newNode; } + [[fallthrough]]; // @MEWIN - 2022-12-08 - Added fallthrough. case EOpConstructUVec3: case EOpConstructUVec4: case EOpConstructUint: @@ -8010,6 +8011,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T intermediate.addBuiltInFunctionCall(node->getLoc(), EOpPackUint2x32, true, node, type); return newNode; } + [[fallthrough]]; // @MEWIN - 2022-12-08 - Added fallthrough. #ifndef GLSLANG_WEB case EOpConstructDVec2: diff --git a/glslang/MachineIndependent/SymbolTable.cpp b/glslang/MachineIndependent/SymbolTable.cpp index 57b868a2..b852f3d6 100644 --- a/glslang/MachineIndependent/SymbolTable.cpp +++ b/glslang/MachineIndependent/SymbolTable.cpp @@ -173,7 +173,7 @@ void TType::buildMangledName(TString& mangledName) const if (arraySizes->getDimNode(i)->getAsSymbolNode()) snprintf(buf, maxSize, "s%lld", arraySizes->getDimNode(i)->getAsSymbolNode()->getId()); else - snprintf(buf, maxSize, "s%p", arraySizes->getDimNode(i)); + snprintf(buf, maxSize, "s%p", static_cast(arraySizes->getDimNode(i))); // @MEWIN - 2022-12-08 - Added cast to void* to fix warning about wrong format. } else snprintf(buf, maxSize, "%d", arraySizes->getDimSize(i)); mangledName += '['; diff --git a/glslang/MachineIndependent/iomapper.h b/glslang/MachineIndependent/iomapper.h index 0003a74e..4b15d472 100644 --- a/glslang/MachineIndependent/iomapper.h +++ b/glslang/MachineIndependent/iomapper.h @@ -51,16 +51,16 @@ class TInfoSink; namespace glslang { class TIntermediate; -struct TVarEntryInfo { - long long id; - TIntermSymbol* symbol; - bool live; - int newBinding; - int newSet; - int newLocation; - int newComponent; - int newIndex; - EShLanguage stage; +struct TVarEntryInfo { // @MEWIN - 2022-12-08 - Added initializers to fix compiler warnings. + long long id = 0; + TIntermSymbol* symbol = nullptr; + bool live = false; + int newBinding = 0; + int newSet = 0; + int newLocation = 0; + int newComponent = 0; + int newIndex = 0; + EShLanguage stage = EShLangVertex; void clearNewAssignments() { newBinding = -1; diff --git a/glslang/MachineIndependent/reflection.cpp b/glslang/MachineIndependent/reflection.cpp index 144f85bd..161246ef 100644 --- a/glslang/MachineIndependent/reflection.cpp +++ b/glslang/MachineIndependent/reflection.cpp @@ -709,6 +709,7 @@ public: switch ((int)sampler.shadow) { case false: return sampler.arrayed ? GL_SAMPLER_1D_ARRAY : GL_SAMPLER_1D; case true: return sampler.arrayed ? GL_SAMPLER_1D_ARRAY_SHADOW : GL_SAMPLER_1D_SHADOW; + default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } case Esd2D: switch ((int)sampler.ms) { @@ -716,8 +717,10 @@ public: switch ((int)sampler.shadow) { case false: return sampler.arrayed ? GL_SAMPLER_2D_ARRAY : GL_SAMPLER_2D; case true: return sampler.arrayed ? GL_SAMPLER_2D_ARRAY_SHADOW : GL_SAMPLER_2D_SHADOW; + default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } case true: return sampler.arrayed ? GL_SAMPLER_2D_MULTISAMPLE_ARRAY : GL_SAMPLER_2D_MULTISAMPLE; + default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } case Esd3D: return GL_SAMPLER_3D; @@ -725,11 +728,13 @@ public: switch ((int)sampler.shadow) { case false: return sampler.arrayed ? GL_SAMPLER_CUBE_MAP_ARRAY : GL_SAMPLER_CUBE; case true: return sampler.arrayed ? GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW : GL_SAMPLER_CUBE_SHADOW; + default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } case EsdRect: return sampler.shadow ? GL_SAMPLER_2D_RECT_SHADOW : GL_SAMPLER_2D_RECT; case EsdBuffer: return GL_SAMPLER_BUFFER; + default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } case EbtFloat16: switch ((int)sampler.dim) { @@ -737,6 +742,7 @@ public: switch ((int)sampler.shadow) { case false: return sampler.arrayed ? GL_FLOAT16_SAMPLER_1D_ARRAY_AMD : GL_FLOAT16_SAMPLER_1D_AMD; case true: return sampler.arrayed ? GL_FLOAT16_SAMPLER_1D_ARRAY_SHADOW_AMD : GL_FLOAT16_SAMPLER_1D_SHADOW_AMD; + default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } case Esd2D: switch ((int)sampler.ms) { @@ -744,8 +750,10 @@ public: switch ((int)sampler.shadow) { case false: return sampler.arrayed ? GL_FLOAT16_SAMPLER_2D_ARRAY_AMD : GL_FLOAT16_SAMPLER_2D_AMD; case true: return sampler.arrayed ? GL_FLOAT16_SAMPLER_2D_ARRAY_SHADOW_AMD : GL_FLOAT16_SAMPLER_2D_SHADOW_AMD; + default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } case true: return sampler.arrayed ? GL_FLOAT16_SAMPLER_2D_MULTISAMPLE_ARRAY_AMD : GL_FLOAT16_SAMPLER_2D_MULTISAMPLE_AMD; + default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } case Esd3D: return GL_FLOAT16_SAMPLER_3D_AMD; @@ -753,11 +761,13 @@ public: switch ((int)sampler.shadow) { case false: return sampler.arrayed ? GL_FLOAT16_SAMPLER_CUBE_MAP_ARRAY_AMD : GL_FLOAT16_SAMPLER_CUBE_AMD; case true: return sampler.arrayed ? GL_FLOAT16_SAMPLER_CUBE_MAP_ARRAY_SHADOW_AMD : GL_FLOAT16_SAMPLER_CUBE_SHADOW_AMD; + default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } case EsdRect: return sampler.shadow ? GL_FLOAT16_SAMPLER_2D_RECT_SHADOW_AMD : GL_FLOAT16_SAMPLER_2D_RECT_AMD; case EsdBuffer: return GL_FLOAT16_SAMPLER_BUFFER_AMD; + default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } case EbtInt: switch ((int)sampler.dim) { @@ -768,6 +778,7 @@ public: case false: return sampler.arrayed ? GL_INT_SAMPLER_2D_ARRAY : GL_INT_SAMPLER_2D; case true: return sampler.arrayed ? GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY : GL_INT_SAMPLER_2D_MULTISAMPLE; + default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } case Esd3D: return GL_INT_SAMPLER_3D; @@ -777,6 +788,7 @@ public: return GL_INT_SAMPLER_2D_RECT; case EsdBuffer: return GL_INT_SAMPLER_BUFFER; + default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } case EbtUint: switch ((int)sampler.dim) { @@ -787,6 +799,7 @@ public: case false: return sampler.arrayed ? GL_UNSIGNED_INT_SAMPLER_2D_ARRAY : GL_UNSIGNED_INT_SAMPLER_2D; case true: return sampler.arrayed ? GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY : GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE; + default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } case Esd3D: return GL_UNSIGNED_INT_SAMPLER_3D; @@ -796,6 +809,7 @@ public: return GL_UNSIGNED_INT_SAMPLER_2D_RECT; case EsdBuffer: return GL_UNSIGNED_INT_SAMPLER_BUFFER; + default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } default: return 0; @@ -811,6 +825,7 @@ public: switch ((int)sampler.ms) { case false: return sampler.arrayed ? GL_IMAGE_2D_ARRAY : GL_IMAGE_2D; case true: return sampler.arrayed ? GL_IMAGE_2D_MULTISAMPLE_ARRAY : GL_IMAGE_2D_MULTISAMPLE; + default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } case Esd3D: return GL_IMAGE_3D; @@ -820,6 +835,8 @@ public: return GL_IMAGE_2D_RECT; case EsdBuffer: return GL_IMAGE_BUFFER; + default: + return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } case EbtFloat16: switch ((int)sampler.dim) { @@ -829,6 +846,7 @@ public: switch ((int)sampler.ms) { case false: return sampler.arrayed ? GL_FLOAT16_IMAGE_2D_ARRAY_AMD : GL_FLOAT16_IMAGE_2D_AMD; case true: return sampler.arrayed ? GL_FLOAT16_IMAGE_2D_MULTISAMPLE_ARRAY_AMD : GL_FLOAT16_IMAGE_2D_MULTISAMPLE_AMD; + default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } case Esd3D: return GL_FLOAT16_IMAGE_3D_AMD; @@ -838,6 +856,8 @@ public: return GL_FLOAT16_IMAGE_2D_RECT_AMD; case EsdBuffer: return GL_FLOAT16_IMAGE_BUFFER_AMD; + default: + return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } case EbtInt: switch ((int)sampler.dim) { @@ -847,6 +867,7 @@ public: switch ((int)sampler.ms) { case false: return sampler.arrayed ? GL_INT_IMAGE_2D_ARRAY : GL_INT_IMAGE_2D; case true: return sampler.arrayed ? GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY : GL_INT_IMAGE_2D_MULTISAMPLE; + default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } case Esd3D: return GL_INT_IMAGE_3D; @@ -856,6 +877,8 @@ public: return GL_INT_IMAGE_2D_RECT; case EsdBuffer: return GL_INT_IMAGE_BUFFER; + default: + return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } case EbtUint: switch ((int)sampler.dim) { @@ -866,6 +889,7 @@ public: case false: return sampler.arrayed ? GL_UNSIGNED_INT_IMAGE_2D_ARRAY : GL_UNSIGNED_INT_IMAGE_2D; case true: return sampler.arrayed ? GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY : GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE; + default: return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } case Esd3D: return GL_UNSIGNED_INT_IMAGE_3D; @@ -875,6 +899,8 @@ public: return GL_UNSIGNED_INT_IMAGE_2D_RECT; case EsdBuffer: return GL_UNSIGNED_INT_IMAGE_BUFFER; + default: + return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } default: return 0; @@ -939,6 +965,8 @@ public: case 4: return GL_FLOAT_MAT4; default: return 0; } + default: + return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } case EbtDouble: switch (type.getMatrixCols()) { @@ -963,6 +991,8 @@ public: case 4: return GL_DOUBLE_MAT4; default: return 0; } + default: + return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } case EbtFloat16: switch (type.getMatrixCols()) { @@ -987,6 +1017,8 @@ public: case 4: return GL_FLOAT16_MAT4_AMD; default: return 0; } + default: + return 0; // @MEWIN - 2022-12-08 - Added default case to fix compiler warnings. } default: return 0;