From fff28c57561a08858fc4cef3a4386f53227e2108 Mon Sep 17 00:00:00 2001 From: Jean-Marc Lasgouttes Date: Fri, 21 Oct 2022 14:11:36 +0200 Subject: [PATCH] Always qualify calls to std::move() This quashes a new warning in clang++ 15, when std::move() (the one-parameter version) is used as simply move(). There is a strong recommendation from WG21 to avoid that. Details here: https://reviews.llvm.org/D119670 It might be that we should not use that many move()s. I am not competent to decide on that. I also used this occasion to get rid of a spacial casing for C++11 that does not seem necessary after all. --- src/BufferParams.cpp | 2 +- src/LaTeXFeatures.cpp | 4 ++-- src/MetricsInfo.cpp | 6 +----- src/TexRow.cpp | 6 +++--- src/TocBackend.cpp | 2 +- src/frontends/qt/Action.cpp | 2 +- src/insets/InsetArgument.cpp | 2 +- src/insets/InsetFloat.cpp | 2 +- src/insets/InsetListings.cpp | 8 ++++---- src/insets/InsetText.cpp | 2 +- src/support/unicode.cpp | 4 ++-- src/texstream.cpp | 8 ++++---- 12 files changed, 22 insertions(+), 26 deletions(-) diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 74270bba5c..f7516fc026 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -2277,7 +2277,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features, if (!tmppreamble.str.empty()) atlyxpreamble << "\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% " "LyX specific LaTeX commands.\n" - << move(tmppreamble) + << std::move(tmppreamble) << '\n'; } // the text class specific preamble diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index 7e65c4280f..bcf9ddc82d 100644 --- a/src/LaTeXFeatures.cpp +++ b/src/LaTeXFeatures.cpp @@ -837,7 +837,7 @@ void addSnippet(std::list & list, TexString ts, bool allow_dupes) return ts.str == ts2.str; }) ) - list.push_back(move(ts)); + list.push_back(std::move(ts)); } @@ -854,7 +854,7 @@ TexString getSnippets(std::list const & list) void LaTeXFeatures::addPreambleSnippet(TexString snippet, bool allow_dupes) { - addSnippet(preamble_snippets_, move(snippet), allow_dupes); + addSnippet(preamble_snippets_, std::move(snippet), allow_dupes); } diff --git a/src/MetricsInfo.cpp b/src/MetricsInfo.cpp index 4688d128eb..92ed4a7eb3 100644 --- a/src/MetricsInfo.cpp +++ b/src/MetricsInfo.cpp @@ -33,7 +33,7 @@ namespace lyx { ///////////////////////////////////////////////////////////////////////// MetricsBase::MetricsBase(BufferView * b, FontInfo f, int w) - : bv(b), font(move(f)), fontname("mathnormal"), + : bv(b), font(std::move(f)), fontname("mathnormal"), textwidth(w), macro_nesting(0), solid_line_thickness_(1), solid_line_offset_(1), dotted_line_thickness_(1) { @@ -75,11 +75,7 @@ Changer MetricsBase::changeFontSet(string const & name) && ((isTextFont(oldname) && oldcolor != Color_foreground) || (isMathFont(oldname) && oldcolor != Color_math))) font.setColor(oldcolor); -#if __cplusplus >= 201402L return rc; -#else - return move(rc); -#endif } diff --git a/src/TexRow.cpp b/src/TexRow.cpp index 0d6596680b..9c20f25df9 100644 --- a/src/TexRow.cpp +++ b/src/TexRow.cpp @@ -38,14 +38,14 @@ namespace lyx { TexString::TexString(docstring s) - : str(move(s)), texrow(TexRow()) + : str(std::move(s)), texrow(TexRow()) { texrow.setRows(1 + count(str.begin(), str.end(), '\n')); } TexString::TexString(docstring s, TexRow t) - : str(move(s)), texrow(move(t)) + : str(std::move(s)), texrow(std::move(t)) { validate(); } @@ -235,7 +235,7 @@ void TexRow::append(TexRow other) RowList::iterator it = other.rowlist_.begin(); RowList::iterator const end = other.rowlist_.end(); LASSERT(it != end, return); - currentRow().append(move(*it++)); + currentRow().append(std::move(*it++)); move(it, end, back_inserter(rowlist_)); } diff --git a/src/TocBackend.cpp b/src/TocBackend.cpp index 859e6e86e8..c0a4373923 100644 --- a/src/TocBackend.cpp +++ b/src/TocBackend.cpp @@ -147,7 +147,7 @@ shared_ptr TocBackend::toc(string const & type) TocBuilder & TocBackend::builder(string const & type) { auto p = lyx::make_unique(toc(type)); - return * builders_.insert(make_pair(type, move(p))).first->second; + return * builders_.insert(make_pair(type, std::move(p))).first->second; } diff --git a/src/frontends/qt/Action.cpp b/src/frontends/qt/Action.cpp index cc16190829..818aca0f07 100644 --- a/src/frontends/qt/Action.cpp +++ b/src/frontends/qt/Action.cpp @@ -34,7 +34,7 @@ namespace frontend { Action::Action(FuncRequest func, QIcon const & icon, QString const & text, QString const & tooltip, QObject * parent) - : QAction(parent), func_(make_shared(move(func))), icon_(icon) + : QAction(parent), func_(make_shared(std::move(func))), icon_(icon) { init(text, tooltip); } diff --git a/src/insets/InsetArgument.cpp b/src/insets/InsetArgument.cpp index 88085cfb03..89ed730b83 100644 --- a/src/insets/InsetArgument.cpp +++ b/src/insets/InsetArgument.cpp @@ -356,7 +356,7 @@ void InsetArgument::latexArgument(otexstream & os, os << presetarg; if (!presetarg.empty() && !ts.str.empty()) os << ", "; - os << move(ts); + os << std::move(ts); if (add_braces) os << '}'; os << rdelim; diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp index 0c9f3d48c5..b06ef0b2e0 100644 --- a/src/insets/InsetFloat.cpp +++ b/src/insets/InsetFloat.cpp @@ -965,7 +965,7 @@ TexString InsetFloat::getCaption(OutputParams const & runparams) const // Protect ']' if (arg.find(']') != docstring::npos) arg = '{' + arg + '}'; - os << move(ts); + os << std::move(ts); os << ']'; if (!runparams.nice) os << safebreakln; diff --git a/src/insets/InsetListings.cpp b/src/insets/InsetListings.cpp index 67a0462085..5afc432726 100644 --- a/src/insets/InsetListings.cpp +++ b/src/insets/InsetListings.cpp @@ -369,7 +369,7 @@ void InsetListings::latex(otexstream & os, OutputParams const & runparams) const os << '[' << float_placement << "]"; } else if (captionfirst && !caption.str.empty()) { os << breakln << "\\lyxmintcaption[t]{" - << move(caption) << "}\n"; + << std::move(caption) << "}\n"; } os << breakln << "\\begin{minted}"; if (!param_string.empty()) @@ -378,11 +378,11 @@ void InsetListings::latex(otexstream & os, OutputParams const & runparams) const << code << breakln << "\\end{minted}\n"; if (isfloat) { if (!caption.str.empty()) - os << "\\caption{" << move(caption) << "}\n"; + os << "\\caption{" << std::move(caption) << "}\n"; os << "\\end{listing}\n"; } else if (!captionfirst && !caption.str.empty()) { os << breakln << "\\lyxmintcaption[b]{" - << move(caption) << "}"; + << std::move(caption) << "}"; } } else { OutputParams rp = runparams; @@ -396,7 +396,7 @@ void InsetListings::latex(otexstream & os, OutputParams const & runparams) const os << safebreakln; os << "["; if (!caption.str.empty()) { - os << "caption={" << move(caption) << '}'; + os << "caption={" << std::move(caption) << '}'; if (!param_string.empty()) os << ','; } diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index 08144d2091..12e5996cd4 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -1118,7 +1118,7 @@ void InsetText::updateBuffer(ParIterator const & it, UpdateType utype, bool cons tclass.counters().current_float(savecnt.current_float()); tclass.counters().isSubfloat(savecnt.isSubfloat()); buffer().updateBuffer(it2, utype, deleted); - tclass.counters() = move(savecnt); + tclass.counters() = std::move(savecnt); } } diff --git a/src/support/unicode.cpp b/src/support/unicode.cpp index d84d81ac3d..073b7e818d 100644 --- a/src/support/unicode.cpp +++ b/src/support/unicode.cpp @@ -61,7 +61,7 @@ struct IconvProcessor::Handler { IconvProcessor::IconvProcessor(string tocode, string fromcode) - : tocode_(move(tocode)), fromcode_(move(fromcode)) + : tocode_(std::move(tocode)), fromcode_(std::move(fromcode)) {} @@ -251,7 +251,7 @@ IconvProcessor & getProc(map & processors, map::iterator const it = processors.find(encoding); if (it == processors.end()) { IconvProcessor p(fromcode, tocode); - return processors.insert(make_pair(encoding, move(p))).first->second; + return processors.insert(make_pair(encoding, std::move(p))).first->second; } return it->second; } diff --git a/src/texstream.cpp b/src/texstream.cpp index 1523ca9470..891367ce44 100644 --- a/src/texstream.cpp +++ b/src/texstream.cpp @@ -90,7 +90,7 @@ size_t otexstringstream::length() TexString otexstringstream::release() { - TexString ts(ods_.str(), move(texrow())); + TexString ts(ods_.str(), std::move(texrow())); // reset this texrow() = TexRow(); ods_.clear(); @@ -164,8 +164,8 @@ otexstream & operator<<(otexstream & ots, odocstream_manip pf) otexrowstream & operator<<(otexrowstream & ots, TexString ts) { ts.validate(); - ots.os() << move(ts.str); - ots.texrow().append(move(ts.texrow)); + ots.os() << std::move(ts.str); + ots.texrow().append(std::move(ts.texrow)); return ots; } @@ -201,7 +201,7 @@ otexstream & operator<<(otexstream & ots, TexString ts) ots.canBreakLine(ts.str[len - 2] != '\n'); ots.lastChar(ts.str[len - 1]); - otrs << move(ts); + otrs << std::move(ts); return ots; } -- 2.39.2