mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Fix some warnings emitted by clang diagnostics
Suppress a couple of NewDelete checks, as they print a load of output about stuff in Boost.
This commit is contained in:
@@ -38,7 +38,7 @@
|
||||
#include "loot/vertex.h"
|
||||
|
||||
namespace loot {
|
||||
struct ApiDatabase : public DatabaseInterface {
|
||||
struct ApiDatabase final : public DatabaseInterface {
|
||||
explicit ApiDatabase(std::shared_ptr<ConditionEvaluator> conditionEvaluator);
|
||||
|
||||
void LoadLists(const std::filesystem::path& masterlist_path,
|
||||
|
||||
@@ -29,11 +29,11 @@
|
||||
namespace loot {
|
||||
namespace detail {
|
||||
class libloadorder_category : public std::error_category {
|
||||
virtual const char* name() const noexcept { return "libloadorder"; }
|
||||
const char* name() const noexcept override { return "libloadorder"; }
|
||||
|
||||
virtual std::string message(int) const { return "Libloadorder error"; }
|
||||
std::string message(int) const override { return "Libloadorder error"; }
|
||||
|
||||
virtual bool equivalent(const std::error_code& code) const noexcept {
|
||||
bool equivalent(const std::error_code& code, int) const noexcept override {
|
||||
return code.category().name() == name();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -101,7 +101,6 @@ bool Game::IsValidPlugin(const std::string& plugin) const {
|
||||
void Game::LoadPlugins(const std::vector<std::string>& plugins,
|
||||
bool loadHeadersOnly) {
|
||||
auto logger = getLogger();
|
||||
uintmax_t meanFileSize = 0;
|
||||
std::multimap<uintmax_t, string> sizeMap;
|
||||
|
||||
// First get the plugin sizes.
|
||||
@@ -110,7 +109,6 @@ void Game::LoadPlugins(const std::vector<std::string>& plugins,
|
||||
throw std::invalid_argument("\"" + plugin + "\" is not a valid plugin");
|
||||
|
||||
uintmax_t fileSize = Plugin::GetFileSize(DataPath() / u8path(plugin));
|
||||
meanFileSize += fileSize;
|
||||
|
||||
// Trim .ghost extension if present.
|
||||
if (boost::iends_with(plugin, ".ghost"))
|
||||
@@ -118,7 +116,6 @@ void Game::LoadPlugins(const std::vector<std::string>& plugins,
|
||||
else
|
||||
sizeMap.emplace(fileSize, plugin);
|
||||
}
|
||||
meanFileSize /= sizeMap.size(); // Rounding error, but not important.
|
||||
|
||||
// Get the number of threads to use.
|
||||
// hardware_concurrency() may be zero, if so then use only one thread.
|
||||
|
||||
+1
-1
@@ -34,7 +34,7 @@
|
||||
#include "loot/game_interface.h"
|
||||
|
||||
namespace loot {
|
||||
class Game : public GameInterface {
|
||||
class Game final : public GameInterface {
|
||||
public:
|
||||
explicit Game(const GameType gameType,
|
||||
const std::filesystem::path& gamePath,
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@
|
||||
namespace loot {
|
||||
class GameCache;
|
||||
|
||||
class Plugin : public PluginInterface {
|
||||
class Plugin final : public PluginInterface {
|
||||
public:
|
||||
explicit Plugin(const GameType gameType,
|
||||
std::shared_ptr<GameCache> gameCache,
|
||||
|
||||
@@ -283,6 +283,7 @@ std::optional<vertex_t> PluginGraph::GetVertexByName(
|
||||
|
||||
void PluginGraph::CheckForCycles() const {
|
||||
auto logger = getLogger();
|
||||
// NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDelete)
|
||||
if (logger) {
|
||||
logger->trace("Checking plugin graph for cycles...");
|
||||
}
|
||||
@@ -290,6 +291,7 @@ void PluginGraph::CheckForCycles() const {
|
||||
std::map<vertex_t, size_t> indexMap;
|
||||
auto vertexIndexMap = vertex_map_t(indexMap);
|
||||
size_t i = 0;
|
||||
// NOLINTNEXTLINE(clang-analyzer-cplusplus.NewDelete)
|
||||
BGL_FORALL_VERTICES(v, graph_, RawPluginGraph) {
|
||||
put(vertexIndexMap, v, i++);
|
||||
}
|
||||
|
||||
@@ -38,9 +38,9 @@ protected:
|
||||
lowercaseBlankEsp("blank.esp"),
|
||||
nonAsciiEsp(u8"non\u00C1scii.esp"),
|
||||
otherNonAsciiEsp(u8"other non\u00C1scii.esp"),
|
||||
blankArchive("Blank" + GetArchiveFileExtension(game_.Type())),
|
||||
blankArchive("Blank" + GetArchiveFileExtension(GetParam())),
|
||||
blankSuffixArchive("Blank - Different - suffix" +
|
||||
GetArchiveFileExtension(game_.Type())),
|
||||
GetArchiveFileExtension(GetParam())),
|
||||
game_(GetParam(), dataPath.parent_path(), localPath) {}
|
||||
|
||||
void SetUp() {
|
||||
@@ -136,7 +136,7 @@ private:
|
||||
}
|
||||
};
|
||||
|
||||
class OtherPluginType : public PluginInterface {
|
||||
class OtherPluginType final : public PluginInterface {
|
||||
public:
|
||||
std::string GetName() const { return ""; }
|
||||
std::optional<float> GetHeaderVersion() const { return 0.0f; }
|
||||
|
||||
Reference in New Issue
Block a user