Use [[fallthrough]] attribute instead of comments.
Now that we require C++17, the [[fallthrough]] attribute is available as an alternative to load-bearing comments.
This commit is contained in:
parent
8ca24e7cf1
commit
606209e07d
9 changed files with 22 additions and 21 deletions
|
|
@ -3052,7 +3052,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
||||||
case glslang::EOpConstructF16Mat4x3:
|
case glslang::EOpConstructF16Mat4x3:
|
||||||
case glslang::EOpConstructF16Mat4x4:
|
case glslang::EOpConstructF16Mat4x4:
|
||||||
isMatrix = true;
|
isMatrix = true;
|
||||||
// fall through
|
[[fallthrough]];
|
||||||
case glslang::EOpConstructFloat:
|
case glslang::EOpConstructFloat:
|
||||||
case glslang::EOpConstructVec2:
|
case glslang::EOpConstructVec2:
|
||||||
case glslang::EOpConstructVec3:
|
case glslang::EOpConstructVec3:
|
||||||
|
|
@ -3223,7 +3223,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
||||||
|
|
||||||
case glslang::EOpAtomicStore:
|
case glslang::EOpAtomicStore:
|
||||||
noReturnValue = true;
|
noReturnValue = true;
|
||||||
// fallthrough
|
[[fallthrough]];
|
||||||
case glslang::EOpAtomicLoad:
|
case glslang::EOpAtomicLoad:
|
||||||
atomic = true;
|
atomic = true;
|
||||||
break;
|
break;
|
||||||
|
|
@ -3326,7 +3326,7 @@ bool TGlslangToSpvTraverser::visitAggregate(glslang::TVisit visit, glslang::TInt
|
||||||
case glslang::EOpHitObjectRecordHitWithIndexMotionNV:
|
case glslang::EOpHitObjectRecordHitWithIndexMotionNV:
|
||||||
case glslang::EOpReorderThreadNV:
|
case glslang::EOpReorderThreadNV:
|
||||||
noReturnValue = true;
|
noReturnValue = true;
|
||||||
//Fallthrough
|
[[fallthrough]];
|
||||||
case glslang::EOpHitObjectIsEmptyNV:
|
case glslang::EOpHitObjectIsEmptyNV:
|
||||||
case glslang::EOpHitObjectIsMissNV:
|
case glslang::EOpHitObjectIsMissNV:
|
||||||
case glslang::EOpHitObjectIsHitNV:
|
case glslang::EOpHitObjectIsHitNV:
|
||||||
|
|
|
||||||
|
|
@ -360,7 +360,7 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
|
||||||
switch (stream[word]) {
|
switch (stream[word]) {
|
||||||
case 8: idDescriptor[resultId] = "int8_t"; break;
|
case 8: idDescriptor[resultId] = "int8_t"; break;
|
||||||
case 16: idDescriptor[resultId] = "int16_t"; break;
|
case 16: idDescriptor[resultId] = "int16_t"; break;
|
||||||
default: assert(0); // fallthrough
|
default: assert(0); [[fallthrough]];
|
||||||
case 32: idDescriptor[resultId] = "int"; break;
|
case 32: idDescriptor[resultId] = "int"; break;
|
||||||
case 64: idDescriptor[resultId] = "int64_t"; break;
|
case 64: idDescriptor[resultId] = "int64_t"; break;
|
||||||
}
|
}
|
||||||
|
|
@ -368,7 +368,7 @@ void SpirvStream::disassembleInstruction(Id resultId, Id /*typeId*/, Op opCode,
|
||||||
case OpTypeFloat:
|
case OpTypeFloat:
|
||||||
switch (stream[word]) {
|
switch (stream[word]) {
|
||||||
case 16: idDescriptor[resultId] = "float16_t"; break;
|
case 16: idDescriptor[resultId] = "float16_t"; break;
|
||||||
default: assert(0); // fallthrough
|
default: assert(0); [[fallthrough]];
|
||||||
case 32: idDescriptor[resultId] = "float"; break;
|
case 32: idDescriptor[resultId] = "float"; break;
|
||||||
case 64: idDescriptor[resultId] = "float64_t"; break;
|
case 64: idDescriptor[resultId] = "float64_t"; break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -402,7 +402,7 @@ TIntermTyped* HlslParseContext::handleLvalue(const TSourceLoc& loc, const char*
|
||||||
case EOpLeftShiftAssign:
|
case EOpLeftShiftAssign:
|
||||||
case EOpRightShiftAssign:
|
case EOpRightShiftAssign:
|
||||||
isModifyOp = true;
|
isModifyOp = true;
|
||||||
// fall through...
|
[[fallthrough]];
|
||||||
case EOpAssign:
|
case EOpAssign:
|
||||||
{
|
{
|
||||||
// Since this is an lvalue, we'll convert an image load to a sequence like this
|
// Since this is an lvalue, we'll convert an image load to a sequence like this
|
||||||
|
|
@ -4507,13 +4507,13 @@ void HlslParseContext::decomposeSampleMethods(const TSourceLoc& loc, TIntermType
|
||||||
int cmpValues = 0; // 1 if there is a compare value (handier than a bool below)
|
int cmpValues = 0; // 1 if there is a compare value (handier than a bool below)
|
||||||
|
|
||||||
switch (op) {
|
switch (op) {
|
||||||
case EOpMethodGatherCmpRed: cmpValues = 1; // fall through
|
case EOpMethodGatherCmpRed: cmpValues = 1; [[fallthrough]];
|
||||||
case EOpMethodGatherRed: channel = 0; break;
|
case EOpMethodGatherRed: channel = 0; break;
|
||||||
case EOpMethodGatherCmpGreen: cmpValues = 1; // fall through
|
case EOpMethodGatherCmpGreen: cmpValues = 1; [[fallthrough]];
|
||||||
case EOpMethodGatherGreen: channel = 1; break;
|
case EOpMethodGatherGreen: channel = 1; break;
|
||||||
case EOpMethodGatherCmpBlue: cmpValues = 1; // fall through
|
case EOpMethodGatherCmpBlue: cmpValues = 1; [[fallthrough]];
|
||||||
case EOpMethodGatherBlue: channel = 2; break;
|
case EOpMethodGatherBlue: channel = 2; break;
|
||||||
case EOpMethodGatherCmpAlpha: cmpValues = 1; // fall through
|
case EOpMethodGatherCmpAlpha: cmpValues = 1; [[fallthrough]];
|
||||||
case EOpMethodGatherAlpha: channel = 3; break;
|
case EOpMethodGatherAlpha: channel = 3; break;
|
||||||
default: assert(0); break;
|
default: assert(0); break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8126,7 +8126,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||||
symbolTable.setFunctionExtensions("texture2DArrayLod", 1, &E_GL_EXT_texture_array);
|
symbolTable.setFunctionExtensions("texture2DArrayLod", 1, &E_GL_EXT_texture_array);
|
||||||
symbolTable.setFunctionExtensions("shadow1DArrayLod", 1, &E_GL_EXT_texture_array);
|
symbolTable.setFunctionExtensions("shadow1DArrayLod", 1, &E_GL_EXT_texture_array);
|
||||||
}
|
}
|
||||||
// Fall through
|
[[fallthrough]];
|
||||||
|
|
||||||
case EShLangTessControl:
|
case EShLangTessControl:
|
||||||
if (profile == EEsProfile && version >= 310) {
|
if (profile == EEsProfile && version >= 310) {
|
||||||
|
|
@ -8141,7 +8141,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||||
BuiltInVariable("gl_BoundingBox", EbvBoundingBox, symbolTable);
|
BuiltInVariable("gl_BoundingBox", EbvBoundingBox, symbolTable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Fall through
|
[[fallthrough]];
|
||||||
|
|
||||||
case EShLangTessEvaluation:
|
case EShLangTessEvaluation:
|
||||||
case EShLangGeometry:
|
case EShLangGeometry:
|
||||||
|
|
@ -10231,7 +10231,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
|
||||||
if (profile != EEsProfile && version >= 460) {
|
if (profile != EEsProfile && version >= 460) {
|
||||||
symbolTable.relateToOperator("fetchMicroTriangleVertexPositionNV", EOpFetchMicroTriangleVertexPositionNV);
|
symbolTable.relateToOperator("fetchMicroTriangleVertexPositionNV", EOpFetchMicroTriangleVertexPositionNV);
|
||||||
symbolTable.relateToOperator("fetchMicroTriangleVertexBarycentricNV", EOpFetchMicroTriangleVertexBarycentricNV);
|
symbolTable.relateToOperator("fetchMicroTriangleVertexBarycentricNV", EOpFetchMicroTriangleVertexBarycentricNV);
|
||||||
} // fallthrough
|
}
|
||||||
|
[[fallthrough]];
|
||||||
case EShLangClosestHit:
|
case EShLangClosestHit:
|
||||||
case EShLangMiss:
|
case EShLangMiss:
|
||||||
if (profile != EEsProfile && version >= 460) {
|
if (profile != EEsProfile && version >= 460) {
|
||||||
|
|
|
||||||
|
|
@ -3533,7 +3533,7 @@ bool TIntermediate::promoteBinary(TIntermBinary& node)
|
||||||
if (left->getType() == right->getType())
|
if (left->getType() == right->getType())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// Fall through
|
[[fallthrough]];
|
||||||
|
|
||||||
case EOpMul:
|
case EOpMul:
|
||||||
case EOpMulAssign:
|
case EOpMulAssign:
|
||||||
|
|
@ -3682,7 +3682,7 @@ bool TIntermediate::promoteBinary(TIntermBinary& node)
|
||||||
case EOpAssign:
|
case EOpAssign:
|
||||||
if (left->getVectorSize() != right->getVectorSize() || left->getMatrixCols() != right->getMatrixCols() || left->getMatrixRows() != right->getMatrixRows())
|
if (left->getVectorSize() != right->getVectorSize() || left->getMatrixCols() != right->getMatrixCols() || left->getMatrixRows() != right->getMatrixRows())
|
||||||
return false;
|
return false;
|
||||||
// fall through
|
[[fallthrough]];
|
||||||
|
|
||||||
case EOpAdd:
|
case EOpAdd:
|
||||||
case EOpSub:
|
case EOpSub:
|
||||||
|
|
|
||||||
|
|
@ -6260,7 +6260,7 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
|
||||||
error(loc, "needs a literal integer", "max_primitives", "");
|
error(loc, "needs a literal integer", "max_primitives", "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Fall through
|
[[fallthrough]];
|
||||||
|
|
||||||
case EShLangTask:
|
case EShLangTask:
|
||||||
// Fall through
|
// Fall through
|
||||||
|
|
@ -8609,7 +8609,7 @@ TIntermTyped* TParseContext::constructBuiltIn(const TType& type, TOperator op, T
|
||||||
TIntermTyped* newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvPtrToUint64, true, node, type);
|
TIntermTyped* newNode = intermediate.addBuiltInFunctionCall(node->getLoc(), EOpConvPtrToUint64, true, node, type);
|
||||||
return newNode;
|
return newNode;
|
||||||
}
|
}
|
||||||
// fall through
|
[[fallthrough]];
|
||||||
case EOpConstructU64Vec2:
|
case EOpConstructU64Vec2:
|
||||||
case EOpConstructU64Vec3:
|
case EOpConstructU64Vec3:
|
||||||
case EOpConstructU64Vec4:
|
case EOpConstructU64Vec4:
|
||||||
|
|
@ -9674,7 +9674,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
|
||||||
error(loc, "cannot apply to 'out'", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry), "");
|
error(loc, "cannot apply to 'out'", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry), "");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Fall through
|
[[fallthrough]];
|
||||||
case ElgPoints:
|
case ElgPoints:
|
||||||
case ElgLineStrip:
|
case ElgLineStrip:
|
||||||
case ElgTriangleStrip:
|
case ElgTriangleStrip:
|
||||||
|
|
|
||||||
|
|
@ -766,7 +766,7 @@ void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int
|
||||||
switch (getExtensionBehavior(extensions[i])) {
|
switch (getExtensionBehavior(extensions[i])) {
|
||||||
case EBhWarn:
|
case EBhWarn:
|
||||||
infoSink.info.message(EPrefixWarning, ("extension " + TString(extensions[i]) + " is being used for " + featureDesc).c_str(), loc);
|
infoSink.info.message(EPrefixWarning, ("extension " + TString(extensions[i]) + " is being used for " + featureDesc).c_str(), loc);
|
||||||
// fall through
|
[[fallthrough]];
|
||||||
case EBhRequire:
|
case EBhRequire:
|
||||||
case EBhEnable:
|
case EBhEnable:
|
||||||
okay = true;
|
okay = true;
|
||||||
|
|
|
||||||
|
|
@ -1587,7 +1587,7 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree)
|
||||||
infoSink.debug << "max_vertices = " << vertices << "\n";
|
infoSink.debug << "max_vertices = " << vertices << "\n";
|
||||||
infoSink.debug << "max_primitives = " << primitives << "\n";
|
infoSink.debug << "max_primitives = " << primitives << "\n";
|
||||||
infoSink.debug << "output primitive = " << TQualifier::getGeometryString(outputPrimitive) << "\n";
|
infoSink.debug << "output primitive = " << TQualifier::getGeometryString(outputPrimitive) << "\n";
|
||||||
// Fall through
|
[[fallthrough]];
|
||||||
case EShLangTask:
|
case EShLangTask:
|
||||||
// Fall through
|
// Fall through
|
||||||
case EShLangCompute:
|
case EShLangCompute:
|
||||||
|
|
|
||||||
|
|
@ -1350,7 +1350,7 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
|
||||||
error(infoSink, "At least one shader must specify a layout(max_vertices = value)");
|
error(infoSink, "At least one shader must specify a layout(max_vertices = value)");
|
||||||
if (primitives == TQualifier::layoutNotSet)
|
if (primitives == TQualifier::layoutNotSet)
|
||||||
error(infoSink, "At least one shader must specify a layout(max_primitives = value)");
|
error(infoSink, "At least one shader must specify a layout(max_primitives = value)");
|
||||||
// fall through
|
[[fallthrough]];
|
||||||
case EShLangTask:
|
case EShLangTask:
|
||||||
if (numTaskNVBlocks > 1)
|
if (numTaskNVBlocks > 1)
|
||||||
error(infoSink, "Only one taskNV interface block is allowed per shader");
|
error(infoSink, "Only one taskNV interface block is allowed per shader");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue