From c8a4ce6cbed57ae108dc955d4a850f9b129a0693 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 16 Jun 2015 16:22:46 +0200 Subject: add d-pointer, virtual destructors and de-inline de/constructors To have a chance to keep the ABI for a while we need all three to team up. One of them missing and we might loose, so ensuring that they are available is a very tedious but needed task once in a while. Git-Dch: Ignore --- apt-pkg/algorithms.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'apt-pkg/algorithms.h') diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h index 2ac28c0d7..dab844220 100644 --- a/apt-pkg/algorithms.h +++ b/apt-pkg/algorithms.h @@ -1,6 +1,5 @@ // -*- mode: cpp; mode: fold -*- // Description /*{{{*/ -// $Id: algorithms.h,v 1.10 2001/05/22 04:17:41 jgg Exp $ /* ###################################################################### Algorithms - A set of misc algorithms @@ -55,6 +54,7 @@ using std::ostream; class pkgSimulate : public pkgPackageManager /*{{{*/ { + void *d; protected: class Policy : public pkgDepCache::Policy @@ -88,7 +88,7 @@ private: public: pkgSimulate(pkgDepCache *Cache); - ~pkgSimulate(); + virtual ~pkgSimulate(); }; /*}}}*/ class pkgProblemResolver /*{{{*/ @@ -156,7 +156,7 @@ class pkgProblemResolver /*{{{*/ APT_DEPRECATED void InstallProtect(); pkgProblemResolver(pkgDepCache *Cache); - ~pkgProblemResolver(); + virtual ~pkgProblemResolver(); }; /*}}}*/ bool pkgApplyStatus(pkgDepCache &Cache); -- cgit v1.2.3 From e8afd16892e87a6e2f17c1019ee455f5583387c2 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 17 Jun 2015 00:14:10 +0200 Subject: apply various style suggestions by cppcheck Some of them modify the ABI, but given that we prepare a big one already, these few hardly count for much. Git-Dch: Ignore --- apt-pkg/algorithms.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'apt-pkg/algorithms.h') diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h index dab844220..9c9ceead4 100644 --- a/apt-pkg/algorithms.h +++ b/apt-pkg/algorithms.h @@ -67,7 +67,7 @@ class pkgSimulate : public pkgPackageManager /*{{{*/ return (*Cache)[Pkg].CandidateVerIter(*Cache); } - Policy(pkgDepCache *Cache) : Cache(Cache) {}; + explicit Policy(pkgDepCache *Cache) : Cache(Cache) {}; }; unsigned char *Flags; @@ -87,7 +87,7 @@ private: public: - pkgSimulate(pkgDepCache *Cache); + explicit pkgSimulate(pkgDepCache *Cache); virtual ~pkgSimulate(); }; /*}}}*/ @@ -155,7 +155,7 @@ class pkgProblemResolver /*{{{*/ APT_DEPRECATED void InstallProtect(); - pkgProblemResolver(pkgDepCache *Cache); + explicit pkgProblemResolver(pkgDepCache *Cache); virtual ~pkgProblemResolver(); }; /*}}}*/ -- cgit v1.2.3 From 6c55f07a5fa3612a5d59c61a17da5fe640eadc8b Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 17 Jun 2015 09:29:00 +0200 Subject: make all d-pointer * const pointers Doing this disables the implicit copy assignment operator (among others) which would cause hovac if used on the classes as it would just copy the pointer, not the data the d-pointer points to. For most of the classes we don't need a copy assignment operator anyway and in many classes it was broken before as many contain a pointer of some sort. Only for our Cacheset Container interfaces we define an explicit copy assignment operator which could later be implemented to copy the data from one d-pointer to the other if we need it. Git-Dch: Ignore --- apt-pkg/algorithms.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'apt-pkg/algorithms.h') diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h index 9c9ceead4..d9cce672a 100644 --- a/apt-pkg/algorithms.h +++ b/apt-pkg/algorithms.h @@ -54,7 +54,7 @@ using std::ostream; class pkgSimulate : public pkgPackageManager /*{{{*/ { - void *d; + void * const d; protected: class Policy : public pkgDepCache::Policy @@ -95,7 +95,7 @@ class pkgProblemResolver /*{{{*/ { private: /** \brief dpointer placeholder (for later in case we need it) */ - void *d; + void * const d; pkgDepCache &Cache; typedef pkgCache::PkgIterator PkgIterator; -- cgit v1.2.3 From 3b3028467ceccca0b73a8f53051c0fa4de313111 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 9 Jul 2015 00:35:40 +0200 Subject: add c++11 override marker to overridden methods C++11 adds the 'override' specifier to mark that a method is overriding a base class method and error out if not. We hide it in the APT_OVERRIDE macro to ensure that we keep compiling in pre-c++11 standards. Reported-By: clang-modernize -add-override -override-macros Git-Dch: Ignore --- apt-pkg/algorithms.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'apt-pkg/algorithms.h') diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h index d9cce672a..28057fa5c 100644 --- a/apt-pkg/algorithms.h +++ b/apt-pkg/algorithms.h @@ -62,7 +62,7 @@ class pkgSimulate : public pkgPackageManager /*{{{*/ pkgDepCache *Cache; public: - virtual VerIterator GetCandidateVer(PkgIterator const &Pkg) + virtual VerIterator GetCandidateVer(PkgIterator const &Pkg) APT_OVERRIDE { return (*Cache)[Pkg].CandidateVerIter(*Cache); } @@ -77,9 +77,9 @@ class pkgSimulate : public pkgPackageManager /*{{{*/ pkgDepCache::ActionGroup group; // The Actuall installation implementation - virtual bool Install(PkgIterator Pkg,std::string File); - virtual bool Configure(PkgIterator Pkg); - virtual bool Remove(PkgIterator Pkg,bool Purge); + virtual bool Install(PkgIterator Pkg,std::string File) APT_OVERRIDE; + virtual bool Configure(PkgIterator Pkg) APT_OVERRIDE; + virtual bool Remove(PkgIterator Pkg,bool Purge) APT_OVERRIDE; private: APT_HIDDEN void ShortBreaks(); -- cgit v1.2.3 From 4dc77823d360158d6870a5710cc8c17064f1308f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 15 Jul 2015 13:21:21 +0200 Subject: remove the compatibility markers for 4.13 abi We aren't and we will not be really compatible again with the previous stable abi, so lets drop these markers (which never made it into a released version) for good as they have outlived their intend already. Git-Dch: Ignore --- apt-pkg/algorithms.h | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'apt-pkg/algorithms.h') diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h index 28057fa5c..aad261b63 100644 --- a/apt-pkg/algorithms.h +++ b/apt-pkg/algorithms.h @@ -138,20 +138,10 @@ class pkgProblemResolver /*{{{*/ inline void Clear(pkgCache::PkgIterator Pkg) {Flags[Pkg->ID] &= ~(Protected | ToRemove);}; // Try to intelligently resolve problems by installing and removing packages -#if APT_PKG_ABI >= 413 bool Resolve(bool BrokenFix = false, OpProgress * const Progress = NULL); -#else - bool Resolve(bool BrokenFix = false); - bool Resolve(bool BrokenFix, OpProgress * const Progress); -#endif // Try to resolve problems only by using keep -#if APT_PKG_ABI >= 413 bool ResolveByKeep(OpProgress * const Progress = NULL); -#else - bool ResolveByKeep(); - bool ResolveByKeep(OpProgress * const Progress); -#endif APT_DEPRECATED void InstallProtect(); -- cgit v1.2.3