diff options
author | Kai Blaschke <kai.blaschke@kb-dev.net> | 2024-02-19 16:55:19 +0100 |
---|---|---|
committer | Kai Blaschke <kai.blaschke@kb-dev.net> | 2024-02-19 16:55:19 +0100 |
commit | 431a9c00a56cf4c603be1cf5f773b193621d8150 (patch) | |
tree | 95843aeea9fb6dc18279ee05ff6961f40b19798f /source/frontend | |
parent | 30e1871d3f44629e00a1f66d8164e3e62c7f889f (diff) |
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.
Diffstat (limited to 'source/frontend')
25 files changed, 49 insertions, 48 deletions
diff --git a/source/frontend/StarActionBar.cpp b/source/frontend/StarActionBar.cpp index acaa3d1..15e1bd5 100644 --- a/source/frontend/StarActionBar.cpp +++ b/source/frontend/StarActionBar.cpp @@ -20,7 +20,7 @@ namespace Star { ActionBar::ActionBar(MainInterfacePaneManager* paneManager, PlayerPtr player) { m_paneManager = paneManager; - m_player = move(player); + m_player = std::move(player); auto assets = Root::singleton().assets(); diff --git a/source/frontend/StarAiInterface.cpp b/source/frontend/StarAiInterface.cpp index 599b829..7bdea39 100644 --- a/source/frontend/StarAiInterface.cpp +++ b/source/frontend/StarAiInterface.cpp @@ -388,7 +388,7 @@ void AiInterface::setFaceAnimation(String const& name) { } void AiInterface::setCurrentSpeech(String const& textWidget, AiSpeech speech) {; - m_currentSpeech = move(speech); + m_currentSpeech = std::move(speech); m_textLength = 0.0; m_textMaxLength = Text::stripEscapeCodes(m_currentSpeech->text).size(); m_currentTextWidget = findChild<LabelWidget>(textWidget); diff --git a/source/frontend/StarBaseScriptPane.hpp b/source/frontend/StarBaseScriptPane.hpp index 37070f1..9b7c38a 100644 --- a/source/frontend/StarBaseScriptPane.hpp +++ b/source/frontend/StarBaseScriptPane.hpp @@ -34,7 +34,7 @@ public: PanePtr createTooltip(Vec2I const& screenPosition) override; Maybe<String> cursorOverride(Vec2I const& screenPosition) override; protected: - virtual GuiReaderPtr reader(); + virtual GuiReaderPtr reader() override; Json m_config; Json m_rawConfig; diff --git a/source/frontend/StarChat.cpp b/source/frontend/StarChat.cpp index 72c1409..230f3d9 100644 --- a/source/frontend/StarChat.cpp +++ b/source/frontend/StarChat.cpp @@ -191,7 +191,7 @@ void Chat::addMessages(List<ChatReceivedMessage> const& messages, bool showPane) m_receivedMessages.prepend({ message.context.mode, message.portrait, - move(lines[i]) + std::move(lines[i]) }); } diff --git a/source/frontend/StarChatBubbleManager.cpp b/source/frontend/StarChatBubbleManager.cpp index 166eba0..3137353 100644 --- a/source/frontend/StarChatBubbleManager.cpp +++ b/source/frontend/StarChatBubbleManager.cpp @@ -265,12 +265,12 @@ void ChatBubbleManager::addChatActions(List<ChatAction> chatActions, bool silent RectF boundBox = fold(backgroundImages, RectF::null(), [pos, this](RectF const& boundBox, BubbleImage const& bubbleImage) { return boundBox.combined(bubbleImageRect(pos, bubbleImage, m_zoom)); }); - Bubble bubble = {sayAction.entity, sayAction.text, sayAction.config, 0, move(backgroundImages), move(bubbleTexts), false}; + Bubble bubble = {sayAction.entity, sayAction.text, sayAction.config, 0, std::move(backgroundImages), std::move(bubbleTexts), false}; List<BubbleState<Bubble>> oldBubbles = m_bubbles.filtered([&sayAction](BubbleState<Bubble> const&, Bubble const& bubble) { return bubble.entity == sayAction.entity; }); m_bubbles.filter([&sayAction](BubbleState<Bubble> const&, Bubble const& bubble) { return bubble.entity != sayAction.entity; }); - m_bubbles.addBubble(pos, boundBox, move(bubble), m_interBubbleMargin * m_zoom); + m_bubbles.addBubble(pos, boundBox, std::move(bubble), m_interBubbleMargin * m_zoom); oldBubbles.sort([](BubbleState<Bubble> const& a, BubbleState<Bubble> const& b) { return a.contents.age < b.contents.age; }); for (auto bubble : oldBubbles.slice(0, m_maxMessagePerEntity - 1)) m_bubbles.addBubble(bubble.idealDestination, bubble.boundBox, bubble.contents, 0); @@ -300,8 +300,8 @@ void ChatBubbleManager::addChatActions(List<ChatAction> chatActions, bool silent portraitAction.position, portraitAction.config, 0, - move(backgroundImages), - move(bubbleTexts), + std::move(backgroundImages), + std::move(bubbleTexts), false }); } diff --git a/source/frontend/StarChatBubbleSeparation.hpp b/source/frontend/StarChatBubbleSeparation.hpp index 4bbf018..dfe5167 100644 --- a/source/frontend/StarChatBubbleSeparation.hpp +++ b/source/frontend/StarChatBubbleSeparation.hpp @@ -112,7 +112,7 @@ void BubbleSeparator<T>::addBubble(Vec2F position, RectF boundBox, T contents, u Vec2F separatedOffset = separated.min() - boundBox.min(); Vec2F separatedPosition = position + separatedOffset; Bubble bubble = Bubble{ contents, position, position, boundBox, separatedOffset, separated, separatedOffset, separatedPosition }; - m_bubbles.insertSorted(move(bubble), &BubbleSeparator<T>::compareBubbleY); + m_bubbles.insertSorted(std::move(bubble), &BubbleSeparator<T>::compareBubbleY); } template <typename T> @@ -136,8 +136,8 @@ template <typename T> void BubbleSeparator<T>::forEach(function<void(Bubble&, T&)> func) { bool anyMoved = false; - List<Box<float, 2>> leftEdges = move(m_sortedLeftEdges); - List<Box<float, 2>> rightEdges = move(m_sortedRightEdges); + List<Box<float, 2>> leftEdges = std::move(m_sortedLeftEdges); + List<Box<float, 2>> rightEdges = std::move(m_sortedRightEdges); m_bubbles.exec([this, func, &anyMoved, &leftEdges, &rightEdges](Bubble& bubble) { RectF oldBoundBox = bubble.boundBox; diff --git a/source/frontend/StarCinematic.cpp b/source/frontend/StarCinematic.cpp index 40fc8d1..572cbd7 100644 --- a/source/frontend/StarCinematic.cpp +++ b/source/frontend/StarCinematic.cpp @@ -197,7 +197,7 @@ void Cinematic::render() { drawable.scale(values.zoom); drawable.translate(values.position); drawable.color *= alphaColor; - drawDrawable(move(drawable), drawableScale, drawableTranslation); + drawDrawable(std::move(drawable), drawableScale, drawableTranslation); } if (!panel->avatar.empty() && m_player) { for (auto drawable : m_player->portrait(PortraitModeNames.getLeft(panel->avatar))) { @@ -205,7 +205,7 @@ void Cinematic::render() { drawable.scale(values.zoom); drawable.translate(values.position); drawable.color *= alphaColor; - drawDrawable(move(drawable), drawableScale, drawableTranslation); + drawDrawable(std::move(drawable), drawableScale, drawableTranslation); } } if (!panel->text.empty()) { @@ -274,7 +274,7 @@ void Cinematic::drawDrawable(Drawable const& drawable, float drawableScale, Vec2 Vec4B drawableColor = drawable.color.toRgba(); - primitives.emplace_back(std::in_place_type_t<RenderQuad>(), move(texture), + primitives.emplace_back(std::in_place_type_t<RenderQuad>(), std::move(texture), lowerLeft, Vec2F{0, 0}, lowerRight, Vec2F{size[0], 0}, upperRight, Vec2F{size[0], size[1]}, diff --git a/source/frontend/StarClientCommandProcessor.cpp b/source/frontend/StarClientCommandProcessor.cpp index 933d87b..8434043 100644 --- a/source/frontend/StarClientCommandProcessor.cpp +++ b/source/frontend/StarClientCommandProcessor.cpp @@ -16,8 +16,8 @@ namespace Star { ClientCommandProcessor::ClientCommandProcessor(UniverseClientPtr universeClient, CinematicPtr cinematicOverlay, MainInterfacePaneManager* paneManager, StringMap<StringList> macroCommands) - : m_universeClient(move(universeClient)), m_cinematicOverlay(move(cinematicOverlay)), - m_paneManager(paneManager), m_macroCommands(move(macroCommands)) { + : m_universeClient(std::move(universeClient)), m_cinematicOverlay(std::move(cinematicOverlay)), + m_paneManager(paneManager), m_macroCommands(std::move(macroCommands)) { m_builtinCommands = { {"reload", bind(&ClientCommandProcessor::reload, this)}, {"whoami", bind(&ClientCommandProcessor::whoami, this)}, diff --git a/source/frontend/StarConfirmationDialog.cpp b/source/frontend/StarConfirmationDialog.cpp index 0fdad09..038ebef 100644 --- a/source/frontend/StarConfirmationDialog.cpp +++ b/source/frontend/StarConfirmationDialog.cpp @@ -29,8 +29,8 @@ void ConfirmationDialog::displayConfirmation(Json const& dialogConfig, WidgetCal GuiReader reader; - m_okCallback = move(okCallback); - m_cancelCallback = move(cancelCallback); + m_okCallback = std::move(okCallback); + m_cancelCallback = std::move(cancelCallback); reader.registerCallback("close", bind(&ConfirmationDialog::dismiss, this)); reader.registerCallback("cancel", bind(&ConfirmationDialog::dismiss, this)); diff --git a/source/frontend/StarContainerInteractor.cpp b/source/frontend/StarContainerInteractor.cpp index 2500f77..47a9de2 100644 --- a/source/frontend/StarContainerInteractor.cpp +++ b/source/frontend/StarContainerInteractor.cpp @@ -5,7 +5,7 @@ namespace Star { void ContainerInteractor::openContainer(ContainerEntityPtr containerEntity) { if (m_openContainer && m_openContainer->inWorld()) m_openContainer->containerClose(); - m_openContainer = move(containerEntity); + m_openContainer = std::move(containerEntity); if (m_openContainer) { starAssert(m_openContainer->inWorld()); m_openContainer->containerOpen(); diff --git a/source/frontend/StarContainerInterface.cpp b/source/frontend/StarContainerInterface.cpp index d69138a..5a06d04 100644 --- a/source/frontend/StarContainerInterface.cpp +++ b/source/frontend/StarContainerInterface.cpp @@ -24,7 +24,7 @@ namespace Star { ContainerPane::ContainerPane(WorldClientPtr worldClient, PlayerPtr player, ContainerInteractorPtr containerInteractor) { m_worldClient = worldClient; m_player = player; - m_containerInteractor = move(containerInteractor); + m_containerInteractor = std::move(containerInteractor); auto container = m_containerInteractor->openContainer(); auto guiConfig = container->containerGuiConfig(); diff --git a/source/frontend/StarCraftingInterface.cpp b/source/frontend/StarCraftingInterface.cpp index b363b92..34e0265 100644 --- a/source/frontend/StarCraftingInterface.cpp +++ b/source/frontend/StarCraftingInterface.cpp @@ -29,8 +29,8 @@ namespace Star { CraftingPane::CraftingPane(WorldClientPtr worldClient, PlayerPtr player, Json const& settings, EntityId sourceEntityId) { - m_worldClient = move(worldClient); - m_player = move(player); + m_worldClient = std::move(worldClient); + m_player = std::move(player); m_blueprints = m_player->blueprints(); m_recipeAutorefreshCooldown = 0; m_sourceEntityId = sourceEntityId; diff --git a/source/frontend/StarInterfaceLuaBindings.cpp b/source/frontend/StarInterfaceLuaBindings.cpp index e64a92b..a023a71 100644 --- a/source/frontend/StarInterfaceLuaBindings.cpp +++ b/source/frontend/StarInterfaceLuaBindings.cpp @@ -30,7 +30,7 @@ LuaCallbacks LuaBindings::makeInterfaceCallbacks(MainInterface* mainInterface) { paneManager->displayRegisteredPane(pane); }); - callbacks.registerCallback("scale", [mainInterface]() -> int { + callbacks.registerCallback("scale", []() -> int { return GuiContext::singleton().interfaceScale(); }); diff --git a/source/frontend/StarInventory.cpp b/source/frontend/StarInventory.cpp index b73b33e..390558c 100644 --- a/source/frontend/StarInventory.cpp +++ b/source/frontend/StarInventory.cpp @@ -25,8 +25,8 @@ namespace Star { InventoryPane::InventoryPane(MainInterface* parent, PlayerPtr player, ContainerInteractorPtr containerInteractor) { m_parent = parent; - m_player = move(player); - m_containerInteractor = move(containerInteractor); + m_player = std::move(player); + m_containerInteractor = std::move(containerInteractor); GuiReader invWindowReader; auto config = Root::singleton().assets()->json("/interface/windowconfig/playerinventory.config"); diff --git a/source/frontend/StarJoinRequestDialog.cpp b/source/frontend/StarJoinRequestDialog.cpp index 1966265..0bc71d8 100644 --- a/source/frontend/StarJoinRequestDialog.cpp +++ b/source/frontend/StarJoinRequestDialog.cpp @@ -18,7 +18,7 @@ void JoinRequestDialog::displayRequest(String const& userName, function<void(P2P GuiReader reader; - m_callback = move(callback); + m_callback = std::move(callback); reader.registerCallback("yes", [this](Widget*){ reply(P2PJoinRequestReply::Yes); }); reader.registerCallback("no", [this](Widget*){ reply(P2PJoinRequestReply::No); }); diff --git a/source/frontend/StarMainInterface.cpp b/source/frontend/StarMainInterface.cpp index a0ed3ae..ec4684b 100644 --- a/source/frontend/StarMainInterface.cpp +++ b/source/frontend/StarMainInterface.cpp @@ -1142,7 +1142,7 @@ void MainInterface::renderMonsterHealthBar() { Drawable::scaleAll(portrait, 1.0f / m_portraitScale); for (auto drawable : portrait) - m_guiContext->drawDrawable(move(drawable), backgroundCenterPos + portraitOffset, portraitScale); + m_guiContext->drawDrawable(std::move(drawable), backgroundCenterPos + portraitOffset, portraitScale); m_guiContext->resetInterfaceScissorRect(); } diff --git a/source/frontend/StarMainMixer.cpp b/source/frontend/StarMainMixer.cpp index a0f5e2b..fe676d5 100644 --- a/source/frontend/StarMainMixer.cpp +++ b/source/frontend/StarMainMixer.cpp @@ -16,11 +16,11 @@ MainMixer::MainMixer(unsigned sampleRate, unsigned channels) { } void MainMixer::setUniverseClient(UniverseClientPtr universeClient) { - m_universeClient = move(universeClient); + m_universeClient = std::move(universeClient); } void MainMixer::setWorldPainter(WorldPainterPtr worldPainter) { - m_worldPainter = move(worldPainter); + m_worldPainter = std::move(worldPainter); } void MainMixer::update(float dt, bool muteSfx, bool muteMusic) { diff --git a/source/frontend/StarMerchantInterface.cpp b/source/frontend/StarMerchantInterface.cpp index 17f4995..ec17391 100644 --- a/source/frontend/StarMerchantInterface.cpp +++ b/source/frontend/StarMerchantInterface.cpp @@ -23,8 +23,8 @@ namespace Star { MerchantPane::MerchantPane( WorldClientPtr worldClient, PlayerPtr player, Json const& settings, EntityId sourceEntityId) { - m_worldClient = move(worldClient); - m_player = move(player); + m_worldClient = std::move(worldClient); + m_player = std::move(player); m_sourceEntityId = sourceEntityId; auto assets = Root::singleton().assets(); diff --git a/source/frontend/StarNameplatePainter.cpp b/source/frontend/StarNameplatePainter.cpp index fe9d829..4637232 100644 --- a/source/frontend/StarNameplatePainter.cpp +++ b/source/frontend/StarNameplatePainter.cpp @@ -44,7 +44,7 @@ void NameplatePainter::update(float dt, WorldClientPtr const& world, WorldCamera if (!m_entitiesWithNametags.contains(entity->entityId())) { Nametag nametag = {entity->name(), entity->statusText(), entity->nametagColor(), 1.0f, entity->entityId()}; RectF boundBox = determineBoundBox(Vec2F(), nametag); - m_nametags.addBubble(Vec2F(), boundBox, move(nametag)); + m_nametags.addBubble(Vec2F(), boundBox, std::move(nametag)); } } @@ -69,7 +69,7 @@ void NameplatePainter::update(float dt, WorldClientPtr const& world, WorldCamera } }); - m_entitiesWithNametags = move(foundEntities); + m_entitiesWithNametags = std::move(foundEntities); m_nametags.update(dt); } diff --git a/source/frontend/StarQuestInterface.cpp b/source/frontend/StarQuestInterface.cpp index d9f0b1b..b862b31 100644 --- a/source/frontend/StarQuestInterface.cpp +++ b/source/frontend/StarQuestInterface.cpp @@ -287,7 +287,7 @@ void QuestLogInterface::showQuests(List<QuestPtr> quests) { verticalLayout->update(0); } -QuestPane::QuestPane(QuestPtr const& quest, PlayerPtr player) : Pane(), m_quest(quest), m_player(move(player)) {} +QuestPane::QuestPane(QuestPtr const& quest, PlayerPtr player) : Pane(), m_quest(quest), m_player(std::move(player)) {} void QuestPane::commonSetup(Json config, String bodyText, String const& portraitName) { GuiReader reader; @@ -348,7 +348,7 @@ PanePtr QuestPane::createTooltip(Vec2I const& screenPosition) { } NewQuestInterface::NewQuestInterface(QuestManagerPtr const& manager, QuestPtr const& quest, PlayerPtr player) - : QuestPane(quest, move(player)), m_manager(manager), m_declined(false) { + : QuestPane(quest, std::move(player)), m_manager(manager), m_declined(false) { auto assets = Root::singleton().assets(); List<Drawable> objectivePortrait = m_quest->portrait("Objective").value({}); @@ -436,7 +436,7 @@ void QuestCompleteInterface::close() { dismiss(); } -QuestFailedInterface::QuestFailedInterface(QuestPtr const& quest, PlayerPtr player) : QuestPane(quest, move(player)) { +QuestFailedInterface::QuestFailedInterface(QuestPtr const& quest, PlayerPtr player) : QuestPane(quest, std::move(player)) { auto assets = Root::singleton().assets(); String configFile = m_quest->getTemplate()->questFailedGuiConfig.value(assets->json("/quests/quests.config:defaultGuiConfigs.questFailed").toString()); Json config = assets->json(configFile); diff --git a/source/frontend/StarScriptPane.cpp b/source/frontend/StarScriptPane.cpp index 2105680..c98bd2c 100644 --- a/source/frontend/StarScriptPane.cpp +++ b/source/frontend/StarScriptPane.cpp @@ -25,7 +25,7 @@ ScriptPane::ScriptPane(UniverseClientPtr client, Json config, EntityId sourceEnt auto& root = Root::singleton(); auto assets = root.assets(); - m_client = move(client); + m_client = std::move(client); m_sourceEntityId = sourceEntityId; m_script.addCallbacks("player", LuaBindings::makePlayerCallbacks(m_client->mainPlayer().get())); diff --git a/source/frontend/StarSongbookInterface.cpp b/source/frontend/StarSongbookInterface.cpp index 4848f4e..8ccb437 100644 --- a/source/frontend/StarSongbookInterface.cpp +++ b/source/frontend/StarSongbookInterface.cpp @@ -10,7 +10,7 @@ namespace Star { SongbookInterface::SongbookInterface(PlayerPtr player) { - m_player = move(player); + m_player = std::move(player); auto assets = Root::singleton().assets(); diff --git a/source/frontend/StarTeamBar.cpp b/source/frontend/StarTeamBar.cpp index f34961b..d0c23c5 100644 --- a/source/frontend/StarTeamBar.cpp +++ b/source/frontend/StarTeamBar.cpp @@ -195,7 +195,7 @@ void TeamBar::buildTeamBar() { List<Drawable> drawables = member.portrait; Drawable::scaleAll(drawables, portraitScale); - cell->fetchChild<ImageWidget>("portrait")->setDrawables(move(drawables)); + cell->fetchChild<ImageWidget>("portrait")->setDrawables(std::move(drawables)); if (member.world == m_client->playerWorld() && m_client->worldClient()) { auto mpos = member.position; diff --git a/source/frontend/StarTitleScreen.cpp b/source/frontend/StarTitleScreen.cpp index f9f16bd..895e88a 100644 --- a/source/frontend/StarTitleScreen.cpp +++ b/source/frontend/StarTitleScreen.cpp @@ -50,7 +50,7 @@ TitleScreen::TitleScreen(PlayerStoragePtr playerStorage, MixerPtr mixer) } void TitleScreen::renderInit(RendererPtr renderer) { - m_renderer = move(renderer); + m_renderer = std::move(renderer); m_environmentPainter = make_shared<EnvironmentPainter>(m_renderer); } @@ -181,7 +181,7 @@ String TitleScreen::multiPlayerAddress() const { void TitleScreen::setMultiPlayerAddress(String address) { m_multiPlayerMenu->fetchChild<TextBoxWidget>("address")->setText(address); - m_connectionAddress = move(address); + m_connectionAddress = std::move(address); } String TitleScreen::multiPlayerPort() const { @@ -190,7 +190,7 @@ String TitleScreen::multiPlayerPort() const { void TitleScreen::setMultiPlayerPort(String port) { m_multiPlayerMenu->fetchChild<TextBoxWidget>("port")->setText(port); - m_connectionPort = move(port); + m_connectionPort = std::move(port); } String TitleScreen::multiPlayerAccount() const { @@ -199,7 +199,7 @@ String TitleScreen::multiPlayerAccount() const { void TitleScreen::setMultiPlayerAccount(String account) { m_multiPlayerMenu->fetchChild<TextBoxWidget>("account")->setText(account); - m_account = move(account); + m_account = std::move(account); } String TitleScreen::multiPlayerPassword() const { @@ -208,7 +208,7 @@ String TitleScreen::multiPlayerPassword() const { void TitleScreen::setMultiPlayerPassword(String password) { m_multiPlayerMenu->fetchChild<TextBoxWidget>("password")->setText(password); - m_password = move(password); + m_password = std::move(password); } void TitleScreen::initMainMenu() { diff --git a/source/frontend/StarVoice.cpp b/source/frontend/StarVoice.cpp index 168d23b..f7155e6 100644 --- a/source/frontend/StarVoice.cpp +++ b/source/frontend/StarVoice.cpp @@ -61,7 +61,8 @@ float getAudioLoudness(int16_t* data, size_t samples, float volume = 1.0f) { return highest; } -struct VoiceAudioStream { +class VoiceAudioStream { +public: // TODO: This should really be a ring buffer instead. std::queue<int16_t> samples; SDL_AudioStream* sdlAudioStreamMono; @@ -173,7 +174,7 @@ template <typename T> inline bool change(T& value, T newValue, bool& out) { bool changed = value != newValue; out |= changed; - value = move(newValue); + value = std::move(newValue); return changed; } @@ -480,7 +481,7 @@ int Voice::send(DataStreamBuffer& out, size_t budget) { if (m_encodedChunks.empty()) return 0; - std::vector<ByteArray> encodedChunks = move(m_encodedChunks); + std::vector<ByteArray> encodedChunks = std::move(m_encodedChunks); size_t encodedChunksLength = m_encodedChunksLength; m_encodedChunksLength = 0; @@ -692,7 +693,7 @@ void Voice::thread() { { MutexLocker lock(m_encodeMutex); - m_encodedChunks.emplace_back(move(encoded)); + m_encodedChunks.emplace_back(std::move(encoded)); m_encodedChunksLength += encodedSize; encoded = ByteArray(VOICE_MAX_PACKET_SIZE, 0); |