From 431a9c00a56cf4c603be1cf5f773b193621d8150 Mon Sep 17 00:00:00 2001 From: Kai Blaschke Date: Mon, 19 Feb 2024 16:55:19 +0100 Subject: Fixed a huge amount of Clang warnings On Linux and macOS, using Clang to compile OpenStarbound produces about 400 MB worth of warnings during the build, making the compiler output unreadable and slowing the build down considerably. 99% of the warnings were unqualified uses of std::move and std::forward, which are now all properly qualified. Fixed a few other minor warnings about non-virtual destructors and some uses of std::move preventing copy elision on temporary objects. Most remaining warnings are now unused parameters. --- source/base/StarAssets.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'source/base/StarAssets.cpp') diff --git a/source/base/StarAssets.cpp b/source/base/StarAssets.cpp index 8956ba9..135945c 100644 --- a/source/base/StarAssets.cpp +++ b/source/base/StarAssets.cpp @@ -71,17 +71,17 @@ Maybe FramesSpecification::getRect(String const& frame) const { Assets::Assets(Settings settings, StringList assetSources) { const char* const AssetsPatchSuffix = ".patch"; - m_settings = move(settings); + m_settings = std::move(settings); m_stopThreads = false; - m_assetSources = move(assetSources); + m_assetSources = std::move(assetSources); for (auto& sourcePath : m_assetSources) { Logger::info("Loading assets from: '{}'", sourcePath); AssetSourcePtr source; if (File::isDirectory(sourcePath)) - source = make_shared(sourcePath, m_settings.pathIgnore); + source = std::make_shared(sourcePath, m_settings.pathIgnore); else - source = make_shared(sourcePath); + source = std::make_shared(sourcePath); m_assetSourcePaths.add(sourcePath, source); @@ -225,7 +225,7 @@ Json Assets::json(String const& path) const { auto components = AssetPath::split(path); validatePath(components, true, false); - return as(getAsset(AssetId{AssetType::Json, move(components)}))->json; + return as(getAsset(AssetId{AssetType::Json, std::move(components)}))->json; } Json Assets::fetchJson(Json const& v, String const& dir) const { @@ -255,7 +255,7 @@ void Assets::queueImages(StringList const& paths) const { auto components = AssetPath::split(path); validatePath(components, true, true); - return AssetId{AssetType::Image, move(components)}; + return AssetId{AssetType::Image, std::move(components)}; })); } @@ -280,7 +280,7 @@ AudioConstPtr Assets::audio(String const& path) const { auto components = AssetPath::split(path); validatePath(components, false, false); - return as(getAsset(AssetId{AssetType::Audio, move(components)}))->audio; + return as(getAsset(AssetId{AssetType::Audio, std::move(components)}))->audio; } void Assets::queueAudios(StringList const& paths) const { @@ -288,7 +288,7 @@ void Assets::queueAudios(StringList const& paths) const { const auto components = AssetPath::split(path); validatePath(components, false, false); - return AssetId{AssetType::Audio, move(components)}; + return AssetId{AssetType::Audio, std::move(components)}; })); } @@ -296,7 +296,7 @@ AudioConstPtr Assets::tryAudio(String const& path) const { auto components = AssetPath::split(path); validatePath(components, false, false); - if (auto audioData = as(tryAsset(AssetId{AssetType::Audio, move(components)}))) + if (auto audioData = as(tryAsset(AssetId{AssetType::Audio, std::move(components)}))) return audioData->audio; else return {}; @@ -306,14 +306,14 @@ FontConstPtr Assets::font(String const& path) const { auto components = AssetPath::split(path); validatePath(components, false, false); - return as(getAsset(AssetId{AssetType::Font, move(components)}))->font; + return as(getAsset(AssetId{AssetType::Font, std::move(components)}))->font; } ByteArrayConstPtr Assets::bytes(String const& path) const { auto components = AssetPath::split(path); validatePath(components, false, false); - return as(getAsset(AssetId{AssetType::Bytes, move(components)}))->bytes; + return as(getAsset(AssetId{AssetType::Bytes, std::move(components)}))->bytes; } IODevicePtr Assets::openFile(String const& path) const { @@ -386,7 +386,7 @@ bool Assets::BytesData::shouldPersist() const { FramesSpecification Assets::parseFramesSpecification(Json const& frameConfig, String path) { FramesSpecification framesSpecification; - framesSpecification.framesFile = move(path); + framesSpecification.framesFile = std::move(path); if (frameConfig.contains("frameList")) { for (auto const& pair : frameConfig.get("frameList").toObject()) { @@ -469,7 +469,7 @@ FramesSpecification Assets::parseFramesSpecification(Json const& frameConfig, St if (!framesSpecification.frames.contains(value)) throw AssetException(strf("No such frame '{}' found for alias '{}'", value, key)); - framesSpecification.aliases[key] = move(value); + framesSpecification.aliases[key] = std::move(value); } } @@ -866,7 +866,7 @@ shared_ptr Assets::loadImage(AssetPath const& path) const { for (auto const& ref : referencePaths) { auto components = AssetPath::split(ref); validatePath(components, true, false); - auto refImage = as(loadAsset(AssetId{AssetType::Image, move(components)})); + auto refImage = as(loadAsset(AssetId{AssetType::Image, std::move(components)})); if (!refImage) return {}; references[ref] = refImage->image; @@ -881,7 +881,7 @@ shared_ptr Assets::loadImage(AssetPath const& path) const { else processImageOperation(entry.operation, newImage, [&](String const& ref) { return references.get(ref).get(); }); }); - newData->image = make_shared(move(newImage)); + newData->image = make_shared(std::move(newImage)); return newData; }); -- cgit v1.2.3