summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2014-10-26 23:17:03 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2014-11-08 14:26:00 +0100
commit586d8704716a10e0f8b9c400cab500f5353eebe6 (patch)
tree9318582dc8c53a88084ad00c4dfa6d02c83b3ca6
parent23fb7b2cbbda62c99a199d29ad62205b23d35af4 (diff)
replace ignore-deprecated #pragma dance with _Pragma
For compatibility we use/provide and fill quiet some deprecated methods and fields, which subsequently earns us a warning for using them. These warnings therefore have to be disabled for these codeparts and that is what this change does now in a slightly more elegant way. Git-Dch: Ignore
-rw-r--r--apt-pkg/acquire-item.cc18
-rw-r--r--apt-pkg/cacheset.cc46
-rw-r--r--apt-pkg/cacheset.h118
-rw-r--r--apt-pkg/contrib/hashes.cc27
-rw-r--r--apt-pkg/contrib/hashes.h9
-rw-r--r--apt-pkg/contrib/macros.h16
-rw-r--r--apt-pkg/deb/debsrcrecords.cc20
-rw-r--r--apt-pkg/indexrecords.cc9
-rw-r--r--apt-pkg/indexrecords.h10
-rw-r--r--apt-pkg/pkgcachegen.cc9
-rw-r--r--apt-pkg/srcrecords.h10
-rw-r--r--apt-pkg/upgrade.cc10
-rw-r--r--apt-pkg/vendorlist.cc10
13 files changed, 76 insertions, 236 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index e0aef5874..2df638a83 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -104,10 +104,7 @@ static bool AllowInsecureRepositories(indexRecords const * const MetaIndexParser
// Acquire::Item::Item - Constructor /*{{{*/
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
pkgAcquire::Item::Item(pkgAcquire *Owner,
HashStringList const &ExpectedHashes,
pkgAcqMetaBase *TransactionManager)
@@ -120,9 +117,7 @@ pkgAcquire::Item::Item(pkgAcquire *Owner,
if(TransactionManager != NULL)
TransactionManager->Add(this);
}
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
/*}}}*/
// Acquire::Item::~Item - Destructor /*{{{*/
// ---------------------------------------------------------------------
@@ -275,14 +270,7 @@ bool pkgAcquire::Item::RenameOnError(pkgAcquire::Item::RenameOnErrorState const
void pkgAcquire::Item::SetActiveSubprocess(const std::string &subprocess)/*{{{*/
{
ActiveSubprocess = subprocess;
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
- Mode = ActiveSubprocess.c_str();
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+ APT_IGNORE_DEPRECATED(Mode = ActiveSubprocess.c_str();)
}
/*}}}*/
// Acquire::Item::ReportMirrorFailure /*{{{*/
diff --git a/apt-pkg/cacheset.cc b/apt-pkg/cacheset.cc
index 76a7e717e..9127a4064 100644
--- a/apt-pkg/cacheset.cc
+++ b/apt-pkg/cacheset.cc
@@ -613,19 +613,14 @@ void CacheSetHelper::canNotFindPackage(enum PkgSelector const select,
PackageContainerInterface * const pci, pkgCacheFile &Cache,
std::string const &pattern) {
switch (select) {
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
case REGEX: canNotFindRegEx(pci, Cache, pattern); break;
case TASK: canNotFindTask(pci, Cache, pattern); break;
case FNMATCH: canNotFindFnmatch(pci, Cache, pattern); break;
case PACKAGENAME: canNotFindPackage(pci, Cache, pattern); break;
case STRING: canNotFindPackage(pci, Cache, pattern); break;
case UNKNOWN: break;
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
}
}
// canNotFindTask - handle the case no package is found for a task /*{{{*/
@@ -663,19 +658,14 @@ pkgCache::PkgIterator CacheSetHelper::canNotFindPkgName(pkgCacheFile &Cache,
void CacheSetHelper::canNotFindVersion(enum VerSelector const select, VersionContainerInterface * const vci, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg)
{
switch (select) {
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
case ALL: canNotFindAllVer(vci, Cache, Pkg); break;
case INSTCAND: canNotFindInstCandVer(vci, Cache, Pkg); break;
case CANDINST: canNotFindCandInstVer(vci, Cache, Pkg); break;
case NEWEST: canNotFindNewestVer(Cache, Pkg); break;
case CANDIDATE: canNotFindCandidateVer(Cache, Pkg); break;
case INSTALLED: canNotFindInstalledVer(Cache, Pkg); break;
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
case CANDANDINST: canNotGetCandInstVer(Cache, Pkg); break;
case RELEASE:
case VERSIONNUMBER:
@@ -706,16 +696,11 @@ void CacheSetHelper::canNotFindCandInstVer(VersionContainerInterface * const /*v
// canNotGetVersion - for package by selector /*{{{*/
pkgCache::VerIterator CacheSetHelper::canNotGetVersion(enum VerSelector const select, pkgCacheFile &Cache, pkgCache::PkgIterator const &Pkg) {
switch (select) {
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
case NEWEST: return canNotFindNewestVer(Cache, Pkg);
case CANDIDATE: return canNotFindCandidateVer(Cache, Pkg);
case INSTALLED: return canNotFindInstalledVer(Cache, Pkg);
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
case CANDINST: return canNotGetCandInstVer(Cache, Pkg);
case INSTCAND: return canNotGetInstCandVer(Cache, Pkg);
case ALL:
@@ -772,16 +757,11 @@ pkgCache::VerIterator CacheSetHelper::canNotGetCandInstVer(pkgCacheFile &Cache,
APT_CONST void CacheSetHelper::showPackageSelection(pkgCache::PkgIterator const &pkg, enum PkgSelector const select,
std::string const &pattern) {
switch (select) {
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
case REGEX: showRegExSelection(pkg, pattern); break;
case TASK: showTaskSelection(pkg, pattern); break;
case FNMATCH: showFnmatchSelection(pkg, pattern); break;
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
case PACKAGENAME: /* no suprises here */ break;
case STRING: /* handled by the special cases */ break;
case UNKNOWN: break;
@@ -807,20 +787,14 @@ APT_CONST void CacheSetHelper::showFnmatchSelection(pkgCache::PkgIterator const
APT_CONST void CacheSetHelper::showVersionSelection(pkgCache::PkgIterator const &Pkg,
pkgCache::VerIterator const &Ver, enum VerSelector const select, std::string const &pattern) {
switch (select) {
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
case RELEASE:
showSelectedVersion(Pkg, Ver, pattern, true);
break;
case VERSIONNUMBER:
showSelectedVersion(Pkg, Ver, pattern, false);
break;
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_POP
case NEWEST:
case CANDIDATE:
case INSTALLED:
diff --git a/apt-pkg/cacheset.h b/apt-pkg/cacheset.h
index f3f1d1fc6..884e8b859 100644
--- a/apt-pkg/cacheset.h
+++ b/apt-pkg/cacheset.h
@@ -23,6 +23,7 @@
#include <apt-pkg/error.h>
#include <apt-pkg/pkgcache.h>
#include <apt-pkg/cacheiterators.h>
+#include <apt-pkg/macros.h>
#ifndef APT_8_CLEANER_HEADERS
#include <apt-pkg/cachefile.h>
@@ -224,14 +225,7 @@ public:
inline std::string FullName(bool const Pretty) const { return getPkg().FullName(Pretty); }
inline std::string FullName() const { return getPkg().FullName(); }
APT_DEPRECATED inline const char *Section() const {
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
- return getPkg().Section();
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+ APT_IGNORE_DEPRECATED(return getPkg().Section();)
}
inline bool Purge() const {return getPkg().Purge(); }
inline const char *Arch() const {return getPkg().Arch(); }
@@ -261,14 +255,9 @@ public:
REGEX = CacheSetHelper::REGEX,
TASK = CacheSetHelper::TASK,
FNMATCH = CacheSetHelper::FNMATCH };
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
void setConstructor(Constructor const by) { ConstructedBy = (CacheSetHelper::PkgSelector)by; }
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
void setConstructor(CacheSetHelper::PkgSelector const by) { ConstructedBy = by; }
CacheSetHelper::PkgSelector getConstructor() const { return ConstructedBy; }
@@ -290,19 +279,14 @@ public:
APT_DEPRECATED typedef CacheSetHelper::PkgModifier Modifier;
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
APT_DEPRECATED static pkgCache::PkgIterator FromName(pkgCacheFile &Cache, std::string const &pattern, CacheSetHelper &helper) {
return helper.PackageFromName(Cache, pattern); }
APT_DEPRECATED static bool FromModifierCommandLine(unsigned short &modID, PackageContainerInterface * const pci,
pkgCacheFile &Cache, const char * cmdline,
std::list<Modifier> const &mods, CacheSetHelper &helper) {
return helper.PackageFromModifierCommandLine(modID, pci, Cache, cmdline, mods); }
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
private:
CacheSetHelper::PkgSelector ConstructedBy;
@@ -371,14 +355,9 @@ public: /*{{{*/
PackageContainer() : PackageContainerInterface() {}
PackageContainer(CacheSetHelper::PkgSelector const &by) : PackageContainerInterface(by) {}
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
APT_DEPRECATED PackageContainer(Constructor const &by) : PackageContainerInterface((CacheSetHelper::PkgSelector)by) {}
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
/** \brief sort all included versions with given comparer
@@ -439,10 +418,7 @@ public: /*{{{*/
return FromFnmatch(Cache, pattern, helper);
}
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
/** \brief returns a package specified by a string
\param Cache the package is in
@@ -455,9 +431,7 @@ public: /*{{{*/
CacheSetHelper helper;
return FromName(Cache, pattern, helper);
}
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
/** \brief returns all packages specified by a string
@@ -663,65 +637,45 @@ public:
Modifier (unsigned short const &id, const char * const alias, Position const &pos,
enum CacheSetHelper::VerSelector const select) : ID(id), Alias(alias), Pos(pos),
SelectVersion(select) {}
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
APT_DEPRECATED Modifier(unsigned short const &id, const char * const alias, Position const &pos,
Version const &select) : ID(id), Alias(alias), Pos(pos),
SelectVersion((CacheSetHelper::VerSelector)select) {}
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
};
static bool FromCommandLine(VersionContainerInterface * const vci, pkgCacheFile &Cache,
const char **cmdline, CacheSetHelper::VerSelector const fallback,
CacheSetHelper &helper);
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
APT_DEPRECATED static bool FromCommandLine(VersionContainerInterface * const vci, pkgCacheFile &Cache,
const char **cmdline, Version const &fallback,
CacheSetHelper &helper) {
return FromCommandLine(vci, Cache, cmdline, (CacheSetHelper::VerSelector)fallback, helper);
}
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
static bool FromString(VersionContainerInterface * const vci, pkgCacheFile &Cache,
std::string pkg, CacheSetHelper::VerSelector const fallback, CacheSetHelper &helper,
bool const onlyFromName = false);
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
APT_DEPRECATED static bool FromString(VersionContainerInterface * const vci, pkgCacheFile &Cache,
std::string pkg, Version const &fallback, CacheSetHelper &helper,
bool const onlyFromName = false) {
return FromString(vci, Cache, pkg, (CacheSetHelper::VerSelector)fallback, helper, onlyFromName);
}
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
static bool FromPackage(VersionContainerInterface * const vci, pkgCacheFile &Cache,
pkgCache::PkgIterator const &P, CacheSetHelper::VerSelector const fallback,
CacheSetHelper &helper);
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
APT_DEPRECATED static bool FromPackage(VersionContainerInterface * const vci, pkgCacheFile &Cache,
pkgCache::PkgIterator const &P, Version const &fallback,
CacheSetHelper &helper) {
return FromPackage(vci, Cache, P, (CacheSetHelper::VerSelector)fallback, helper);
}
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
static bool FromModifierCommandLine(unsigned short &modID,
VersionContainerInterface * const vci,
@@ -735,10 +689,7 @@ public:
pkgCache::DepIterator const &D,
CacheSetHelper::VerSelector const selector,
CacheSetHelper &helper);
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
APT_DEPRECATED static bool FromDependency(VersionContainerInterface * const vci,
pkgCacheFile &Cache,
pkgCache::DepIterator const &D,
@@ -746,9 +697,7 @@ public:
CacheSetHelper &helper) {
return FromDependency(vci, Cache, D, (CacheSetHelper::VerSelector)selector, helper);
}
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
protected: /*{{{*/
@@ -879,10 +828,7 @@ public: /*{{{*/
static VersionContainer FromString(pkgCacheFile &Cache, std::string pkg) {
return FromString(Cache, pkg, CacheSetHelper::CANDINST);
}
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
static VersionContainer FromCommandLine(pkgCacheFile &Cache, const char **cmdline,
Version const &fallback, CacheSetHelper &helper) {
VersionContainer vercon;
@@ -906,9 +852,7 @@ public: /*{{{*/
CacheSetHelper helper;
return FromString(Cache, pkg, (CacheSetHelper::VerSelector)fallback, helper);
}
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
/** \brief returns all versions specified for the package
@@ -927,10 +871,7 @@ public: /*{{{*/
CacheSetHelper helper;
return FromPackage(Cache, P, fallback, helper);
}
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P,
Version const &fallback, CacheSetHelper &helper) {
VersionContainer vercon;
@@ -942,9 +883,7 @@ public: /*{{{*/
CacheSetHelper helper;
return FromPackage(Cache, P, (CacheSetHelper::VerSelector)fallback, helper);
}
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
static VersionContainer FromPackage(pkgCacheFile &Cache, pkgCache::PkgIterator const &P) {
return FromPackage(Cache, P, CacheSetHelper::CANDIDATE);
}
@@ -985,10 +924,7 @@ public: /*{{{*/
CacheSetHelper helper;
return FromPackage(Cache, D, selector, helper);
}
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache::DepIterator const &D,
Version const &selector, CacheSetHelper &helper) {
VersionContainer vercon;
@@ -1000,9 +936,7 @@ public: /*{{{*/
CacheSetHelper helper;
return FromPackage(Cache, D, (CacheSetHelper::VerSelector)selector, helper);
}
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
static VersionContainer FromDependency(pkgCacheFile &Cache, pkgCache::DepIterator const &D) {
return FromPackage(Cache, D, CacheSetHelper::CANDIDATE);
}
diff --git a/apt-pkg/contrib/hashes.cc b/apt-pkg/contrib/hashes.cc
index 55180c642..6e7080bc9 100644
--- a/apt-pkg/contrib/hashes.cc
+++ b/apt-pkg/contrib/hashes.cc
@@ -258,10 +258,7 @@ public:
bool Hashes::Add(const unsigned char * const Data,unsigned long long const Size, unsigned int const Hashes)
{
bool Res = true;
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
if ((Hashes & MD5SUM) == MD5SUM)
Res &= MD5.Add(Data, Size);
if ((Hashes & SHA1SUM) == SHA1SUM)
@@ -270,9 +267,7 @@ bool Hashes::Add(const unsigned char * const Data,unsigned long long const Size,
Res &= SHA256.Add(Data, Size);
if ((Hashes & SHA512SUM) == SHA512SUM)
Res &= SHA512.Add(Data, Size);
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
d->FileSize += Size;
return Res;
}
@@ -323,28 +318,18 @@ bool Hashes::AddFD(FileFd &Fd,unsigned long long Size, unsigned int const Hashes
HashStringList Hashes::GetHashStringList()
{
HashStringList hashes;
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
hashes.push_back(HashString("MD5Sum", MD5.Result().Value()));
hashes.push_back(HashString("SHA1", SHA1.Result().Value()));
hashes.push_back(HashString("SHA256", SHA256.Result().Value()));
hashes.push_back(HashString("SHA512", SHA512.Result().Value()));
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
std::string SizeStr;
strprintf(SizeStr, "%llu", d->FileSize);
hashes.push_back(HashString("Checksum-FileSize", SizeStr));
return hashes;
}
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
Hashes::Hashes() { d = new PrivateHashes(); }
Hashes::~Hashes() { delete d; }
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
diff --git a/apt-pkg/contrib/hashes.h b/apt-pkg/contrib/hashes.h
index e2e213855..ca186d704 100644
--- a/apt-pkg/contrib/hashes.h
+++ b/apt-pkg/contrib/hashes.h
@@ -189,15 +189,10 @@ class Hashes
HashStringList GetHashStringList();
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
Hashes();
virtual ~Hashes();
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
private:
APT_HIDDEN APT_CONST inline unsigned int boolsToFlag(bool const addMD5, bool const addSHA1, bool const addSHA256, bool const addSHA512)
diff --git a/apt-pkg/contrib/macros.h b/apt-pkg/contrib/macros.h
index 3a5e37c63..c0af4b2c8 100644
--- a/apt-pkg/contrib/macros.h
+++ b/apt-pkg/contrib/macros.h
@@ -132,6 +132,22 @@
#endif
#endif
+#if __GNUC__ >= 4
+ #define APT_IGNORE_DEPRECATED_PUSH \
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
+ #define APT_IGNORE_DEPRECATED_POP \
+ _Pragma("GCC diagnostic pop")
+ #define APT_IGNORE_DEPRECATED(XXX) \
+ APT_IGNORE_DEPRECATED_PUSH \
+ XXX \
+ APT_IGNORE_DEPRECATED_POP
+#else
+ #define APT_IGNORE_DEPRECATED_PUSH
+ #define APT_IGNORE_DEPRECATED_POP
+ #define APT_IGNORE_DEPRECATED(XXX) XXX
+#endif
+
// These lines are extracted by the makefiles and the buildsystem
// Increasing MAJOR or MINOR results in the need of recompiling all
// reverse-dependencies of libapt-pkg against the new SONAME.
diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc
index 97f43aca2..d3c137bb9 100644
--- a/apt-pkg/deb/debsrcrecords.cc
+++ b/apt-pkg/deb/debsrcrecords.cc
@@ -170,16 +170,8 @@ bool debSrcRecordParser::Files(std::vector<pkgSrcRecords::File> &List)
// we have it already, store the new hash and be done
if (file != List.end())
{
-#if __GNUC__ >= 4
- // set for compatibility only, so warn users not us
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
if (checksumField == "Files")
- file->MD5Hash = hash;
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+ APT_IGNORE_DEPRECATED(file->MD5Hash = hash;)
// an error here indicates that we have two different hashes for the same file
if (file->Hashes.push_back(hashString) == false)
return _error->Error("Error parsing checksum in %s of source package %s", checksumField.c_str(), Package().c_str());
@@ -192,16 +184,8 @@ bool debSrcRecordParser::Files(std::vector<pkgSrcRecords::File> &List)
F.Size = strtoull(size.c_str(), NULL, 10);
F.Hashes.push_back(hashString);
-#if __GNUC__ >= 4
- // set for compatibility only, so warn users not us
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
if (checksumField == "Files")
- F.MD5Hash = hash;
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+ APT_IGNORE_DEPRECATED(F.MD5Hash = hash;)
// Try to guess what sort of file it is we are getting.
string::size_type Pos = F.Path.length()-1;
diff --git a/apt-pkg/indexrecords.cc b/apt-pkg/indexrecords.cc
index e1e9ba657..0f27af32b 100644
--- a/apt-pkg/indexrecords.cc
+++ b/apt-pkg/indexrecords.cc
@@ -119,14 +119,7 @@ bool indexRecords::Load(const string Filename) /*{{{*/
std::string SizeStr;
strprintf(SizeStr, "%llu", Size);
Sum->Hashes.push_back(HashString("Checksum-FileSize", SizeStr));
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
- Sum->Hash = HashString(HashString::SupportedHashes()[i],Hash);
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+ APT_IGNORE_DEPRECATED(Sum->Hash = HashString(HashString::SupportedHashes()[i],Hash);)
Entries[Name] = Sum;
}
Entries[Name]->Hashes.push_back(HashString(HashString::SupportedHashes()[i],Hash));
diff --git a/apt-pkg/indexrecords.h b/apt-pkg/indexrecords.h
index 88a06779c..06b9dafa6 100644
--- a/apt-pkg/indexrecords.h
+++ b/apt-pkg/indexrecords.h
@@ -76,11 +76,7 @@ class indexRecords
virtual ~indexRecords();
};
-#if __GNUC__ >= 4
- // ensure that con- & de-structor don't trigger this warning
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
struct indexRecords::checkSum
{
std::string MetaKeyFilename;
@@ -89,8 +85,6 @@ struct indexRecords::checkSum
APT_DEPRECATED HashString Hash;
};
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
#endif
diff --git a/apt-pkg/pkgcachegen.cc b/apt-pkg/pkgcachegen.cc
index 9e6931fa6..a2c1c8760 100644
--- a/apt-pkg/pkgcachegen.cc
+++ b/apt-pkg/pkgcachegen.cc
@@ -668,14 +668,7 @@ bool pkgCacheGenerator::NewPackage(pkgCache::PkgIterator &Pkg,const string &Name
Grp->LastPackage = Package;
// Set the name, arch and the ID
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
- Pkg->Name = Grp->Name;
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+ APT_IGNORE_DEPRECATED(Pkg->Name = Grp->Name;)
Pkg->Group = Grp.Index();
// all is mapped to the native architecture
map_stringitem_t const idxArch = (Arch == "all") ? Cache.HeaderP->Architecture : StoreString(MIXED, Arch);
diff --git a/apt-pkg/srcrecords.h b/apt-pkg/srcrecords.h
index c68d374bb..de2b6ff64 100644
--- a/apt-pkg/srcrecords.h
+++ b/apt-pkg/srcrecords.h
@@ -30,11 +30,7 @@ class pkgSrcRecords
{
public:
-#if __GNUC__ >= 4
- // ensure that con- & de-structor don't trigger this warning
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
// Describes a single file
struct File
{
@@ -44,9 +40,7 @@ class pkgSrcRecords
HashStringList Hashes;
APT_DEPRECATED std::string MD5Hash;
};
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
// Abstract parser for each source record
class Parser
diff --git a/apt-pkg/upgrade.cc b/apt-pkg/upgrade.cc
index ca670bdf5..41e76802a 100644
--- a/apt-pkg/upgrade.cc
+++ b/apt-pkg/upgrade.cc
@@ -282,11 +282,7 @@ bool pkgMinimizeUpgrade(pkgDepCache &Cache)
// APT::Upgrade::Upgrade - Upgrade using a specific strategy /*{{{*/
bool APT::Upgrade::Upgrade(pkgDepCache &Cache, int mode, OpProgress * const Progress)
{
-#if __GNUC__ >= 4
- // the deprecated methods will become our privates, so that is fine
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+APT_IGNORE_DEPRECATED_PUSH
if (mode == ALLOW_EVERYTHING)
return pkgDistUpgrade(Cache, Progress);
else if ((mode & ~FORBID_REMOVE_PACKAGES) == 0)
@@ -295,9 +291,7 @@ bool APT::Upgrade::Upgrade(pkgDepCache &Cache, int mode, OpProgress * const Prog
return pkgAllUpgradeNoNewPackages(Cache, Progress);
else
_error->Error("pkgAllUpgrade called with unsupported mode %i", mode);
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP
return false;
}
/*}}}*/
diff --git a/apt-pkg/vendorlist.cc b/apt-pkg/vendorlist.cc
index fb33ff17d..db5b87fc0 100644
--- a/apt-pkg/vendorlist.cc
+++ b/apt-pkg/vendorlist.cc
@@ -11,10 +11,8 @@
#include <apti18n.h>
-#if __GNUC__ >= 4
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
-#endif
+// The whole vendor system is deprecated
+APT_IGNORE_DEPRECATED_PUSH
#include <apt-pkg/vendor.h>
#include <apt-pkg/vendorlist.h>
@@ -163,6 +161,4 @@ const Vendor* pkgVendorList::FindVendor(const std::vector<string> GPGVOutput) /*
}
/*}}}*/
-#if __GNUC__ >= 4
- #pragma GCC diagnostic pop
-#endif
+APT_IGNORE_DEPRECATED_POP