summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEllie Hermaszewska <github@sub.monoid.al>2022-10-05 04:54:49 +0800
committerGitHub <noreply@github.com>2022-10-04 13:54:49 -0700
commit8b1daa68a5ff1398cdf130aacad32d2e5646d1eb (patch)
tree21061d2ee105eac009d657ca87a59e1a70049891
parent7c54489e1f4016852df84eece93ded672b1b468e (diff)
Squash some warnings from gcc 12.2 (#2428)
* Use premake's linkgroups rather than specifying the flags ourselves Fixes linker warning about unterminated --start-group * C++ only warnings only when compiling C++ * compile miniz and l4z as C, not C++ * Use enum over 0 literal Silences enum-literal-compare warning Co-authored-by: jsmall-nvidia <jsmall@nvidia.com>
-rw-r--r--premake5.lua20
-rw-r--r--source/slang/slang-reflection-api.cpp4
2 files changed, 15 insertions, 9 deletions
diff --git a/premake5.lua b/premake5.lua
index 164dfe51b..3499c452a 100644
--- a/premake5.lua
+++ b/premake5.lua
@@ -327,15 +327,15 @@ newoption {
-- Makes all symbols hidden by default unless explicitly 'exported'
buildoptions { "-fvisibility=hidden" }
-- Warnings
- buildoptions { "-Wno-unused-but-set-variable", "-Wno-unused-parameter", "-Wno-type-limits", "-Wno-sign-compare", "-Wno-unused-variable", "-Wno-switch", "-Wno-return-type", "-Wno-unused-local-typedefs", "-Wno-parentheses", "-Wno-class-memaccess"}
-
+ buildoptions { "-Wno-unused-but-set-variable", "-Wno-unused-parameter", "-Wno-type-limits", "-Wno-sign-compare", "-Wno-unused-variable", "-Wno-switch", "-Wno-return-type", "-Wno-unused-local-typedefs", "-Wno-parentheses" }
+ filter { "toolset:clang or gcc*", "language:C++" }
+ buildoptions { "-Wno-reorder", "-Wno-class-memaccess"}
+
filter { "toolset:gcc*"}
buildoptions { "-Wno-implicit-fallthrough" }
- filter { "toolset:gcc*", "language:C++"}
- buildoptions { "-Wno-reorder" }
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", "-Wno-reorder"}
+ 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" }
-- When compiling the debug configuration, we want to turn
-- optimization off, make sure debug symbols are output,
@@ -356,11 +356,12 @@ newoption {
filter { "system:linux" }
links { "dl" }
--
- -- `--start-group` - allows libraries to be listed in any order (do not require dependency order)
-- `--no-undefined` - by default if a symbol is not found in a link it will assume it will be resolved at runtime (!)
-- this option ensures that all the referenced symbols exist
--
- linkoptions{ "-Wl,-rpath,'$$ORIGIN',--no-as-needed,--no-undefined,--start-group" }
+ linkoptions{ "-Wl,-rpath,'$$ORIGIN',--no-as-needed,--no-undefined" }
+ -- allow libraries to be listed in any order (do not require dependency order)
+ linkgroups "On"
function dump(o)
if type(o) == 'table' then
@@ -512,7 +513,8 @@ newoption {
--
objdir("intermediate/" .. targetName .. "/%{cfg.buildcfg:lower()}/%{prj.name}")
- -- All of our projects are written in C++.
+ -- Treat C++ as the default language, projects in other languages can
+ -- override this later
--
language "C++"
@@ -1478,6 +1480,7 @@ tool "slangd"
pic "On"
-- Add the files explicitly
+ language "C"
files
{
"external/miniz/miniz.c",
@@ -1495,6 +1498,7 @@ tool "slangd"
pic "On"
-- Add the files explicitly
+ language "C"
files
{
"external/lz4/lib/lz4.c",
diff --git a/source/slang/slang-reflection-api.cpp b/source/slang/slang-reflection-api.cpp
index eb2b9aff9..ca64cbed1 100644
--- a/source/slang/slang-reflection-api.cpp
+++ b/source/slang/slang-reflection-api.cpp
@@ -1243,7 +1243,9 @@ namespace Slang
auto shape = resourceType->getBaseShape();
auto access = resourceType->getAccess();
- auto mutableFlag = access != SLANG_RESOURCE_ACCESS_READ ? SLANG_BINDING_TYPE_MUTABLE_FLAG : 0;
+ auto mutableFlag = access != SLANG_RESOURCE_ACCESS_READ
+ ? SLANG_BINDING_TYPE_MUTABLE_FLAG
+ : SLANG_BINDING_TYPE_UNKNOWN;
switch(SlangResourceShape(shape ))
{