diff options
| author | Ellie Hermaszewska <ellieh@nvidia.com> | 2023-07-06 03:18:14 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-05 15:18:14 -0400 |
| commit | 6063304cb8d73d430e7ef81c62cd9822302fcc19 (patch) | |
| tree | 8174e0d5acab31ce057db7b73e8f94b09d786a46 | |
| parent | 93948b564d04eda555bf96025e89853be86cff8a (diff) | |
Squash some warnings (#2956)
* restrict -Wno-assume to clang (gcc does not have this warning)
* Add move where possible
Annoyingly this warns for c++17, but will not be necessary with c++20
* Do not partially initialize struct
* Remove unused variable
* Silence unused var warning
It is actually still referenced from an uninstantiated (for now) template
* Use unused var
---------
Co-authored-by: jsmall-nvidia <jsmall@nvidia.com>
| -rw-r--r-- | premake5.lua | 4 | ||||
| -rw-r--r-- | source/compiler-core/slang-source-embed-util.cpp | 2 | ||||
| -rw-r--r-- | source/slang/slang-check-impl.h | 4 | ||||
| -rw-r--r-- | source/slang/slang-ir-autodiff-transpose.h | 4 | ||||
| -rw-r--r-- | source/slang/slang-lower-to-ir.cpp | 3 |
5 files changed, 9 insertions, 8 deletions
diff --git a/premake5.lua b/premake5.lua index 20bb6b364..edcd56b4e 100644 --- a/premake5.lua +++ b/premake5.lua @@ -374,8 +374,10 @@ workspace "slang" } filter { "toolset:gcc*", "language:C++" } buildoptions { "-Wno-class-memaccess" } + filter { "toolset:clang", "language:C++" } + buildoptions { "-Wno-assume" } filter { "toolset:clang or gcc*", "language:C++" } - buildoptions { "-Wno-reorder", "-Wno-invalid-offsetof", "-Wno-assume" } + buildoptions { "-Wno-reorder", "-Wno-invalid-offsetof" } -- When compiling the debug configuration, we want to turn -- optimization off, make sure debug symbols are output, diff --git a/source/compiler-core/slang-source-embed-util.cpp b/source/compiler-core/slang-source-embed-util.cpp index ec0c005cf..45fd9c4b3 100644 --- a/source/compiler-core/slang-source-embed-util.cpp +++ b/source/compiler-core/slang-source-embed-util.cpp @@ -73,7 +73,7 @@ static bool _isHeaderExtension(const UnownedStringSlice& in) // Assume it's a header, and just use the .h extension StringBuilder buf; buf << path << toSlice(".h"); - return buf; + return std::move(buf); } /* static */SourceEmbedUtil::Style SourceEmbedUtil::getDefaultStyle(const ArtifactDesc& desc) diff --git a/source/slang/slang-check-impl.h b/source/slang/slang-check-impl.h index 26c96a72e..e710f93ec 100644 --- a/source/slang/slang-check-impl.h +++ b/source/slang/slang-check-impl.h @@ -57,13 +57,13 @@ namespace Slang { return getRaw() == other.getRaw(); } - static BasicTypeKey invalid() { return BasicTypeKey{ 0xff, 0, 0 }; } + static BasicTypeKey invalid() { return BasicTypeKey{ 0xff, 0, 0, 0, 0, 0 }; } }; SLANG_FORCE_INLINE BasicTypeKey makeBasicTypeKey(BaseType baseType, IntegerLiteralValue dim1 = 0, IntegerLiteralValue dim2 = 0) { SLANG_ASSERT(dim1 >= 0 && dim2 >= 0); - return BasicTypeKey{ uint8_t(baseType), uint8_t(dim1), uint8_t(dim2) }; + return BasicTypeKey{ uint8_t(baseType), uint8_t(dim1), uint8_t(dim2), 0, 0, 0 }; } inline BasicTypeKey makeBasicTypeKey(Type* typeIn, Expr* exprIn = nullptr) diff --git a/source/slang/slang-ir-autodiff-transpose.h b/source/slang/slang-ir-autodiff-transpose.h index a0f888931..843612df9 100644 --- a/source/slang/slang-ir-autodiff-transpose.h +++ b/source/slang/slang-ir-autodiff-transpose.h @@ -2295,8 +2295,8 @@ struct DiffTransposePass if (auto vectorType = as<IRVectorType>(baseType)) { - IRInst* elementCountInst = as<IRVectorType>(baseType)->getElementCount(); - elementType = as<IRVectorType>(baseType)->getElementType(); + IRInst* elementCountInst = vectorType->getElementCount(); + elementType = vectorType->getElementType(); primalElementType = as<IRVectorType>(aggPrimalType)->getElementType(); SLANG_ASSERT(as<IRIntLit>(elementCountInst)); elementCount = as<IRIntLit>(elementCountInst)->getValue(); diff --git a/source/slang/slang-lower-to-ir.cpp b/source/slang/slang-lower-to-ir.cpp index cb2c9129a..c70cdb948 100644 --- a/source/slang/slang-lower-to-ir.cpp +++ b/source/slang/slang-lower-to-ir.cpp @@ -872,7 +872,7 @@ static LoweredValInfo _emitCallToAccessor( /// encapsulates the reference to the storage so that downstream /// code can decide which accessor(s) to invoke. /// - +[[maybe_unused]] static LoweredValInfo lowerStorageReference( IRGenContext* context, IRType* type, @@ -1448,7 +1448,6 @@ struct ValLoweringVisitor : ValVisitor<ValLoweringVisitor, LoweredValInfo, Lower LoweredValInfo visitTypeCastIntVal(TypeCastIntVal* val) { - TryClauseEnvironment tryEnv; auto baseVal = lowerVal(context, val->base); SLANG_ASSERT(baseVal.flavor == LoweredValInfo::Flavor::Simple); auto type = lowerType(context, val->type); |
