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-expr.cpp | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'source/slang/slang-check-expr.cpp') diff --git a/source/slang/slang-check-expr.cpp b/source/slang/slang-check-expr.cpp index 7a2c78c71..dd0cd4eab 100644 --- a/source/slang/slang-check-expr.cpp +++ b/source/slang/slang-check-expr.cpp @@ -933,7 +933,7 @@ namespace Slang return type; } } - if (auto witness = as(tryGetInterfaceConformanceWitness(type, builder->getDifferentiableInterface()))) + if (const auto witness = as(tryGetInterfaceConformanceWitness(type, builder->getDifferentiableInterface()))) { auto diffTypeLookupResult = lookUpMember( getASTBuilder(), @@ -1128,7 +1128,7 @@ namespace Slang { binding->type = type; - if (auto body = binding->body) + if (const auto body = binding->body) { binding = as(binding->body); SLANG_ASSERT(binding); @@ -1158,7 +1158,7 @@ namespace Slang { // TODO: we may want other cases here... - if (auto errorType = as(expr->type)) + if (const auto errorType = as(expr->type)) return true; return false; @@ -2637,7 +2637,7 @@ namespace Slang // if( auto declRefType = as(typeExp.type) ) { - if(auto structDeclRef = as(declRefType->declRef)) + if(const auto structDeclRef = as(declRefType->declRef)) { if( expr->arguments.getCount() == 1 ) { @@ -3056,7 +3056,6 @@ namespace Slang int elementIndices[4]; int elementCount = 0; - bool elementUsed[4] = { false, false, false, false }; bool anyDuplicates = false; bool anyError = false; if (memberRefExpr->name == getSession()->getCompletionRequestTokenName()) @@ -3444,7 +3443,7 @@ namespace Slang { return _lookupStaticMember(expr, expr->baseExpression); } - else if(auto typeType = as(baseType)) + else if(const auto typeType = as(baseType)) { return _lookupStaticMember(expr, expr->baseExpression); } @@ -3507,11 +3506,11 @@ namespace Slang { auto containerDecl = scope->containerDecl; - if( auto ctorDecl = as(containerDecl) ) + if( const auto ctorDecl = as(containerDecl) ) { expr->type.isLeftValue = true; } - else if( auto setterDecl = as(containerDecl) ) + else if( const auto setterDecl = as(containerDecl) ) { expr->type.isLeftValue = true; } @@ -3655,18 +3654,18 @@ namespace Slang { SLANG_UNUSED(type); - if( auto unormModifier = as(modifier) ) + if( const auto unormModifier = as(modifier) ) { // TODO: validate that `type` is either `float` or a vector of `float`s return m_astBuilder->getUNormModifierVal(); } - else if( auto snormModifier = as(modifier) ) + else if( const auto snormModifier = as(modifier) ) { // TODO: validate that `type` is either `float` or a vector of `float`s return m_astBuilder->getSNormModifierVal(); } - else if (auto noDiffModifier = as(modifier)) + else if (const auto noDiffModifier = as(modifier)) { return m_astBuilder->getNoDiffModifierVal(); } -- cgit v1.2.3