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/core/StarOptionParser.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'source/core/StarOptionParser.cpp') diff --git a/source/core/StarOptionParser.cpp b/source/core/StarOptionParser.cpp index f849f43..3cd32cc 100644 --- a/source/core/StarOptionParser.cpp +++ b/source/core/StarOptionParser.cpp @@ -4,29 +4,29 @@ namespace Star { void OptionParser::setCommandName(String commandName) { - m_commandName = move(commandName); + m_commandName = std::move(commandName); } void OptionParser::setSummary(String summary) { - m_summary = move(summary); + m_summary = std::move(summary); } void OptionParser::setAdditionalHelp(String help) { - m_additionalHelp = move(help); + m_additionalHelp = std::move(help); } void OptionParser::addSwitch(String const& flag, String description) { - if (!m_options.insert(flag, Switch{flag, move(description)}).second) + if (!m_options.insert(flag, Switch{flag, std::move(description)}).second) throw OptionParserException::format("Duplicate switch '-{}' added", flag); } void OptionParser::addParameter(String const& flag, String argument, RequirementMode requirementMode, String description) { - if (!m_options.insert(flag, Parameter{flag, move(argument), requirementMode, move(description)}).second) + if (!m_options.insert(flag, Parameter{flag, std::move(argument), requirementMode, std::move(description)}).second) throw OptionParserException::format("Duplicate flag '-{}' added", flag); } void OptionParser::addArgument(String argument, RequirementMode requirementMode, String description) { - m_arguments.append(Argument{move(argument), requirementMode, move(description)}); + m_arguments.append(Argument{std::move(argument), requirementMode, std::move(description)}); } pair OptionParser::parseOptions(StringList const& arguments) const { @@ -51,7 +51,7 @@ pair OptionParser::parseOptions(StringList co } if (option->is()) { - result.switches.add(move(flag)); + result.switches.add(std::move(flag)); } else { auto const& parameter = option->get(); if (!it.hasNext()) { @@ -63,7 +63,7 @@ pair OptionParser::parseOptions(StringList co errors.append(strf("Option with argument '-{}' specified multiple times", flag)); continue; } - result.parameters[move(flag)].append(move(val)); + result.parameters[std::move(flag)].append(std::move(val)); } } else { @@ -96,7 +96,7 @@ pair OptionParser::parseOptions(StringList co errors.append(strf( "Too many positional arguments given, expected at most {} got {}", maximumArguments, result.arguments.size())); - return {move(result), move(errors)}; + return {std::move(result), std::move(errors)}; } void OptionParser::printHelp(std::ostream& os) const { -- cgit v1.2.3