From 09d8e048d2264d89886cda8e87e8a452d4f913c1 Mon Sep 17 00:00:00 2001 From: Ellie Hermaszewska Date: Thu, 17 Nov 2022 03:33:10 +0800 Subject: Squash warnings (#2515) * Don't use uname -p It's not portable (doesn't work on my machine) * Disable maybe-uninitialized warning on gcc Only false positives at the moment * Squash warning in miniz Allow it to use 64 bit file handing functions with gcc * Use noreturn c++11 attribute in SLANG_RETURN_NEVER * Squash uninitialized variable warnings * Squash const char/char conversion warnings Co-authored-by: Yong He --- github_test.sh | 2 +- premake5.lua | 7 +++++-- slang.h | 2 +- source/slang/slang-ir-diff-jvp.cpp | 1 + source/slang/slang-legalize-types.h | 2 +- tools/gfx-unit-test/shader-cache-tests.cpp | 4 ++-- 6 files changed, 11 insertions(+), 7 deletions(-) diff --git a/github_test.sh b/github_test.sh index b18566f84..dc07c6250 100644 --- a/github_test.sh +++ b/github_test.sh @@ -9,7 +9,7 @@ else fi PLATFORM=$(uname -s | tr '[:upper:]' '[:lower:]') -ARCHITECTURE=$(uname -p) +ARCHITECTURE=$(uname -m) # Darwin is actually macosx (for paths etc) if [ "${PLATFORM}" == "darwin" ]; then diff --git a/premake5.lua b/premake5.lua index f5a86126e..92243263a 100644 --- a/premake5.lua +++ b/premake5.lua @@ -339,8 +339,9 @@ newoption { filter { "toolset:clang or gcc*", "language:C++" } buildoptions { "-Wno-reorder", "-Wno-class-memaccess"} - filter { "toolset:gcc*"} - buildoptions { "-Wno-implicit-fallthrough" } + filter { "toolset:gcc*" } + buildoptions { "-Wno-implicit-fallthrough", "-Wno-maybe-uninitialized" } + filter { "toolset:clang" } buildoptions { "-Wno-deprecated-register", "-Wno-tautological-compare", "-Wno-missing-braces", "-Wno-undefined-var-template", "-Wno-unused-function", "-Wno-return-std-move", "-Wno-ignored-optimization-argument", "-Wno-unknown-warning-option" } @@ -1501,6 +1502,8 @@ tool "slangd" "external/miniz/miniz_tinfl.c", "external/miniz/miniz_zip.c" } + filter { "system:linux" } + defines { "_LARGEFILE64_SOURCE" } filter { "system:linux or macosx" } links { "dl"} diff --git a/slang.h b/slang.h index 6589de67d..2027aeab3 100644 --- a/slang.h +++ b/slang.h @@ -380,7 +380,7 @@ convention for interface methods. #endif // __cplusplus #ifndef SLANG_RETURN_NEVER -# define SLANG_RETURN_NEVER /* empty */ +# define SLANG_RETURN_NEVER [[noreturn]] #endif // SLANG_RETURN_NEVER /* Macros for detecting processor */ diff --git a/source/slang/slang-ir-diff-jvp.cpp b/source/slang/slang-ir-diff-jvp.cpp index 7f5979a87..1597c80d1 100644 --- a/source/slang/slang-ir-diff-jvp.cpp +++ b/source/slang/slang-ir-diff-jvp.cpp @@ -2515,6 +2515,7 @@ struct BackwardDiffTranscriber newInst = builder->emitDiv(resultType, primalLeft, primalRight); break; default: + newInst = nullptr; getSink()->diagnose(origArith->sourceLoc, Diagnostics::unimplemented, "this arithmetic instruction cannot be differentiated"); diff --git a/source/slang/slang-legalize-types.h b/source/slang/slang-legalize-types.h index 600f1d7a7..a24caf960 100644 --- a/source/slang/slang-legalize-types.h +++ b/source/slang/slang-legalize-types.h @@ -73,7 +73,7 @@ struct LegalType Flavor flavor = Flavor::none; RefPtr obj; - IRType* irType; + IRType* irType = nullptr; static LegalType simple(IRType* type) { diff --git a/tools/gfx-unit-test/shader-cache-tests.cpp b/tools/gfx-unit-test/shader-cache-tests.cpp index a9939d434..a7306599a 100644 --- a/tools/gfx-unit-test/shader-cache-tests.cpp +++ b/tools/gfx-unit-test/shader-cache-tests.cpp @@ -271,7 +271,7 @@ namespace gfx_test { ComPtr shaderProgram; slang::ProgramLayout* slangReflection; - char* shaderFilename; + const char* shaderFilename; switch (shaderIndex) { case 0: @@ -361,7 +361,7 @@ namespace gfx_test { ComPtr shaderProgram; slang::ProgramLayout* slangReflection; - char* entryPointName; + const char* entryPointName; switch (shaderIndex) { case 0: -- cgit v1.2.3