Resolve unused code warnings when compiling in Debug mode using MSVC

This commit is contained in:
Evil Eye 2025-07-30 20:44:59 +02:00
parent 399ec4eccc
commit bc05628fa8
6 changed files with 19 additions and 19 deletions

View File

@ -638,8 +638,9 @@ CUSTOM: customdata.lua
sol::object deserialized = LuaUtil::deserialize(lua.sol(), data2.mScripts[0].mData, &serializer1); sol::object deserialized = LuaUtil::deserialize(lua.sol(), data2.mScripts[0].mData, &serializer1);
EXPECT_TRUE(deserialized.is<sol::table>()); EXPECT_TRUE(deserialized.is<sol::table>());
sol::table table = deserialized; sol::table table = deserialized;
for (const auto& [key, value] : table) if (!table.empty())
{ {
const auto [key, value] = *table.cbegin();
EXPECT_TRUE(key.is<ESM::RefNum>()); EXPECT_TRUE(key.is<ESM::RefNum>());
EXPECT_TRUE(value.is<ESM::RefNum>()); EXPECT_TRUE(value.is<ESM::RefNum>());
EXPECT_EQ(key.as<ESM::RefNum>(), (ESM::RefNum{ 42, 34 })); EXPECT_EQ(key.as<ESM::RefNum>(), (ESM::RefNum{ 42, 34 }));

View File

@ -215,8 +215,6 @@ int main(int argc, char** argv)
std::cerr << "ERROR: " << e.what() << std::endl; std::cerr << "ERROR: " << e.what() << std::endl;
return 1; return 1;
} }
return 0;
} }
namespace namespace

View File

@ -1117,8 +1117,8 @@ namespace MWRender
return keyframeController->getAsCallback(); return keyframeController->getAsCallback();
} }
else
return asCallback; return asCallback;
} }
void Animation::resetActiveGroups() void Animation::resetActiveGroups()

View File

@ -528,8 +528,6 @@ namespace Fx
{ {
return parseBool(); return parseBool();
} }
error(Misc::StringUtils::format("failed setting uniform type"));
} }
template <class SrcT, class T> template <class SrcT, class T>
@ -557,10 +555,12 @@ namespace Fx
{ {
if constexpr (std::is_same_v<bool, SrcT>) if constexpr (std::is_same_v<bool, SrcT>)
error("bool arrays currently unsupported"); error("bool arrays currently unsupported");
else
int size = parseInteger(); {
if (size > 1) int size = parseInteger();
data.mArray = std::vector<SrcT>(size); if (size > 1)
data.mArray = std::vector<SrcT>(size);
}
} }
else if (key == "min") else if (key == "min")
{ {

View File

@ -220,10 +220,11 @@ namespace Fx
return osg::Uniform::FLOAT; return osg::Uniform::FLOAT;
else if constexpr (std::is_same_v<T, int>) else if constexpr (std::is_same_v<T, int>)
return osg::Uniform::INT; return osg::Uniform::INT;
else if constexpr (std::is_same_v<T, bool>) else
{
static_assert(std::is_same_v<T, bool>, "Non-exhaustive visitor");
return osg::Uniform::BOOL; return osg::Uniform::BOOL;
}
return std::nullopt;
}, },
mData); mData);
} }
@ -293,15 +294,14 @@ namespace Fx
return Misc::StringUtils::format("const int %s=%i;", mName, value); return Misc::StringUtils::format("const int %s=%i;", mName, value);
} }
else if constexpr (std::is_same_v<T, bool>) else
{ {
static_assert(std::is_same_v<T, bool>, "Non-exhaustive visitor");
if (useUniform) if (useUniform)
return Misc::StringUtils::format("uniform bool %s;", uname); return Misc::StringUtils::format("uniform bool %s;", uname);
return Misc::StringUtils::format("const bool %s=%s;", mName, value ? "true" : "false"); return Misc::StringUtils::format("const bool %s=%s;", mName, value ? "true" : "false");
} }
return std::nullopt;
}, },
mData); mData);
} }

View File

@ -215,12 +215,13 @@ namespace LuaUtil
return true; return true;
} }
} }
return false;
} }
else if constexpr (std::is_same_v<T, LoadedData>) else
{ {
static_assert(std::is_same_v<T, LoadedData>, "Non-exhaustive visitor");
return variant.mScripts.count(scriptId) != 0; return variant.mScripts.count(scriptId) != 0;
} }
return false;
}, },
mData); mData);
} }