From 862bafea48af2ceaf96345db237b461307a021f6 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Mon, 13 Oct 2014 08:05:57 +0200 Subject: [PATCH] do not inline virtual destructors with d-pointers Reimplementing an inline method is opening a can of worms we don't want to open if we ever want to us a d-pointer in those classes, so we do the only thing which can save us from hell: move the destructors into the cc sources and we are good. Technically not an ABI break as the methods inline or not do the same (nothing), so a program compiled against the old version still works with the new version (beside that this version is still in experimental, so nothing really has been build against this library anyway). Git-Dch: Ignore --- apt-pkg/acquire-method.cc | 2 ++ apt-pkg/acquire-method.h | 2 +- apt-pkg/acquire.cc | 4 ++++ apt-pkg/acquire.h | 7 +++---- apt-pkg/clean.cc | 2 ++ apt-pkg/clean.h | 8 ++++---- apt-pkg/deb/debindexfile.cc | 14 +++++++------- apt-pkg/deb/debindexfile.h | 12 ++++++------ apt-pkg/deb/deblistparser.cc | 3 +-- apt-pkg/deb/deblistparser.h | 2 +- apt-pkg/deb/debrecords.cc | 2 ++ apt-pkg/deb/debrecords.h | 2 +- apt-pkg/indexcopy.cc | 2 ++ apt-pkg/indexcopy.h | 2 +- apt-pkg/indexrecords.cc | 2 ++ apt-pkg/indexrecords.h | 2 +- apt-pkg/tagfile.cc | 2 ++ apt-pkg/tagfile.h | 2 +- 18 files changed, 43 insertions(+), 29 deletions(-) diff --git a/apt-pkg/acquire-method.cc b/apt-pkg/acquire-method.cc index cfa93e95c..c29ef469e 100644 --- a/apt-pkg/acquire-method.cc +++ b/apt-pkg/acquire-method.cc @@ -477,3 +477,5 @@ void pkgAcqMethod::Dequeue() { /*{{{*/ delete Tmp; } /*}}}*/ + +pkgAcqMethod::~pkgAcqMethod() {} diff --git a/apt-pkg/acquire-method.h b/apt-pkg/acquire-method.h index 675c4f844..48bd95672 100644 --- a/apt-pkg/acquire-method.h +++ b/apt-pkg/acquire-method.h @@ -108,7 +108,7 @@ class pkgAcqMethod inline void SetIP(std::string aIP) {IP = aIP;}; pkgAcqMethod(const char *Ver,unsigned long Flags = 0); - virtual ~pkgAcqMethod() {}; + virtual ~pkgAcqMethod(); void DropPrivsOrDie(); private: APT_HIDDEN void Dequeue(); diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index 9dee1b3cf..34c7f06de 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -1016,3 +1016,7 @@ void pkgAcquireStatus::Fetched(unsigned long long Size,unsigned long long Resume FetchedBytes += Size - Resume; } /*}}}*/ + +pkgAcquire::UriIterator::~UriIterator() {} +pkgAcquire::MethodConfig::~MethodConfig() {} +pkgAcquireStatus::~pkgAcquireStatus() {} diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h index f9eeb1641..a1a192d5f 100644 --- a/apt-pkg/acquire.h +++ b/apt-pkg/acquire.h @@ -603,7 +603,7 @@ class pkgAcquire::UriIterator CurQ = CurQ->Next; } } - virtual ~UriIterator() {}; + virtual ~UriIterator(); }; /*}}}*/ /** \brief Information about the properties of a single acquire method. {{{*/ @@ -661,8 +661,7 @@ struct pkgAcquire::MethodConfig */ MethodConfig(); - /* \brief Destructor, empty currently */ - virtual ~MethodConfig() {}; + virtual ~MethodConfig(); }; /*}}}*/ /** \brief A monitor object for downloads controlled by the pkgAcquire class. {{{ @@ -808,7 +807,7 @@ class pkgAcquireStatus /** \brief Initialize all counters to 0 and the time to the current time. */ pkgAcquireStatus(); - virtual ~pkgAcquireStatus() {}; + virtual ~pkgAcquireStatus(); }; /*}}}*/ /** @} */ diff --git a/apt-pkg/clean.cc b/apt-pkg/clean.cc index 37128e9aa..606f4ec8c 100644 --- a/apt-pkg/clean.cc +++ b/apt-pkg/clean.cc @@ -131,3 +131,5 @@ bool pkgArchiveCleaner::Go(std::string Dir,pkgCache &Cache) return true; } /*}}}*/ + +pkgArchiveCleaner::~pkgArchiveCleaner() {} diff --git a/apt-pkg/clean.h b/apt-pkg/clean.h index 930d54a7f..466cb67a9 100644 --- a/apt-pkg/clean.h +++ b/apt-pkg/clean.h @@ -24,13 +24,13 @@ class pkgArchiveCleaner void *d; protected: - + virtual void Erase(const char * /*File*/,std::string /*Pkg*/,std::string /*Ver*/,struct stat & /*St*/) {}; - public: - + public: + bool Go(std::string Dir,pkgCache &Cache); - virtual ~pkgArchiveCleaner() {}; + virtual ~pkgArchiveCleaner(); }; #endif diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index 9897df53d..cc1d94d81 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -806,8 +806,6 @@ unsigned long debDscFileIndex::Size() const } // DscFileIndex::CreateSrcParser - Get a parser for the .dsc file /*{{{*/ -// --------------------------------------------------------------------- -/* */ pkgSrcRecords::Parser *debDscFileIndex::CreateSrcParser() const { if (!FileExists(DscFile)) @@ -816,11 +814,6 @@ pkgSrcRecords::Parser *debDscFileIndex::CreateSrcParser() const return new debDscRecordParser(DscFile,this); } /*}}}*/ - - - - -// --------------------------------------------------------------------- // Index File types for Debian /*{{{*/ class debIFTypeSrc : public pkgIndexFile::Type { @@ -919,3 +912,10 @@ const pkgIndexFile::Type *debDebianSourceDirIndex::GetType() const return &_apt_DebianSourceDir; } /*}}}*/ + +debStatusIndex::~debStatusIndex() {} +debPackagesIndex::~debPackagesIndex() {} +debTranslationsIndex::~debTranslationsIndex() {} +debSourcesIndex::~debSourcesIndex() {} + +debDebPkgFileIndex::~debDebPkgFileIndex() {} diff --git a/apt-pkg/deb/debindexfile.h b/apt-pkg/deb/debindexfile.h index 2e3ff5451..e5a1a7873 100644 --- a/apt-pkg/deb/debindexfile.h +++ b/apt-pkg/deb/debindexfile.h @@ -52,7 +52,7 @@ class debStatusIndex : public pkgIndexFile virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; debStatusIndex(std::string File); - virtual ~debStatusIndex() {}; + virtual ~debStatusIndex(); }; class debPackagesIndex : public pkgIndexFile @@ -89,7 +89,7 @@ class debPackagesIndex : public pkgIndexFile debPackagesIndex(std::string const &URI, std::string const &Dist, std::string const &Section, bool const &Trusted, std::string const &Arch = "native"); - virtual ~debPackagesIndex() {}; + virtual ~debPackagesIndex(); }; class debTranslationsIndex : public pkgIndexFile @@ -124,7 +124,7 @@ class debTranslationsIndex : public pkgIndexFile virtual pkgCache::PkgFileIterator FindInCache(pkgCache &Cache) const; debTranslationsIndex(std::string URI,std::string Dist,std::string Section, char const * const Language); - virtual ~debTranslationsIndex() {}; + virtual ~debTranslationsIndex(); }; class debSourcesIndex : public pkgIndexFile @@ -161,7 +161,7 @@ class debSourcesIndex : public pkgIndexFile virtual unsigned long Size() const; debSourcesIndex(std::string URI,std::string Dist,std::string Section,bool Trusted); - virtual ~debSourcesIndex() {}; + virtual ~debSourcesIndex(); }; class debDebPkgFileIndex : public pkgIndexFile @@ -191,8 +191,8 @@ class debDebPkgFileIndex : public pkgIndexFile virtual std::string ArchiveURI(std::string /*File*/) const; debDebPkgFileIndex(std::string DebFile); - virtual ~debDebPkgFileIndex() {}; -}; + virtual ~debDebPkgFileIndex(); +}; class debDscFileIndex : public pkgIndexFile { diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index 63414c944..502bd1a51 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -1015,5 +1015,4 @@ bool debDebFileParser::UsePackage(pkgCache::PkgIterator &Pkg, return res; } - - +debListParser::~debListParser() {} diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h index b55e57d41..f20f7f33e 100644 --- a/apt-pkg/deb/deblistparser.h +++ b/apt-pkg/deb/deblistparser.h @@ -100,7 +100,7 @@ class debListParser : public pkgCacheGenerator::ListParser static const char *ConvertRelation(const char *I,unsigned int &Op); debListParser(FileFd *File, std::string const &Arch = ""); - virtual ~debListParser() {}; + virtual ~debListParser(); }; class debDebFileParser : public debListParser diff --git a/apt-pkg/deb/debrecords.cc b/apt-pkg/deb/debrecords.cc index d2c04d8b2..d08bb3c7e 100644 --- a/apt-pkg/deb/debrecords.cc +++ b/apt-pkg/deb/debrecords.cc @@ -207,3 +207,5 @@ void debRecordParser::GetRec(const char *&Start,const char *&Stop) Section.GetSection(Start,Stop); } /*}}}*/ + +debRecordParser::~debRecordParser() {}; diff --git a/apt-pkg/deb/debrecords.h b/apt-pkg/deb/debrecords.h index 2bd3f3c8f..6b5f94334 100644 --- a/apt-pkg/deb/debrecords.h +++ b/apt-pkg/deb/debrecords.h @@ -60,7 +60,7 @@ class debRecordParser : public pkgRecords::Parser virtual void GetRec(const char *&Start,const char *&Stop); debRecordParser(std::string FileName,pkgCache &Cache); - virtual ~debRecordParser() {}; + virtual ~debRecordParser(); }; // custom record parser that reads deb files directly diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc index bb3b5d340..c8767d606 100644 --- a/apt-pkg/indexcopy.cc +++ b/apt-pkg/indexcopy.cc @@ -793,3 +793,5 @@ bool TranslationsCopy::CopyTranslations(string CDROM,string Name, /*{{{*/ return true; } /*}}}*/ + +IndexCopy::~IndexCopy() {} diff --git a/apt-pkg/indexcopy.h b/apt-pkg/indexcopy.h index ca33a2cb8..701beb075 100644 --- a/apt-pkg/indexcopy.h +++ b/apt-pkg/indexcopy.h @@ -53,7 +53,7 @@ class IndexCopy /*{{{*/ bool CopyPackages(std::string CDROM,std::string Name,std::vector &List, pkgCdromStatus *log); - virtual ~IndexCopy() {}; + virtual ~IndexCopy(); }; /*}}}*/ class PackageCopy : public IndexCopy /*{{{*/ diff --git a/apt-pkg/indexrecords.cc b/apt-pkg/indexrecords.cc index e97ea0ac9..8c1e2229b 100644 --- a/apt-pkg/indexrecords.cc +++ b/apt-pkg/indexrecords.cc @@ -261,3 +261,5 @@ indexRecords::indexRecords(const string ExpectedDist) : ExpectedDist(ExpectedDist), ValidUntil(0), SupportsAcquireByHash(false) { } + +indexRecords::~indexRecords() {} diff --git a/apt-pkg/indexrecords.h b/apt-pkg/indexrecords.h index f2d2c775c..e1a2c0f74 100644 --- a/apt-pkg/indexrecords.h +++ b/apt-pkg/indexrecords.h @@ -56,7 +56,7 @@ class indexRecords time_t GetValidUntil() const; virtual bool CheckDist(const std::string MaybeDist) const; std::string GetExpectedDist() const; - virtual ~indexRecords(){}; + virtual ~indexRecords(); }; #if __GNUC__ >= 4 diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index 26c895417..b263baf66 100644 --- a/apt-pkg/tagfile.cc +++ b/apt-pkg/tagfile.cc @@ -757,3 +757,5 @@ bool TFRewrite(FILE *Output,pkgTagSection const &Tags,const char *Order[], return true; } /*}}}*/ + +pkgTagSection::~pkgTagSection() {} diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h index 39ec94d86..4cd99b2fc 100644 --- a/apt-pkg/tagfile.h +++ b/apt-pkg/tagfile.h @@ -109,7 +109,7 @@ class pkgTagSection }; pkgTagSection(); - virtual ~pkgTagSection() {}; + virtual ~pkgTagSection(); }; class pkgTagFilePrivate; -- 2.45.2