From e69c23e596baf082d928bd18dc364ea6f846c457 Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Fri, 5 May 2023 22:21:30 +0800 Subject: Squash a couple of warnings on clang (#2870) * Squash a couple of warnings on clang Redisable -Wunused-local-typedefs * unused variable --- premake5.lua | 6 +++++- source/core/slang-type-text-util.h | 2 +- source/slang/slang-type-layout.cpp | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/premake5.lua b/premake5.lua index 06da86754..44a0da437 100644 --- a/premake5.lua +++ b/premake5.lua @@ -367,7 +367,11 @@ workspace "slang" -- Disable some warnings filter { "toolset:clang or gcc*" } - buildoptions { "-Wno-switch", "-Wno-parentheses" } + buildoptions { + "-Wno-switch", + "-Wno-parentheses", + "-Wno-unused-local-typedefs", + } filter { "toolset:gcc*", "language:C++" } buildoptions { "-Wno-class-memaccess" } filter { "toolset:clang or gcc*", "language:C++" } diff --git a/source/core/slang-type-text-util.h b/source/core/slang-type-text-util.h index cf146fb46..219dcd5f2 100644 --- a/source/core/slang-type-text-util.h +++ b/source/core/slang-type-text-util.h @@ -25,7 +25,7 @@ struct TypeTextUtil SlangCompileTarget target; ///< The target const char* extensions; ///< Comma delimited list of extensions associated with the target const char* names; ///< Comma delimited list of names associated with the target. NOTE! First name is taken as the normal display name. - const char* description; ///< Description, can be null + const char* description = nullptr; ///< Description, can be null }; /// Get the compile target infos diff --git a/source/slang/slang-type-layout.cpp b/source/slang/slang-type-layout.cpp index 79236fc48..c7b9af40b 100644 --- a/source/slang/slang-type-layout.cpp +++ b/source/slang/slang-type-layout.cpp @@ -3720,7 +3720,7 @@ static TypeLayoutResult _createTypeLayout( // If the field has an explicit offset, then we will // use that to place it. // - if (auto packOffsetModifier = field.getDecl()->findModifier()) + if (const auto packOffsetModifier = field.getDecl()->findModifier()) { TypeLayoutResult fieldResult = _createTypeLayout( context, @@ -3733,7 +3733,7 @@ static TypeLayoutResult _createTypeLayout( } for (auto field : getFields(structDeclRef, MemberFilterStyle::Instance)) { - if (auto packOffsetModifier = field.getDecl()->findModifier()) + if (const auto packOffsetModifier = field.getDecl()->findModifier()) continue; // The fields of a `struct` type may include existential (interface) -- cgit v1.2.3