From 3acbe8145c60f4d1e7a180b4602a94269a489df5 Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Thu, 27 Apr 2023 12:36:59 +0800 Subject: Fix most of the disabled warnings on gcc/clang (#2839) --- source/slang/slang-check-decl.cpp | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'source/slang/slang-check-decl.cpp') diff --git a/source/slang/slang-check-decl.cpp b/source/slang/slang-check-decl.cpp index b3470e882..bbbbaae2f 100644 --- a/source/slang/slang-check-decl.cpp +++ b/source/slang/slang-check-decl.cpp @@ -1106,7 +1106,7 @@ namespace Slang void SemanticsDeclHeaderVisitor::checkExtensionExternVarAttribute(VarDeclBase* varDecl, ExtensionExternVarModifier* extensionExternMemberModifier) { - if (auto parentExtension = as(varDecl->parentDecl)) + if (const auto parentExtension = as(varDecl->parentDecl)) { if (auto originalVarDecl = extensionExternMemberModifier->originalDecl.as()) { @@ -1275,7 +1275,7 @@ namespace Slang } } - if (auto interfaceDecl = as(varDecl->parentDecl)) + if (const auto interfaceDecl = as(varDecl->parentDecl)) { if (auto basicType = as(varDecl->getType())) { @@ -2339,7 +2339,7 @@ namespace Slang if(auto requiredTypeParamDeclRef = requiredMemberDeclRef.as()) { - auto satisfyingTypeParamDeclRef = satisfyingMemberDeclRef.as(); + [[maybe_unused]] auto satisfyingTypeParamDeclRef = satisfyingMemberDeclRef.as(); SLANG_ASSERT(satisfyingTypeParamDeclRef); // There are no additional checks we need to make on plain old @@ -2349,7 +2349,6 @@ namespace Slang // then this is possibly where we'd want to check that the kinds of // the two parameters match. // - SLANG_UNUSED(satisfyingGenericDeclRef); } else if (auto requiredValueParamDeclRef = requiredMemberDeclRef.as()) { @@ -3961,7 +3960,7 @@ namespace Slang getSink()->diagnose(inheritanceDecl, Diagnostics::interfaceInheritingComMustBeCom); } } - else if (auto structDecl = as(superTypeDecl)) + else if (const auto structDecl = as(superTypeDecl)) { getSink()->diagnose(inheritanceDecl, Diagnostics::structCannotImplementComInterface); } @@ -4042,12 +4041,12 @@ namespace Slang // confirm that the type actually provides whatever // those clauses require. - if (auto interfaceDecl = as(decl)) + if (const auto interfaceDecl = as(decl)) { // Don't check that an interface conforms to the // things it inherits from. } - else if (auto assocTypeDecl = as(decl)) + else if (const auto assocTypeDecl = as(decl)) { // Don't check that an associated type decl conforms to the // things it inherits from. @@ -4165,7 +4164,7 @@ namespace Slang // It is possible that there was an error in checking the base type // expression, and in such a case we shouldn't emit a cascading error. // - if( auto baseErrorType = as(baseType) ) + if( const auto baseErrorType = as(baseType) ) { continue; } @@ -4233,7 +4232,7 @@ namespace Slang // It is possible that there was an error in checking the base type // expression, and in such a case we shouldn't emit a cascading error. // - if( auto baseErrorType = as(baseType) ) + if( const auto baseErrorType = as(baseType) ) { continue; } @@ -4302,7 +4301,7 @@ namespace Slang // It is possible that there was an error in checking the base type // expression, and in such a case we shouldn't emit a cascading error. // - if (auto baseErrorType = as(baseType)) + if (const auto baseErrorType = as(baseType)) { continue; } @@ -4443,7 +4442,7 @@ namespace Slang // It is possible that there was an error in checking the base type // expression, and in such a case we shouldn't emit a cascading error. // - if( auto baseErrorType = as(baseType) ) + if( const auto baseErrorType = as(baseType) ) { continue; } @@ -4756,7 +4755,7 @@ namespace Slang m_parentDifferentiableAttr = oldAttr; } - if (auto body = decl->body) + if (const auto body = decl->body) { checkStmt(decl->body, newContext); } @@ -4821,9 +4820,9 @@ namespace Slang Decl* leftParam = leftParams[pp]; Decl* rightParam = rightParams[pp]; - if (auto leftTypeParam = as(leftParam)) + if (const auto leftTypeParam = as(leftParam)) { - if (auto rightTypeParam = as(rightParam)) + if (const auto rightTypeParam = as(rightParam)) { // Right now any two type parameters are a match. // Names are irrelevant to matching, and any constraints @@ -5828,7 +5827,7 @@ namespace Slang // It is possible that there was an error in checking the base type // expression, and in such a case we shouldn't emit a cascading error. // - if( auto baseErrorType = as(baseType) ) + if( const auto baseErrorType = as(baseType) ) { continue; } -- cgit v1.2.3