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:
Arcady Goldmints-Orlov 2024-02-19 18:42:55 -05:00 committed by arcady-lunarg
parent 8ca24e7cf1
commit 606209e07d
9 changed files with 22 additions and 21 deletions

View file

@ -8126,7 +8126,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
symbolTable.setFunctionExtensions("texture2DArrayLod", 1, &E_GL_EXT_texture_array);
symbolTable.setFunctionExtensions("shadow1DArrayLod", 1, &E_GL_EXT_texture_array);
}
// Fall through
[[fallthrough]];
case EShLangTessControl:
if (profile == EEsProfile && version >= 310) {
@ -8141,7 +8141,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_BoundingBox", EbvBoundingBox, symbolTable);
}
}
// Fall through
[[fallthrough]];
case EShLangTessEvaluation:
case EShLangGeometry:
@ -10231,7 +10231,8 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
if (profile != EEsProfile && version >= 460) {
symbolTable.relateToOperator("fetchMicroTriangleVertexPositionNV", EOpFetchMicroTriangleVertexPositionNV);
symbolTable.relateToOperator("fetchMicroTriangleVertexBarycentricNV", EOpFetchMicroTriangleVertexBarycentricNV);
} // fallthrough
}
[[fallthrough]];
case EShLangClosestHit:
case EShLangMiss:
if (profile != EEsProfile && version >= 460) {

View file

@ -3533,7 +3533,7 @@ bool TIntermediate::promoteBinary(TIntermBinary& node)
if (left->getType() == right->getType())
return true;
// Fall through
[[fallthrough]];
case EOpMul:
case EOpMulAssign:
@ -3682,7 +3682,7 @@ bool TIntermediate::promoteBinary(TIntermBinary& node)
case EOpAssign:
if (left->getVectorSize() != right->getVectorSize() || left->getMatrixCols() != right->getMatrixCols() || left->getMatrixRows() != right->getMatrixRows())
return false;
// fall through
[[fallthrough]];
case EOpAdd:
case EOpSub:

View file

@ -6260,7 +6260,7 @@ void TParseContext::setLayoutQualifier(const TSourceLoc& loc, TPublicType& publi
error(loc, "needs a literal integer", "max_primitives", "");
return;
}
// Fall through
[[fallthrough]];
case EShLangTask:
// 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);
return newNode;
}
// fall through
[[fallthrough]];
case EOpConstructU64Vec2:
case EOpConstructU64Vec3:
case EOpConstructU64Vec4:
@ -9674,7 +9674,7 @@ void TParseContext::updateStandaloneQualifierDefaults(const TSourceLoc& loc, con
error(loc, "cannot apply to 'out'", TQualifier::getGeometryString(publicType.shaderQualifiers.geometry), "");
break;
}
// Fall through
[[fallthrough]];
case ElgPoints:
case ElgLineStrip:
case ElgTriangleStrip:

View file

@ -766,7 +766,7 @@ void TParseVersions::profileRequires(const TSourceLoc& loc, int profileMask, int
switch (getExtensionBehavior(extensions[i])) {
case EBhWarn:
infoSink.info.message(EPrefixWarning, ("extension " + TString(extensions[i]) + " is being used for " + featureDesc).c_str(), loc);
// fall through
[[fallthrough]];
case EBhRequire:
case EBhEnable:
okay = true;

View file

@ -1587,7 +1587,7 @@ void TIntermediate::output(TInfoSink& infoSink, bool tree)
infoSink.debug << "max_vertices = " << vertices << "\n";
infoSink.debug << "max_primitives = " << primitives << "\n";
infoSink.debug << "output primitive = " << TQualifier::getGeometryString(outputPrimitive) << "\n";
// Fall through
[[fallthrough]];
case EShLangTask:
// Fall through
case EShLangCompute:

View file

@ -1350,7 +1350,7 @@ void TIntermediate::finalCheck(TInfoSink& infoSink, bool keepUncalled)
error(infoSink, "At least one shader must specify a layout(max_vertices = value)");
if (primitives == TQualifier::layoutNotSet)
error(infoSink, "At least one shader must specify a layout(max_primitives = value)");
// fall through
[[fallthrough]];
case EShLangTask:
if (numTaskNVBlocks > 1)
error(infoSink, "Only one taskNV interface block is allowed per shader");