diff options
author | Julian Andres Klode <jak@debian.org> | 2023-02-07 15:12:11 +0000 |
---|---|---|
committer | Julian Andres Klode <jak@debian.org> | 2023-02-07 15:12:11 +0000 |
commit | 2ad49c2b0bc213db77ac762c7b7d622acb1a92e4 (patch) | |
tree | 9324f1de8fdcddb0377f41937a206aa9208a023a | |
parent | 2b3cda814176dcf4ccf92f38ce85e6b7cda0b88f (diff) | |
parent | 0ac3afe29cfc71c657853f06961c6c8ba9c09e5c (diff) |
Merge branch 'fix/gccwarnings' into 'main'
Build with and fix warnings of gcc-13
See merge request apt-team/apt!280
-rw-r--r-- | apt-pkg/acquire.cc | 3 | ||||
-rw-r--r-- | apt-pkg/cachefilter.h | 66 | ||||
-rw-r--r-- | apt-pkg/contrib/mmap.cc | 1 | ||||
-rw-r--r-- | apt-pkg/install-progress.cc | 2 | ||||
-rw-r--r-- | ftparchive/apt-ftparchive.cc | 6 | ||||
-rw-r--r-- | methods/ftp.cc | 2 | ||||
-rw-r--r-- | methods/http.cc | 2 | ||||
-rw-r--r-- | methods/rsh.cc | 2 |
8 files changed, 44 insertions, 40 deletions
diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index dd0624ad6..cdb2c5257 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -1470,7 +1470,8 @@ bool pkgAcquireStatus::Pulse(pkgAcquire *Owner) std::string msg; long i = CurrentItems < TotalItems ? CurrentItems + 1 : CurrentItems; // only show the ETA if it makes sense - if (ETA > 0 && ETA < std::chrono::seconds(std::chrono::hours(24 * 2)).count()) + auto const twodays = std::chrono::seconds(std::chrono::hours(24 * 2)).count(); + if (ETA > 0 && ETA < static_cast<decltype(ETA)>(twodays)) strprintf(msg, _("Retrieving file %li of %li (%s remaining)"), i, TotalItems, TimeToStr(ETA).c_str()); else strprintf(msg, _("Retrieving file %li of %li"), i, TotalItems); diff --git a/apt-pkg/cachefilter.h b/apt-pkg/cachefilter.h index ccff6f9a3..1b5f9aa71 100644 --- a/apt-pkg/cachefilter.h +++ b/apt-pkg/cachefilter.h @@ -30,35 +30,35 @@ public: class APT_PUBLIC PackageMatcher : public Matcher { public: - virtual bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE = 0; - virtual bool operator() (pkgCache::VerIterator const &Ver) APT_OVERRIDE { return (*this)(Ver.ParentPkg()); } - virtual bool operator() (pkgCache::GrpIterator const &/*Grp*/) APT_OVERRIDE { return false; } - virtual ~PackageMatcher(); + bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE = 0; + bool operator() (pkgCache::VerIterator const &Ver) APT_OVERRIDE { return (*this)(Ver.ParentPkg()); } + bool operator() (pkgCache::GrpIterator const &/*Grp*/) APT_OVERRIDE { return false; } + ~PackageMatcher() APT_OVERRIDE; }; // Generica like True, False, NOT, AND, OR /*{{{*/ class APT_PUBLIC TrueMatcher : public Matcher { public: - virtual bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE; - virtual bool operator() (pkgCache::GrpIterator const &Grp) APT_OVERRIDE; - virtual bool operator() (pkgCache::VerIterator const &Ver) APT_OVERRIDE; + bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE; + bool operator() (pkgCache::GrpIterator const &Grp) APT_OVERRIDE; + bool operator() (pkgCache::VerIterator const &Ver) APT_OVERRIDE; }; class APT_PUBLIC FalseMatcher : public Matcher { public: - virtual bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE; - virtual bool operator() (pkgCache::GrpIterator const &Grp) APT_OVERRIDE; - virtual bool operator() (pkgCache::VerIterator const &Ver) APT_OVERRIDE; + bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE; + bool operator() (pkgCache::GrpIterator const &Grp) APT_OVERRIDE; + bool operator() (pkgCache::VerIterator const &Ver) APT_OVERRIDE; }; class APT_PUBLIC NOTMatcher : public Matcher { Matcher * const matcher; public: explicit NOTMatcher(Matcher * const matcher); - virtual bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE; - virtual bool operator() (pkgCache::GrpIterator const &Grp) APT_OVERRIDE; - virtual bool operator() (pkgCache::VerIterator const &Ver) APT_OVERRIDE; - virtual ~NOTMatcher(); + bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE; + bool operator() (pkgCache::GrpIterator const &Grp) APT_OVERRIDE; + bool operator() (pkgCache::VerIterator const &Ver) APT_OVERRIDE; + ~NOTMatcher() APT_OVERRIDE; }; class APT_PUBLIC ANDMatcher : public Matcher { @@ -72,10 +72,10 @@ public: ANDMatcher(Matcher * const matcher1, Matcher * const matcher2, Matcher * const matcher3, Matcher * const matcher4); ANDMatcher(Matcher * const matcher1, Matcher * const matcher2, Matcher * const matcher3, Matcher * const matcher4, Matcher * const matcher5); ANDMatcher& AND(Matcher * const matcher); - virtual bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE; - virtual bool operator() (pkgCache::GrpIterator const &Grp) APT_OVERRIDE; - virtual bool operator() (pkgCache::VerIterator const &Ver) APT_OVERRIDE; - virtual ~ANDMatcher(); + bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE; + bool operator() (pkgCache::GrpIterator const &Grp) APT_OVERRIDE; + bool operator() (pkgCache::VerIterator const &Ver) APT_OVERRIDE; + ~ANDMatcher() APT_OVERRIDE; }; class APT_PUBLIC ORMatcher : public Matcher { std::vector<Matcher *> matchers; @@ -88,28 +88,28 @@ public: ORMatcher(Matcher * const matcher1, Matcher * const matcher2, Matcher * const matcher3, Matcher * const matcher4); ORMatcher(Matcher * const matcher1, Matcher * const matcher2, Matcher * const matcher3, Matcher * const matcher4, Matcher * const matcher5); ORMatcher& OR(Matcher * const matcher); - virtual bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE; - virtual bool operator() (pkgCache::GrpIterator const &Grp) APT_OVERRIDE; - virtual bool operator() (pkgCache::VerIterator const &Ver) APT_OVERRIDE; - virtual ~ORMatcher(); + bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE; + bool operator() (pkgCache::GrpIterator const &Grp) APT_OVERRIDE; + bool operator() (pkgCache::VerIterator const &Ver) APT_OVERRIDE; + ~ORMatcher() APT_OVERRIDE; }; /*}}}*/ class APT_PUBLIC PackageNameMatchesRegEx : public PackageMatcher { /*{{{*/ regex_t* pattern; public: explicit PackageNameMatchesRegEx(std::string const &Pattern); - virtual bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE; - virtual bool operator() (pkgCache::GrpIterator const &Grp) APT_OVERRIDE; - virtual ~PackageNameMatchesRegEx(); + bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE; + bool operator() (pkgCache::GrpIterator const &Grp) APT_OVERRIDE; + ~PackageNameMatchesRegEx() APT_OVERRIDE; }; /*}}}*/ class APT_PUBLIC PackageNameMatchesFnmatch : public PackageMatcher { /*{{{*/ const std::string Pattern; public: explicit PackageNameMatchesFnmatch(std::string const &Pattern); - virtual bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE; - virtual bool operator() (pkgCache::GrpIterator const &Grp) APT_OVERRIDE; - virtual ~PackageNameMatchesFnmatch() {}; + bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE; + bool operator() (pkgCache::GrpIterator const &Grp) APT_OVERRIDE; + ~PackageNameMatchesFnmatch() APT_OVERRIDE = default; }; /*}}}*/ class APT_PUBLIC PackageArchitectureMatchesSpecification : public PackageMatcher { /*{{{*/ @@ -134,16 +134,18 @@ public: */ PackageArchitectureMatchesSpecification(std::string const &pattern, bool const isPattern = true); bool operator() (char const * const &arch); - virtual bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE; - virtual ~PackageArchitectureMatchesSpecification(); + using PackageMatcher::operator(); + bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE; + ~PackageArchitectureMatchesSpecification() APT_OVERRIDE; }; /*}}}*/ class APT_PUBLIC PackageIsNewInstall : public PackageMatcher { /*{{{*/ pkgCacheFile * const Cache; public: explicit PackageIsNewInstall(pkgCacheFile * const Cache); - virtual bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE; - virtual ~PackageIsNewInstall(); + using PackageMatcher::operator(); + bool operator() (pkgCache::PkgIterator const &Pkg) APT_OVERRIDE; + ~PackageIsNewInstall() APT_OVERRIDE; }; /*}}}*/ diff --git a/apt-pkg/contrib/mmap.cc b/apt-pkg/contrib/mmap.cc index 642e20473..0568e1cd0 100644 --- a/apt-pkg/contrib/mmap.cc +++ b/apt-pkg/contrib/mmap.cc @@ -23,6 +23,7 @@ #include <apt-pkg/macros.h> #include <apt-pkg/mmap.h> +#include <cstdint> #include <cstring> #include <string> #include <errno.h> diff --git a/apt-pkg/install-progress.cc b/apt-pkg/install-progress.cc index 8a6d87cd2..c7f7573de 100644 --- a/apt-pkg/install-progress.cc +++ b/apt-pkg/install-progress.cc @@ -237,7 +237,7 @@ PackageManagerFancy::~PackageManagerFancy() signal(SIGWINCH, SIGWINCH_orig); } -void PackageManagerFancy::staticSIGWINCH(int signum) +void PackageManagerFancy::staticSIGWINCH(int /*signum*/) { SIGWINCH_flag = 1; } diff --git a/ftparchive/apt-ftparchive.cc b/ftparchive/apt-ftparchive.cc index bbba0834b..0f6587281 100644 --- a/ftparchive/apt-ftparchive.cc +++ b/ftparchive/apt-ftparchive.cc @@ -116,19 +116,19 @@ struct PackageMap bool SrcDone; time_t ContentsMTime; - struct ContentsCompare : public binary_function<PackageMap,PackageMap,bool> + struct ContentsCompare { inline bool operator() (const PackageMap &x,const PackageMap &y) {return x.ContentsMTime < y.ContentsMTime;}; }; - struct DBCompare : public binary_function<PackageMap,PackageMap,bool> + struct DBCompare { inline bool operator() (const PackageMap &x,const PackageMap &y) {return x.BinCacheDB < y.BinCacheDB;}; }; - struct SrcDBCompare : public binary_function<PackageMap,PackageMap,bool> + struct SrcDBCompare { inline bool operator() (const PackageMap &x,const PackageMap &y) {return x.SrcCacheDB < y.SrcCacheDB;}; diff --git a/methods/ftp.cc b/methods/ftp.cc index 16236232a..aa0c0692c 100644 --- a/methods/ftp.cc +++ b/methods/ftp.cc @@ -1115,7 +1115,7 @@ bool FtpMethod::Fetch(FetchItem *Itm) URIStart(Res); FailFile = Itm->DestFile; - FailFile.c_str(); // Make sure we don't do a malloc in the signal handler + (void)(FailFile.c_str()); // Make sure we don't do a malloc in the signal handler FailFd = Fd.Fd(); bool Missing; diff --git a/methods/http.cc b/methods/http.cc index 2a5ab2cd2..b4519a890 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -1008,7 +1008,7 @@ BaseHttpMethod::DealWithHeadersResult HttpMethod::DealWithHeaders(FetchResult &R return ERROR_NOT_FROM_SERVER; FailFile = Queue->DestFile; - FailFile.c_str(); // Make sure we don't do a malloc in the signal handler + (void)(FailFile.c_str()); // Make sure we don't do a malloc in the signal handler FailFd = Req.File.Fd(); FailTime = Req.Date; diff --git a/methods/rsh.cc b/methods/rsh.cc index 09d72cbc5..68407b062 100644 --- a/methods/rsh.cc +++ b/methods/rsh.cc @@ -501,7 +501,7 @@ bool RSHMethod::Fetch(FetchItem *Itm) URIStart(Res); FailFile = Itm->DestFile; - FailFile.c_str(); // Make sure we don't do a malloc in the signal handler + (void)(FailFile.c_str()); // Make sure we don't do a malloc in the signal handler FailFd = Fd.Fd(); bool Missing; |