From fa19a9ddbdddeaed44480ce7dade11d526336435 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 11 Sep 2024 16:57:04 +0000 Subject: Acknowledge non-erase usage of remove_if for volatile sources MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gcc produces a length warning starting with: | warning: ignoring return value of ‘_FIter std::remove_if(_FIter, _FIter, _Predicate) [with …]’, declared with attribute ‘nodiscard’ [-Wunused-result] which is usually correct, but in the usage here we don't want to call an erase as we operate on a c-style new[] array here which contains pointers into argv and has an explicit sentinel (nullptr) – FileSize() is based on this sentinel. Casting to void silences the warning as is standard practice and hopefully indicates better that this is intended than ignoring the warning for the casual on-looker. --- apt-private/private-install.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-private') diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index 57b5c0d5e..3f05cf9fb 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -986,7 +986,7 @@ std::vector GetAllPackagesAsPseudo(pkgSourceList *const SL, CommandLi std::vector GetPseudoPackages(pkgSourceList *const SL, CommandLine &CmdL, bool (*Add)(pkgSourceList *const, PseudoPkg &&, std::vector &), std::string const &pseudoArch)/*{{{*/ { std::vector VolatileCmdL; - std::remove_if(CmdL.FileList + 1, CmdL.FileList + 1 + CmdL.FileSize(), [&](char const *const I) { + (void)std::remove_if(CmdL.FileList + 1, CmdL.FileList + 1 + CmdL.FileSize(), [&](char const *const I) { return AddIfVolatile(SL, VolatileCmdL, Add, I, pseudoArch); }); return VolatileCmdL; -- cgit v1.2.3-70-g09d2 From 0fb71e375363f2b45b033bb2b324e80214325c61 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 11 Sep 2024 19:52:26 +0000 Subject: Add a virtual destructor to private CacheSet Matcher MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This silences the warning: | warning: ‘class Matcher’ has virtual functions and accessible non-virtual destructor [-Wnon-virtual-dtor] --- apt-private/private-cacheset.h | 1 + 1 file changed, 1 insertion(+) (limited to 'apt-private') diff --git a/apt-private/private-cacheset.h b/apt-private/private-cacheset.h index e8dba5a7d..cad8e4a00 100644 --- a/apt-private/private-cacheset.h +++ b/apt-private/private-cacheset.h @@ -68,6 +68,7 @@ class Matcher { public: virtual bool operator () (const pkgCache::PkgIterator &/*P*/) { return true;} + virtual ~Matcher() = default; }; // FIXME: add default argument for OpProgress (or overloaded function) -- cgit v1.2.3-70-g09d2