From b31ded3130b73e1eef869c7480de2a5b348a577a Mon Sep 17 00:00:00 2001 From: Bernard Normier Date: Wed, 11 Dec 2024 14:24:40 -0500 Subject: [PATCH] Fix lints in generated code --- cpp/src/slice2cpp/CPlusPlusUtil.cpp | 2 +- cpp/src/slice2cpp/Gen.cpp | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/cpp/src/slice2cpp/CPlusPlusUtil.cpp b/cpp/src/slice2cpp/CPlusPlusUtil.cpp index 59e71701eca..07a1d5f44fc 100644 --- a/cpp/src/slice2cpp/CPlusPlusUtil.cpp +++ b/cpp/src/slice2cpp/CPlusPlusUtil.cpp @@ -936,7 +936,7 @@ Slice::writeIceTuple(::IceInternal::Output& out, const DataMemberList& dataMembe { // Use an empty scope to get full qualified names from calls to typeToString. const string scope = ""; - out << nl << "std::tuple<"; + out << nl << "[[nodiscard]] std::tuple<"; for (DataMemberList::const_iterator q = dataMembers.begin(); q != dataMembers.end(); ++q) { if (q != dataMembers.begin()) diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 80804837e1f..6a889298aa2 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -708,8 +708,8 @@ Slice::Gen::generate(const UnitPtr& p) s = _include + '/' + s; } transform(s.begin(), s.end(), s.begin(), ToIfdef()); - H << "\n#ifndef __" << s << "__"; - H << "\n#define __" << s << "__"; + H << "\n#ifndef " << s << "_"; + H << "\n#define " << s << "_"; H << '\n'; validateMetadata(p); @@ -1393,13 +1393,21 @@ Slice::Gen::ProxyVisitor::visitInterfaceDefEnd(const InterfaceDefPtr& p) H << sp; H << nl << prx << "& operator=(const " << prx << "& rhs) noexcept"; H << sb; + // The self-assignment check is to make clang-tidy happy. + H << nl << "if (this != &rhs)"; + H << sb; H << nl << "::Ice::ObjectPrx::operator=(rhs);"; + H << eb; H << nl << "return *this;"; H << eb; H << sp; H << nl << prx << "& operator=(" << prx << "&& rhs) noexcept"; H << sb; + // The self-assignment check is to make clang-tidy happy. + H << nl << "if (this != &rhs)"; + H << sb; H << nl << "::Ice::ObjectPrx::operator=(::std::move(rhs));"; + H << eb; H << nl << "return *this;"; H << eb; H << sp;