From a02db58fd50ef7fc2f0284852c6b3f98e458a232 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 6 Mar 2014 00:33:10 +0100 Subject: follow method attribute suggestions by gcc Git-Dch: Ignore Reported-By: gcc -Wsuggest-attribute={pure,const,noreturn} --- apt-inst/extract.cc | 2 +- apt-inst/filelist.cc | 6 +++--- apt-pkg/acquire-item.cc | 2 +- apt-pkg/acquire.cc | 6 +++--- apt-pkg/acquire.h | 4 ++-- apt-pkg/algorithms.h | 2 +- apt-pkg/cacheiterators.h | 35 ++++++++++++++++++----------------- apt-pkg/cacheset.cc | 10 +++++----- apt-pkg/contrib/cmndline.h | 8 +++++--- apt-pkg/contrib/crc-16.h | 4 +++- apt-pkg/contrib/error.h | 8 ++++---- apt-pkg/contrib/fileutl.h | 2 +- apt-pkg/contrib/gpgv.h | 2 +- apt-pkg/contrib/hashes.cc | 2 +- apt-pkg/contrib/hashes.h | 2 +- apt-pkg/contrib/strutl.h | 36 ++++++++++++++++++------------------ apt-pkg/deb/debindexfile.cc | 2 +- apt-pkg/deb/debindexfile.h | 8 ++++---- apt-pkg/deb/debsystem.cc | 2 +- apt-pkg/deb/debversion.h | 14 +++++++------- apt-pkg/depcache.cc | 4 ++-- apt-pkg/depcache.h | 3 ++- apt-pkg/edsp/edspindexfile.h | 2 +- apt-pkg/edsp/edsplistparser.cc | 2 +- apt-pkg/edsp/edspsystem.h | 8 ++++---- apt-pkg/indexcopy.cc | 6 ++---- apt-pkg/indexfile.h | 2 +- apt-pkg/indexrecords.cc | 14 +++++++------- apt-pkg/install-progress.cc | 4 ++-- apt-pkg/orderlist.h | 8 ++++---- apt-pkg/packagemanager.h | 2 +- apt-pkg/pkgcache.h | 14 ++++++++------ apt-pkg/pkgcachegen.h | 2 +- apt-pkg/pkgsystem.cc | 4 +++- apt-pkg/policy.cc | 4 ++-- apt-pkg/sourcelist.h | 3 ++- apt-pkg/srcrecords.h | 3 ++- apt-pkg/tagfile.cc | 2 +- apt-pkg/vendor.cc | 2 +- apt-pkg/version.h | 2 +- apt-pkg/versionmatch.h | 14 +++++++------- apt-private/private-cachefile.h | 2 +- apt-private/private-cmndline.cc | 2 +- cmdline/apt-cache.cc | 2 +- cmdline/apt-cdrom.cc | 2 +- methods/ftp.h | 2 +- methods/http.cc | 4 ++-- methods/rsh.h | 2 +- methods/server.h | 2 +- test/libapt/assert.h | 4 +++- 50 files changed, 148 insertions(+), 136 deletions(-) diff --git a/apt-inst/extract.cc b/apt-inst/extract.cc index b2956d91d..b60784450 100644 --- a/apt-inst/extract.cc +++ b/apt-inst/extract.cc @@ -260,7 +260,7 @@ bool pkgExtract::DoItem(Item &Itm, int &/*Fd*/) // Extract::Finished - Sequence finished, erase the temp files /*{{{*/ // --------------------------------------------------------------------- /* */ -bool pkgExtract::Finished() +APT_CONST bool pkgExtract::Finished() { return true; } diff --git a/apt-inst/filelist.cc b/apt-inst/filelist.cc index b4a4f3d9d..4dbc4a2d7 100644 --- a/apt-inst/filelist.cc +++ b/apt-inst/filelist.cc @@ -85,7 +85,7 @@ pkgFLCache::Header::Header() // FLCache::Header::CheckSizes - Check if the two headers have same *sz /*{{{*/ // --------------------------------------------------------------------- /* Compare to make sure we are matching versions */ -bool pkgFLCache::Header::CheckSizes(Header &Against) const +APT_PURE bool pkgFLCache::Header::CheckSizes(Header &Against) const { if (HeaderSz == Against.HeaderSz && NodeSz == Against.NodeSz && @@ -353,7 +353,7 @@ pkgFLCache::NodeIterator pkgFLCache::GetNode(const char *Name, // --------------------------------------------------------------------- /* This is one of two hashing functions. The other is inlined into the GetNode routine. */ -pkgFLCache::Node *pkgFLCache::HashNode(NodeIterator const &Nde) +APT_PURE pkgFLCache::Node *pkgFLCache::HashNode(NodeIterator const &Nde) { // Hash the node unsigned long HashPos = 0; @@ -570,7 +570,7 @@ bool pkgFLCache::AddConfFile(const char *Name,const char *NameEnd, // --------------------------------------------------------------------- /* Since the package pointer is indirected in all sorts of interesting ways this is used to get a pointer to the owning package */ -pkgFLCache::Package *pkgFLCache::NodeIterator::RealPackage() const +APT_PURE pkgFLCache::Package *pkgFLCache::NodeIterator::RealPackage() const { if (Nde->Pointer == 0) return 0; diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 44a1f32df..ad38e3116 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -2162,7 +2162,7 @@ void pkgAcqArchive::Failed(string Message,pkgAcquire::MethodConfig *Cnf) /*}}}*/ // AcqArchive::IsTrusted - Determine whether this archive comes from a trusted source /*{{{*/ // --------------------------------------------------------------------- -bool pkgAcqArchive::IsTrusted() +APT_PURE bool pkgAcqArchive::IsTrusted() { return Trusted; } diff --git a/apt-pkg/acquire.cc b/apt-pkg/acquire.cc index a654d8219..a187a00ae 100644 --- a/apt-pkg/acquire.cc +++ b/apt-pkg/acquire.cc @@ -526,7 +526,7 @@ bool pkgAcquire::Clean(string Dir) // Acquire::TotalNeeded - Number of bytes to fetch /*{{{*/ // --------------------------------------------------------------------- /* This is the total number of bytes needed */ -unsigned long long pkgAcquire::TotalNeeded() +APT_PURE unsigned long long pkgAcquire::TotalNeeded() { unsigned long long Total = 0; for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); ++I) @@ -537,7 +537,7 @@ unsigned long long pkgAcquire::TotalNeeded() // Acquire::FetchNeeded - Number of bytes needed to get /*{{{*/ // --------------------------------------------------------------------- /* This is the number of bytes that is not local */ -unsigned long long pkgAcquire::FetchNeeded() +APT_PURE unsigned long long pkgAcquire::FetchNeeded() { unsigned long long Total = 0; for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); ++I) @@ -549,7 +549,7 @@ unsigned long long pkgAcquire::FetchNeeded() // Acquire::PartialPresent - Number of partial bytes we already have /*{{{*/ // --------------------------------------------------------------------- /* This is the number of bytes that is not local */ -unsigned long long pkgAcquire::PartialPresent() +APT_PURE unsigned long long pkgAcquire::PartialPresent() { unsigned long long Total = 0; for (ItemCIterator I = ItemsBegin(); I != ItemsEnd(); ++I) diff --git a/apt-pkg/acquire.h b/apt-pkg/acquire.h index 1aac0ba11..ef16d8556 100644 --- a/apt-pkg/acquire.h +++ b/apt-pkg/acquire.h @@ -298,7 +298,7 @@ class pkgAcquire * \return the worker immediately following I, or \b NULL if none * exists. */ - Worker *WorkerStep(Worker *I); + Worker *WorkerStep(Worker *I) APT_PURE; /** \brief Get the head of the list of items. */ inline ItemIterator ItemsBegin() {return Items.begin();}; @@ -481,7 +481,7 @@ class pkgAcquire::Queue * \return the first item in the queue whose URI is #URI and that * is being downloaded by #Owner. */ - QItem *FindItem(std::string URI,pkgAcquire::Worker *Owner); + QItem *FindItem(std::string URI,pkgAcquire::Worker *Owner) APT_PURE; /** Presumably this should start downloading an item? * diff --git a/apt-pkg/algorithms.h b/apt-pkg/algorithms.h index 82b6426c6..f35bd9a13 100644 --- a/apt-pkg/algorithms.h +++ b/apt-pkg/algorithms.h @@ -114,7 +114,7 @@ class pkgProblemResolver /*{{{*/ // Sort stuff static pkgProblemResolver *This; - static int ScoreSort(const void *a,const void *b); + static int ScoreSort(const void *a,const void *b) APT_PURE; struct PackageKill { diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h index d9c8ed1e4..2fdf8404d 100644 --- a/apt-pkg/cacheiterators.h +++ b/apt-pkg/cacheiterators.h @@ -30,6 +30,7 @@ #ifndef PKGLIB_CACHEITERATORS_H #define PKGLIB_CACHEITERATORS_H #include +#include #include #include @@ -163,15 +164,15 @@ class pkgCache::PkgIterator: public Iterator { inline bool Purge() const {return S->CurrentState == pkgCache::State::Purge || (S->CurrentVer == 0 && S->CurrentState == pkgCache::State::NotInstalled);} inline const char *Arch() const {return S->Arch == 0?0:Owner->StrP + S->Arch;} - inline GrpIterator Group() const { return GrpIterator(*Owner, Owner->GrpP + S->Group);} + inline APT_PURE GrpIterator Group() const { return GrpIterator(*Owner, Owner->GrpP + S->Group);} - inline VerIterator VersionList() const; - inline VerIterator CurrentVer() const; - inline DepIterator RevDependsList() const; - inline PrvIterator ProvidesList() const; - OkState State() const; - const char *CandVersion() const; - const char *CurVersion() const; + inline VerIterator VersionList() const APT_PURE; + inline VerIterator CurrentVer() const APT_PURE; + inline DepIterator RevDependsList() const APT_PURE; + inline PrvIterator ProvidesList() const APT_PURE; + OkState State() const APT_PURE; + const char *CandVersion() const APT_PURE; + const char *CurVersion() const APT_PURE; //Nice printable representation friend std::ostream& operator <<(std::ostream& out, PkgIterator i); @@ -224,7 +225,7 @@ class pkgCache::VerIterator : public Iterator { inline VerFileIterator FileList() const; bool Downloadable() const; inline const char *PriorityType() const {return Owner->Priority(S->Priority);} - const char *MultiArchType() const; + const char *MultiArchType() const APT_PURE; std::string RelStr() const; bool Automatic() const; @@ -286,13 +287,13 @@ class pkgCache::DepIterator : public Iterator { inline VerIterator ParentVer() const {return VerIterator(*Owner,Owner->VerP + S->ParentVer);} inline PkgIterator ParentPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->ParentVer].ParentPkg);} inline bool Reverse() const {return Type == DepRev;} - bool IsCritical() const; - bool IsNegative() const; - bool IsIgnorable(PrvIterator const &Prv) const; - bool IsIgnorable(PkgIterator const &Pkg) const; - bool IsMultiArchImplicit() const; - bool IsSatisfied(VerIterator const &Ver) const; - bool IsSatisfied(PrvIterator const &Prv) const; + bool IsCritical() const APT_PURE; + bool IsNegative() const APT_PURE; + bool IsIgnorable(PrvIterator const &Prv) const APT_PURE; + bool IsIgnorable(PkgIterator const &Pkg) const APT_PURE; + bool IsMultiArchImplicit() const APT_PURE; + bool IsSatisfied(VerIterator const &Ver) const APT_PURE; + bool IsSatisfied(PrvIterator const &Prv) const APT_PURE; void GlobOr(DepIterator &Start,DepIterator &End); Version **AllTargets() const; bool SmartTargetPkg(PkgIterator &Result) const; @@ -337,7 +338,7 @@ class pkgCache::PrvIterator : public Iterator { inline VerIterator OwnerVer() const {return VerIterator(*Owner,Owner->VerP + S->Version);} inline PkgIterator OwnerPkg() const {return PkgIterator(*Owner,Owner->PkgP + Owner->VerP[S->Version].ParentPkg);} - bool IsMultiArchImplicit() const; + bool IsMultiArchImplicit() const APT_PURE; inline PrvIterator() : Iterator(), Type(PrvVer) {} inline PrvIterator(pkgCache &Owner, Provides *Trg, Version*) : diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc index a58631d5b..d453a2bfb 100644 --- a/apt-pkg/cacheset.cc +++ b/apt-pkg/cacheset.cc @@ -614,7 +614,7 @@ void CacheSetHelper::canNotFindFnmatch(PackageContainerInterface * const pci, pk } #endif /*}}}*/ // canNotFindPackage - handle the case no package is found from a string/*{{{*/ -void CacheSetHelper::canNotFindPackage(PackageContainerInterface * const /*pci*/, pkgCacheFile &/*Cache*/, std::string const &/*str*/) { +APT_CONST void CacheSetHelper::canNotFindPackage(PackageContainerInterface * const /*pci*/, pkgCacheFile &/*Cache*/, std::string const &/*str*/) { } /*}}}*/ // canNotFindAllVer /*{{{*/ @@ -663,24 +663,24 @@ pkgCache::VerIterator CacheSetHelper::canNotFindInstalledVer(pkgCacheFile &Cache } /*}}}*/ // showTaskSelection /*{{{*/ -void CacheSetHelper::showTaskSelection(pkgCache::PkgIterator const &/*pkg*/, +APT_CONST void CacheSetHelper::showTaskSelection(pkgCache::PkgIterator const &/*pkg*/, std::string const &/*pattern*/) { } /*}}}*/ // showRegExSelection /*{{{*/ -void CacheSetHelper::showRegExSelection(pkgCache::PkgIterator const &/*pkg*/, +APT_CONST void CacheSetHelper::showRegExSelection(pkgCache::PkgIterator const &/*pkg*/, std::string const &/*pattern*/) { } /*}}}*/ #if (APT_PKG_MAJOR >= 4 && APT_PKG_MINOR >= 13) // showFnmatchSelection /*{{{*/ -void CacheSetHelper::showFnmatchSelection(pkgCache::PkgIterator const &pkg, +APT_CONST void CacheSetHelper::showFnmatchSelection(pkgCache::PkgIterator const &pkg, std::string const &pattern) { } /*}}}*/ #endif // showSelectedVersion /*{{{*/ -void CacheSetHelper::showSelectedVersion(pkgCache::PkgIterator const &/*Pkg*/, +APT_CONST void CacheSetHelper::showSelectedVersion(pkgCache::PkgIterator const &/*Pkg*/, pkgCache::VerIterator const /*Ver*/, std::string const &/*ver*/, bool const /*verIsRel*/) { diff --git a/apt-pkg/contrib/cmndline.h b/apt-pkg/contrib/cmndline.h index 180276633..143df58b2 100644 --- a/apt-pkg/contrib/cmndline.h +++ b/apt-pkg/contrib/cmndline.h @@ -44,6 +44,8 @@ #ifndef PKGLIB_CMNDLINE_H #define PKGLIB_CMNDLINE_H +#include + #ifndef APT_8_CLEANER_HEADERS #include #endif @@ -80,14 +82,14 @@ class CommandLine bool Parse(int argc,const char **argv); void ShowHelp(); - unsigned int FileSize() const; + unsigned int FileSize() const APT_PURE; bool DispatchArg(Dispatch *List,bool NoMatch = true); static char const * GetCommand(Dispatch const * const Map, - unsigned int const argc, char const * const * const argv); + unsigned int const argc, char const * const * const argv) APT_PURE; static CommandLine::Args MakeArgs(char ShortOpt, char const *LongOpt, - char const *ConfName, unsigned long Flags); + char const *ConfName, unsigned long Flags) APT_CONST; CommandLine(Args *AList,Configuration *Conf); ~CommandLine(); diff --git a/apt-pkg/contrib/crc-16.h b/apt-pkg/contrib/crc-16.h index 702de40b2..08acdafb7 100644 --- a/apt-pkg/contrib/crc-16.h +++ b/apt-pkg/contrib/crc-16.h @@ -10,8 +10,10 @@ #ifndef APTPKG_CRC16_H #define APTPKG_CRC16_H +#include + #define INIT_FCS 0xffff unsigned short AddCRC16(unsigned short fcs, void const *buf, - unsigned long long len); + unsigned long long len) APT_PURE; #endif diff --git a/apt-pkg/contrib/error.h b/apt-pkg/contrib/error.h index 919b1e6d4..ed8c19153 100644 --- a/apt-pkg/contrib/error.h +++ b/apt-pkg/contrib/error.h @@ -141,7 +141,7 @@ public: /*{{{*/ */ bool InsertErrno(MsgType type, const char* Function, const char* Description, va_list &args, - int const errsv, size_t &msgSize); + int const errsv, size_t &msgSize) APT_COLD; /** \brief add an fatal error message to the list * @@ -225,7 +225,7 @@ public: /*{{{*/ * * \return \b true if an error is included in the list, \b false otherwise */ - inline bool PendingError() const {return PendingFlag;}; + inline bool PendingError() const APT_PURE {return PendingFlag;}; /** \brief is the list empty? * @@ -237,7 +237,7 @@ public: /*{{{*/ * * \return \b true if an the list is empty, \b false otherwise */ - bool empty(MsgType const &threshold = WARNING) const; + bool empty(MsgType const &threshold = WARNING) const APT_PURE; /** \brief returns and removes the first (or last) message in the list * @@ -303,7 +303,7 @@ public: /*{{{*/ void MergeWithStack(); /** \brief return the deep of the stack */ - size_t StackCount() const { + size_t StackCount() const APT_PURE { return Stacks.size(); } diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h index 6fdea1294..35f3ab0f4 100644 --- a/apt-pkg/contrib/fileutl.h +++ b/apt-pkg/contrib/fileutl.h @@ -119,7 +119,7 @@ class FileFd // Simple manipulators inline int Fd() {return iFd;}; inline void Fd(int fd) { OpenDescriptor(fd, ReadWrite);}; - gzFile gzFd() APT_DEPRECATED; + gzFile gzFd() APT_DEPRECATED APT_PURE; inline bool IsOpen() {return iFd >= 0;}; inline bool Failed() {return (Flags & Fail) == Fail;}; diff --git a/apt-pkg/contrib/gpgv.h b/apt-pkg/contrib/gpgv.h index ab3c68de5..f018893fd 100644 --- a/apt-pkg/contrib/gpgv.h +++ b/apt-pkg/contrib/gpgv.h @@ -41,7 +41,7 @@ class FileFd; */ void ExecGPGV(std::string const &File, std::string const &FileSig, int const &statusfd, int fd[2]) APT_NORETURN; -inline void ExecGPGV(std::string const &File, std::string const &FileSig, +inline APT_NORETURN void ExecGPGV(std::string const &File, std::string const &FileSig, int const &statusfd = -1) { int fd[2]; ExecGPGV(File, FileSig, statusfd, fd); diff --git a/apt-pkg/contrib/hashes.cc b/apt-pkg/contrib/hashes.cc index 5efafa511..1fce0d75f 100644 --- a/apt-pkg/contrib/hashes.cc +++ b/apt-pkg/contrib/hashes.cc @@ -116,7 +116,7 @@ const char** HashString::SupportedHashes() return _SupportedHashes; } -bool HashString::empty() const +APT_PURE bool HashString::empty() const { return (Type.empty() || Hash.empty()); } diff --git a/apt-pkg/contrib/hashes.h b/apt-pkg/contrib/hashes.h index 979ee1eb8..5cd1af03b 100644 --- a/apt-pkg/contrib/hashes.h +++ b/apt-pkg/contrib/hashes.h @@ -66,7 +66,7 @@ class HashString bool empty() const; // return the list of hashes we support - static const char** SupportedHashes(); + static APT_CONST const char** SupportedHashes(); }; class Hashes diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h index 79479957d..185cdc3fc 100644 --- a/apt-pkg/contrib/strutl.h +++ b/apt-pkg/contrib/strutl.h @@ -107,43 +107,43 @@ int tolower_ascii(int const c) APT_CONST APT_HOT; std::string StripEpoch(const std::string &VerStr); #define APT_MKSTRCMP(name,func) \ -inline int name(const char *A,const char *B) {return func(A,A+strlen(A),B,B+strlen(B));} \ -inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));} \ -inline int name(const std::string& A,const char *B) {return func(A.c_str(),A.c_str()+A.length(),B,B+strlen(B));} \ -inline int name(const std::string& A,const std::string& B) {return func(A.c_str(),A.c_str()+A.length(),B.c_str(),B.c_str()+B.length());} \ -inline int name(const std::string& A,const char *B,const char *BEnd) {return func(A.c_str(),A.c_str()+A.length(),B,BEnd);} +inline APT_PURE int name(const char *A,const char *B) {return func(A,A+strlen(A),B,B+strlen(B));} \ +inline APT_PURE int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));} \ +inline APT_PURE int name(const std::string& A,const char *B) {return func(A.c_str(),A.c_str()+A.length(),B,B+strlen(B));} \ +inline APT_PURE int name(const std::string& A,const std::string& B) {return func(A.c_str(),A.c_str()+A.length(),B.c_str(),B.c_str()+B.length());} \ +inline APT_PURE int name(const std::string& A,const char *B,const char *BEnd) {return func(A.c_str(),A.c_str()+A.length(),B,BEnd);} #define APT_MKSTRCMP2(name,func) \ -inline int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));} \ -inline int name(const std::string& A,const char *B) {return func(A.begin(),A.end(),B,B+strlen(B));} \ -inline int name(const std::string& A,const std::string& B) {return func(A.begin(),A.end(),B.begin(),B.end());} \ -inline int name(const std::string& A,const char *B,const char *BEnd) {return func(A.begin(),A.end(),B,BEnd);} +inline APT_PURE int name(const char *A,const char *AEnd,const char *B) {return func(A,AEnd,B,B+strlen(B));} \ +inline APT_PURE int name(const std::string& A,const char *B) {return func(A.begin(),A.end(),B,B+strlen(B));} \ +inline APT_PURE int name(const std::string& A,const std::string& B) {return func(A.begin(),A.end(),B.begin(),B.end());} \ +inline APT_PURE int name(const std::string& A,const char *B,const char *BEnd) {return func(A.begin(),A.end(),B,BEnd);} -int stringcmp(const char *A,const char *AEnd,const char *B,const char *BEnd); -int stringcasecmp(const char *A,const char *AEnd,const char *B,const char *BEnd); +int APT_PURE stringcmp(const char *A,const char *AEnd,const char *B,const char *BEnd); +int APT_PURE stringcasecmp(const char *A,const char *AEnd,const char *B,const char *BEnd); /* We assume that GCC 3 indicates that libstdc++3 is in use too. In that case the definition of string::const_iterator is not the same as const char * and we need these extra functions */ #if __GNUC__ >= 3 -int stringcmp(std::string::const_iterator A,std::string::const_iterator AEnd, +int APT_PURE stringcmp(std::string::const_iterator A,std::string::const_iterator AEnd, const char *B,const char *BEnd); -int stringcmp(std::string::const_iterator A,std::string::const_iterator AEnd, +int APT_PURE stringcmp(std::string::const_iterator A,std::string::const_iterator AEnd, std::string::const_iterator B,std::string::const_iterator BEnd); -int stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd, +int APT_PURE stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd, const char *B,const char *BEnd); -int stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd, +int APT_PURE stringcasecmp(std::string::const_iterator A,std::string::const_iterator AEnd, std::string::const_iterator B,std::string::const_iterator BEnd); -inline int stringcmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcmp(A,Aend,B,B+strlen(B));} -inline int stringcasecmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcasecmp(A,Aend,B,B+strlen(B));} +inline APT_PURE int stringcmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcmp(A,Aend,B,B+strlen(B));} +inline APT_PURE int stringcasecmp(std::string::const_iterator A,std::string::const_iterator Aend,const char *B) {return stringcasecmp(A,Aend,B,B+strlen(B));} #endif APT_MKSTRCMP2(stringcmp,stringcmp) APT_MKSTRCMP2(stringcasecmp,stringcasecmp) // Return the length of a NULL-terminated string array -size_t strv_length(const char **str_array); +size_t APT_PURE strv_length(const char **str_array); inline const char *DeNull(const char *s) {return (s == 0?"(null)":s);} diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc index 1b35d0d52..eee758b7a 100644 --- a/apt-pkg/deb/debindexfile.cc +++ b/apt-pkg/deb/debindexfile.cc @@ -660,7 +660,7 @@ pkgCache::PkgFileIterator debStatusIndex::FindInCache(pkgCache &Cache) const // StatusIndex::Exists - Check if the index is available /*{{{*/ // --------------------------------------------------------------------- /* */ -bool debStatusIndex::Exists() const +APT_CONST bool debStatusIndex::Exists() const { // Abort if the file does not exist. return true; diff --git a/apt-pkg/deb/debindexfile.h b/apt-pkg/deb/debindexfile.h index 3bcb3b64f..017c69a0a 100644 --- a/apt-pkg/deb/debindexfile.h +++ b/apt-pkg/deb/debindexfile.h @@ -38,7 +38,7 @@ class debStatusIndex : public pkgIndexFile public: - virtual const Type *GetType() const; + virtual const Type *GetType() const APT_CONST; // Interface for acquire virtual std::string Describe(bool /*Short*/) const {return File;}; @@ -71,7 +71,7 @@ class debPackagesIndex : public pkgIndexFile public: - virtual const Type *GetType() const; + virtual const Type *GetType() const APT_CONST; // Stuff for accessing files on remote items virtual std::string ArchiveInfo(pkgCache::VerIterator Ver) const; @@ -110,7 +110,7 @@ class debTranslationsIndex : public pkgIndexFile public: - virtual const Type *GetType() const; + virtual const Type *GetType() const APT_CONST; // Interface for acquire virtual std::string Describe(bool Short) const; @@ -142,7 +142,7 @@ class debSourcesIndex : public pkgIndexFile public: - virtual const Type *GetType() const; + virtual const Type *GetType() const APT_CONST; // Stuff for accessing files on remote items virtual std::string SourceInfo(pkgSrcRecords::Parser const &Record, diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc index db557e537..142f3a6e6 100644 --- a/apt-pkg/deb/debsystem.cc +++ b/apt-pkg/deb/debsystem.cc @@ -202,7 +202,7 @@ bool debSystem::Initialize(Configuration &Cnf) // --------------------------------------------------------------------- /* The standard name for a deb is 'deb'.. There are no separate versions of .deb to worry about.. */ -bool debSystem::ArchiveSupported(const char *Type) +APT_PURE bool debSystem::ArchiveSupported(const char *Type) { if (strcmp(Type,"deb") == 0) return true; diff --git a/apt-pkg/deb/debversion.h b/apt-pkg/deb/debversion.h index 981ea9ad2..434ff4a2e 100644 --- a/apt-pkg/deb/debversion.h +++ b/apt-pkg/deb/debversion.h @@ -19,19 +19,19 @@ class debVersioningSystem : public pkgVersioningSystem { public: - + static int CmpFragment(const char *A, const char *AEnd, const char *B, - const char *BEnd); - + const char *BEnd) APT_PURE; + // Compare versions.. virtual int DoCmpVersion(const char *A,const char *Aend, - const char *B,const char *Bend); - virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer); - virtual int DoCmpReleaseVer(const char *A,const char *Aend, + const char *B,const char *Bend) APT_PURE; + virtual bool CheckDep(const char *PkgVer,int Op,const char *DepVer) APT_PURE; + virtual APT_PURE int DoCmpReleaseVer(const char *A,const char *Aend, const char *B,const char *Bend) { return DoCmpVersion(A,Aend,B,Bend); - } + } virtual std::string UpstreamVersion(const char *A); debVersioningSystem(); diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc index 149dbc0e7..e2c412757 100644 --- a/apt-pkg/depcache.cc +++ b/apt-pkg/depcache.cc @@ -1691,9 +1691,9 @@ bool pkgDepCache::Policy::IsImportantDep(DepIterator const &Dep) } /*}}}*/ // Policy::GetPriority - Get the priority of the package pin /*{{{*/ -signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgIterator const &/*Pkg*/) +APT_CONST signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgIterator const &/*Pkg*/) { return 0; } -signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgFileIterator const &/*File*/) +APT_CONST signed short pkgDepCache::Policy::GetPriority(pkgCache::PkgFileIterator const &/*File*/) { return 0; } /*}}}*/ pkgDepCache::InRootSetFunc *pkgDepCache::GetRootSetFunc() /*{{{*/ diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h index 3ffc3b47d..bde648c65 100644 --- a/apt-pkg/depcache.h +++ b/apt-pkg/depcache.h @@ -41,6 +41,7 @@ #include #include #include +#include #include @@ -239,7 +240,7 @@ class pkgDepCache : protected pkgCache::Namespace unsigned char DepState; // DepState Flags // Update of candidate version - const char *StripEpoch(const char *Ver); + const char *StripEpoch(const char *Ver) APT_PURE; void Update(PkgIterator Pkg,pkgCache &Cache); // Various test members for the current status of the package diff --git a/apt-pkg/edsp/edspindexfile.h b/apt-pkg/edsp/edspindexfile.h index bd3b41cf2..609a2cde4 100644 --- a/apt-pkg/edsp/edspindexfile.h +++ b/apt-pkg/edsp/edspindexfile.h @@ -25,7 +25,7 @@ class edspIndex : public debStatusIndex public: - virtual const Type *GetType() const; + virtual const Type *GetType() const APT_CONST; virtual bool Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const; diff --git a/apt-pkg/edsp/edsplistparser.cc b/apt-pkg/edsp/edsplistparser.cc index 139deb9f1..212dc7840 100644 --- a/apt-pkg/edsp/edsplistparser.cc +++ b/apt-pkg/edsp/edsplistparser.cc @@ -86,7 +86,7 @@ bool edspListParser::ParseStatus(pkgCache::PkgIterator &Pkg, } /*}}}*/ // ListParser::LoadReleaseInfo - Load the release information /*{{{*/ -bool edspListParser::LoadReleaseInfo(pkgCache::PkgFileIterator & /*FileI*/, +APT_CONST bool edspListParser::LoadReleaseInfo(pkgCache::PkgFileIterator & /*FileI*/, FileFd & /*File*/, std::string /*component*/) { return true; diff --git a/apt-pkg/edsp/edspsystem.h b/apt-pkg/edsp/edspsystem.h index eafff39ba..65e36d714 100644 --- a/apt-pkg/edsp/edspsystem.h +++ b/apt-pkg/edsp/edspsystem.h @@ -31,11 +31,11 @@ class edspSystem : public pkgSystem public: - virtual bool Lock(); - virtual bool UnLock(bool NoErrors = false); - virtual pkgPackageManager *CreatePM(pkgDepCache *Cache) const; + virtual bool Lock() APT_CONST; + virtual bool UnLock(bool NoErrors = false) APT_CONST; + virtual pkgPackageManager *CreatePM(pkgDepCache *Cache) const APT_CONST; virtual bool Initialize(Configuration &Cnf); - virtual bool ArchiveSupported(const char *Type); + virtual bool ArchiveSupported(const char *Type) APT_CONST; virtual signed Score(Configuration const &Cnf); virtual bool AddStatusFiles(std::vector &List); virtual bool FindIndex(pkgCache::PkgFileIterator File, diff --git a/apt-pkg/indexcopy.cc b/apt-pkg/indexcopy.cc index 3a1385fa5..854ba1bd7 100644 --- a/apt-pkg/indexcopy.cc +++ b/apt-pkg/indexcopy.cc @@ -642,15 +642,13 @@ bool SigVerify::CopyAndVerify(string CDROM,string Name,vector &SigList, } /*}}}*/ // SigVerify::RunGPGV - deprecated wrapper calling ExecGPGV /*{{{*/ -bool SigVerify::RunGPGV(std::string const &File, std::string const &FileOut, +APT_NORETURN bool SigVerify::RunGPGV(std::string const &File, std::string const &FileOut, int const &statusfd, int fd[2]) { ExecGPGV(File, FileOut, statusfd, fd); - return false; } -bool SigVerify::RunGPGV(std::string const &File, std::string const &FileOut, +APT_NORETURN bool SigVerify::RunGPGV(std::string const &File, std::string const &FileOut, int const &statusfd) { ExecGPGV(File, FileOut, statusfd); - return false; } /*}}}*/ bool TranslationsCopy::CopyTranslations(string CDROM,string Name, /*{{{*/ diff --git a/apt-pkg/indexfile.h b/apt-pkg/indexfile.h index 98cdda603..b5c9ac77e 100644 --- a/apt-pkg/indexfile.h +++ b/apt-pkg/indexfile.h @@ -54,7 +54,7 @@ class pkgIndexFile // Global list of Items supported static Type **GlobalList; static unsigned long GlobalListLen; - static Type *GetType(const char *Type); + static Type *GetType(const char *Type) APT_PURE; const char *Label; diff --git a/apt-pkg/indexrecords.cc b/apt-pkg/indexrecords.cc index 1123d1690..5353d1098 100644 --- a/apt-pkg/indexrecords.cc +++ b/apt-pkg/indexrecords.cc @@ -27,33 +27,33 @@ using std::string; -string indexRecords::GetDist() const +APT_PURE string indexRecords::GetDist() const { return this->Dist; } -string indexRecords::GetSuite() const +APT_PURE string indexRecords::GetSuite() const { return this->Suite; } -bool indexRecords::CheckDist(const string MaybeDist) const +APT_PURE bool indexRecords::CheckDist(const string MaybeDist) const { return (this->Dist == MaybeDist || this->Suite == MaybeDist); } -string indexRecords::GetExpectedDist() const +APT_PURE string indexRecords::GetExpectedDist() const { return this->ExpectedDist; } -time_t indexRecords::GetValidUntil() const +APT_PURE time_t indexRecords::GetValidUntil() const { return this->ValidUntil; } -const indexRecords::checkSum *indexRecords::Lookup(const string MetaKey) +APT_PURE const indexRecords::checkSum *indexRecords::Lookup(const string MetaKey) { std::map::const_iterator sum = Entries.find(MetaKey); if (sum == Entries.end()) @@ -61,7 +61,7 @@ const indexRecords::checkSum *indexRecords::Lookup(const string MetaKey) return sum->second; } -bool indexRecords::Exists(string const &MetaKey) const +APT_PURE bool indexRecords::Exists(string const &MetaKey) const { return Entries.count(MetaKey) == 1; } diff --git a/apt-pkg/install-progress.cc b/apt-pkg/install-progress.cc index 6f43e0bc0..dfe4fb18c 100644 --- a/apt-pkg/install-progress.cc +++ b/apt-pkg/install-progress.cc @@ -93,7 +93,7 @@ void PackageManagerProgressFd::StartDpkg() WriteToStatusFd(status.str()); } -void PackageManagerProgressFd::Stop() +APT_CONST void PackageManagerProgressFd::Stop() { } @@ -176,7 +176,7 @@ void PackageManagerProgressDeb822Fd::StartDpkg() WriteToStatusFd(status.str()); } -void PackageManagerProgressDeb822Fd::Stop() +APT_CONST void PackageManagerProgressDeb822Fd::Stop() { } diff --git a/apt-pkg/orderlist.h b/apt-pkg/orderlist.h index 1fdfbf559..b8bad81b3 100644 --- a/apt-pkg/orderlist.h +++ b/apt-pkg/orderlist.h @@ -70,9 +70,9 @@ class pkgOrderList : protected pkgCache::Namespace // For pre sorting static pkgOrderList *Me; - static int OrderCompareA(const void *a, const void *b); - static int OrderCompareB(const void *a, const void *b); - int FileCmp(PkgIterator A,PkgIterator B); + static int OrderCompareA(const void *a, const void *b) APT_PURE; + static int OrderCompareB(const void *a, const void *b) APT_PURE; + int FileCmp(PkgIterator A,PkgIterator B) APT_PURE; public: @@ -102,7 +102,7 @@ class pkgOrderList : protected pkgCache::Namespace inline void RmFlag(Package *Pkg,unsigned long F) {Flags[Pkg->ID] &= ~F;}; // IsNow will return true if the Pkg has been not been either configured or unpacked inline bool IsNow(PkgIterator Pkg) {return (Flags[Pkg->ID] & (States & (~Removed))) == 0;}; - bool IsMissing(PkgIterator Pkg); + bool IsMissing(PkgIterator Pkg) APT_PURE; void WipeFlags(unsigned long F); void SetFileList(std::string *FileList) {this->FileList = FileList;}; diff --git a/apt-pkg/packagemanager.h b/apt-pkg/packagemanager.h index a86b176a4..344ed9192 100644 --- a/apt-pkg/packagemanager.h +++ b/apt-pkg/packagemanager.h @@ -75,7 +75,7 @@ class pkgPackageManager : protected pkgCache::Namespace bool CreateOrderList(); // Analysis helpers - bool DepAlwaysTrue(DepIterator D); + bool DepAlwaysTrue(DepIterator D) APT_PURE; // Install helpers bool ConfigureAll(); diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h index b3a714511..5e8a9630a 100644 --- a/apt-pkg/pkgcache.h +++ b/apt-pkg/pkgcache.h @@ -74,9 +74,11 @@ #ifndef PKGLIB_PKGCACHE_H #define PKGLIB_PKGCACHE_H +#include +#include + #include #include -#include #ifndef APT_8_CLEANER_HEADERS using std::string; @@ -156,8 +158,8 @@ class pkgCache /*{{{*/ std::string CacheFile; MMap ⤅ - unsigned long sHash(const std::string &S) const; - unsigned long sHash(const char *S) const; + unsigned long sHash(const std::string &S) const APT_PURE; + unsigned long sHash(const char *S) const APT_PURE; public: @@ -207,8 +209,8 @@ class pkgCache /*{{{*/ pkgVersioningSystem *VS; // Converters - static const char *CompTypeDeb(unsigned char Comp); - static const char *CompType(unsigned char Comp); + static const char *CompTypeDeb(unsigned char Comp) APT_CONST; + static const char *CompType(unsigned char Comp) APT_CONST; static const char *DepType(unsigned char Dep); pkgCache(MMap *Map,bool DoMap = true); @@ -318,7 +320,7 @@ struct pkgCache::Header /** \brief Size of the complete cache file */ unsigned long CacheFileSize; - bool CheckSizes(Header &Against) const; + bool CheckSizes(Header &Against) const APT_PURE; Header(); }; /*}}}*/ diff --git a/apt-pkg/pkgcachegen.h b/apt-pkg/pkgcachegen.h index 9ccf71c7b..898b34358 100644 --- a/apt-pkg/pkgcachegen.h +++ b/apt-pkg/pkgcachegen.h @@ -104,7 +104,7 @@ class pkgCacheGenerator /*{{{*/ bool HasFileDeps() {return FoundFileDeps;}; bool MergeFileProvides(ListParser &List); - bool FinishCache(OpProgress *Progress) APT_DEPRECATED; + bool FinishCache(OpProgress *Progress) APT_DEPRECATED APT_CONST; static bool MakeStatusCache(pkgSourceList &List,OpProgress *Progress, MMap **OutMap = 0,bool AllowMem = false); diff --git a/apt-pkg/pkgsystem.cc b/apt-pkg/pkgsystem.cc index ee6c3f4ec..14d090c7a 100644 --- a/apt-pkg/pkgsystem.cc +++ b/apt-pkg/pkgsystem.cc @@ -13,6 +13,8 @@ #include #include +#include + #include #include /*}}}*/ @@ -35,7 +37,7 @@ pkgSystem::pkgSystem() : Label(NULL), VS(NULL) // System::GetSystem - Get the named system /*{{{*/ // --------------------------------------------------------------------- /* */ -pkgSystem *pkgSystem::GetSystem(const char *Label) +APT_PURE pkgSystem *pkgSystem::GetSystem(const char *Label) { for (unsigned I = 0; I != GlobalListLen; I++) if (strcmp(SysList[I]->Label,Label) == 0) diff --git a/apt-pkg/policy.cc b/apt-pkg/policy.cc index ae30b6f50..3cfc32829 100644 --- a/apt-pkg/policy.cc +++ b/apt-pkg/policy.cc @@ -333,7 +333,7 @@ pkgCache::VerIterator pkgPolicy::GetMatch(pkgCache::PkgIterator const &Pkg) // Policy::GetPriority - Get the priority of the package pin /*{{{*/ // --------------------------------------------------------------------- /* */ -signed short pkgPolicy::GetPriority(pkgCache::PkgIterator const &Pkg) +APT_PURE signed short pkgPolicy::GetPriority(pkgCache::PkgIterator const &Pkg) { if (Pins[Pkg->ID].Type != pkgVersionMatch::None) { @@ -345,7 +345,7 @@ signed short pkgPolicy::GetPriority(pkgCache::PkgIterator const &Pkg) return 0; } -signed short pkgPolicy::GetPriority(pkgCache::PkgFileIterator const &File) +APT_PURE signed short pkgPolicy::GetPriority(pkgCache::PkgFileIterator const &File) { return PFPriority[File->ID]; } diff --git a/apt-pkg/sourcelist.h b/apt-pkg/sourcelist.h index af7569375..9df0c1d74 100644 --- a/apt-pkg/sourcelist.h +++ b/apt-pkg/sourcelist.h @@ -29,6 +29,7 @@ #include #include +#include #include @@ -63,7 +64,7 @@ class pkgSourceList // Global list of Items supported static Type **GlobalList; static unsigned long GlobalListLen; - static Type *GetType(const char *Type); + static Type *GetType(const char *Type) APT_PURE; const char *Name; const char *Label; diff --git a/apt-pkg/srcrecords.h b/apt-pkg/srcrecords.h index ed69d0d72..9915debfe 100644 --- a/apt-pkg/srcrecords.h +++ b/apt-pkg/srcrecords.h @@ -13,6 +13,7 @@ #ifndef PKGLIB_SRCRECORDS_H #define PKGLIB_SRCRECORDS_H +#include #include #include @@ -73,7 +74,7 @@ class pkgSrcRecords //FIXME: Add a parameter to specify which architecture to use for [wildcard] matching virtual bool BuildDepends(std::vector &BuildDeps, bool const &ArchOnly, bool const &StripMultiArch = true) = 0; - static const char *BuildDepType(unsigned char const &Type); + static const char *BuildDepType(unsigned char const &Type) APT_PURE; virtual bool Files(std::vector &F) = 0; diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index 906321456..91d176e3c 100644 --- a/apt-pkg/tagfile.cc +++ b/apt-pkg/tagfile.cc @@ -85,7 +85,7 @@ pkgTagFile::~pkgTagFile() } /*}}}*/ // TagFile::Offset - Return the current offset in the buffer /*{{{*/ -unsigned long pkgTagFile::Offset() +APT_PURE unsigned long pkgTagFile::Offset() { return d->iOffset; } diff --git a/apt-pkg/vendor.cc b/apt-pkg/vendor.cc index 986636e97..d4add560e 100644 --- a/apt-pkg/vendor.cc +++ b/apt-pkg/vendor.cc @@ -35,7 +35,7 @@ const std::string Vendor::LookupFingerprint(std::string Print) const return (*Elt).second; } -bool Vendor::CheckDist(std::string /*Dist*/) +APT_CONST bool Vendor::CheckDist(std::string /*Dist*/) { return true; } diff --git a/apt-pkg/version.h b/apt-pkg/version.h index e0e0e6c14..d98809f7e 100644 --- a/apt-pkg/version.h +++ b/apt-pkg/version.h @@ -33,7 +33,7 @@ class pkgVersioningSystem // Global list of VS's static pkgVersioningSystem **GlobalList; static unsigned long GlobalListLen; - static pkgVersioningSystem *GetVS(const char *Label); + static pkgVersioningSystem *GetVS(const char *Label) APT_PURE; const char *Label; diff --git a/apt-pkg/versionmatch.h b/apt-pkg/versionmatch.h index a889878ad..4c8f704c8 100644 --- a/apt-pkg/versionmatch.h +++ b/apt-pkg/versionmatch.h @@ -45,7 +45,7 @@ using std::string; #endif class pkgVersionMatch -{ +{ // Version Matching std::string VerStr; bool VerPrefixMatch; @@ -61,20 +61,20 @@ class pkgVersionMatch std::string RelComponent; std::string RelArchitecture; bool MatchAll; - + // Origin Matching std::string OrSite; - + public: - + enum MatchType {None = 0,Version,Release,Origin} Type; - - bool MatchVer(const char *A,std::string B,bool Prefix); + + bool MatchVer(const char *A,std::string B,bool Prefix) APT_PURE; bool ExpressionMatches(const char *pattern, const char *string); bool ExpressionMatches(const std::string& pattern, const char *string); bool FileMatch(pkgCache::PkgFileIterator File); pkgCache::VerIterator Find(pkgCache::PkgIterator Pkg); - + pkgVersionMatch(std::string Data,MatchType Type); }; diff --git a/apt-private/private-cachefile.h b/apt-private/private-cachefile.h index 94d93df2c..67c5e8cdc 100644 --- a/apt-private/private-cachefile.h +++ b/apt-private/private-cachefile.h @@ -13,7 +13,7 @@ class CacheFile : public pkgCacheFile { static pkgCache *SortCache; - static int NameComp(const void *a,const void *b); + static int NameComp(const void *a,const void *b) APT_PURE; public: pkgCache::Package **List; diff --git a/apt-private/private-cmndline.cc b/apt-private/private-cmndline.cc index 2b2a35637..682be0a19 100644 --- a/apt-private/private-cmndline.cc +++ b/apt-private/private-cmndline.cc @@ -12,7 +12,7 @@ #include /*}}}*/ -static bool strcmp_match_in_list(char const * const Cmd, ...) /*{{{*/ +APT_SENTINEL static bool strcmp_match_in_list(char const * const Cmd, ...) /*{{{*/ { va_list args; bool found = false; diff --git a/cmdline/apt-cache.cc b/cmdline/apt-cache.cc index 0860ee7bf..84b775390 100644 --- a/cmdline/apt-cache.cc +++ b/cmdline/apt-cache.cc @@ -1118,7 +1118,7 @@ static bool Dotty(CommandLine &CmdL) /* This displays the package record from the proper package index file. It is not used by DumpAvail for performance reasons. */ -static unsigned char const* skipDescriptionFields(unsigned char const * DescP) +static APT_PURE unsigned char const* skipDescriptionFields(unsigned char const * DescP) { char const * const TagName = "\nDescription"; size_t const TagLen = strlen(TagName); diff --git a/cmdline/apt-cdrom.cc b/cmdline/apt-cdrom.cc index facb6002b..b7447463d 100644 --- a/cmdline/apt-cdrom.cc +++ b/cmdline/apt-cdrom.cc @@ -98,7 +98,7 @@ bool pkgCdromTextStatus::ChangeCdrom() return true; } -OpProgress* pkgCdromTextStatus::GetOpProgress() +APT_CONST OpProgress* pkgCdromTextStatus::GetOpProgress() { return &Progress; } diff --git a/methods/ftp.h b/methods/ftp.h index 119d0c7e8..dd92f0086 100644 --- a/methods/ftp.h +++ b/methods/ftp.h @@ -78,7 +78,7 @@ class FtpMethod : public pkgAcqMethod static std::string FailFile; static int FailFd; static time_t FailTime; - static void SigTerm(int); + static APT_NORETURN void SigTerm(int); public: diff --git a/methods/http.cc b/methods/http.cc index 82f16e9b2..ed6e3517d 100644 --- a/methods/http.cc +++ b/methods/http.cc @@ -470,7 +470,7 @@ bool HttpServerState::WriteResponse(const std::string &Data) /*{{{*/ return Out.Read(Data); } /*}}}*/ -bool HttpServerState::IsOpen() /*{{{*/ +APT_PURE bool HttpServerState::IsOpen() /*{{{*/ { return (ServerFd != -1); } @@ -485,7 +485,7 @@ bool HttpServerState::InitHashes(FileFd &File) /*{{{*/ return In.Hash->AddFD(File, StartPos); } /*}}}*/ -Hashes * HttpServerState::GetHashes() /*{{{*/ +APT_PURE Hashes * HttpServerState::GetHashes() /*{{{*/ { return In.Hash; } diff --git a/methods/rsh.h b/methods/rsh.h index c2c06acfe..dd259e744 100644 --- a/methods/rsh.h +++ b/methods/rsh.h @@ -64,7 +64,7 @@ class RSHMethod : public pkgAcqMethod static std::string FailFile; static int FailFd; static time_t FailTime; - static void SigTerm(int); + static APT_NORETURN void SigTerm(int); public: diff --git a/methods/server.h b/methods/server.h index d1e151f8a..0f45ab994 100644 --- a/methods/server.h +++ b/methods/server.h @@ -129,7 +129,7 @@ class ServerMethod : public pkgAcqMethod static std::string FailFile; static int FailFd; static time_t FailTime; - static void SigTerm(int); + static APT_NORETURN void SigTerm(int); virtual bool Configuration(std::string Message); virtual bool Flush() { return Server->Flush(File); }; diff --git a/test/libapt/assert.h b/test/libapt/assert.h index cde6a6351..357801592 100644 --- a/test/libapt/assert.h +++ b/test/libapt/assert.h @@ -1,6 +1,8 @@ #include #include +#include + #if __GNUC__ >= 4 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wmissing-declarations" @@ -10,7 +12,7 @@ #define equalsNot(x,y) assertEqualsNot(y, x, __LINE__) template < typename X, typename Y > -void OutputAssertEqual(X expect, char const* compare, Y get, unsigned long const &line) { +APT_NORETURN void OutputAssertEqual(X expect, char const* compare, Y get, unsigned long const &line) { std::cerr << "Test FAILED: »" << expect << "« " << compare << " »" << get << "« at line " << line << std::endl; std::exit(EXIT_FAILURE); } -- cgit v1.2.3