]> git.saurik.com Git - apt.git/commitdiff
replace ignore-deprecated #pragma dance with _Pragma
authorDavid Kalnischkies <david@kalnischkies.de>
Sun, 26 Oct 2014 22:17:03 +0000 (23:17 +0100)
committerDavid Kalnischkies <david@kalnischkies.de>
Sat, 8 Nov 2014 13:26:00 +0000 (14:26 +0100)
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

13 files changed:
apt-pkg/acquire-item.cc
apt-pkg/cacheset.cc
apt-pkg/cacheset.h
apt-pkg/contrib/hashes.cc
apt-pkg/contrib/hashes.h
apt-pkg/contrib/macros.h
apt-pkg/deb/debsrcrecords.cc
apt-pkg/indexrecords.cc
apt-pkg/indexrecords.h
apt-pkg/pkgcachegen.cc
apt-pkg/srcrecords.h
apt-pkg/upgrade.cc
apt-pkg/vendorlist.cc

index e0aef587461d865bf841ddf15f4a27964955fbb6..2df638a83d5da21657377d7db0f50c22222b08f6 100644 (file)
@@ -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                                  /*{{{*/
index 76a7e717e7799a3eb183d69c156d162ca20477cb..9127a4064f94748f1cf88667e0fe3682205f38e4 100644 (file)
@@ -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:
index f3f1d1fc67602e5b17665fdb96d94d260bf952d9..884e8b859cff9aced5259d3251c0a8b75cd49800 100644 (file)
@@ -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);
        }
index 55180c64232d8704176ddc183218bb1175748c9e..6e7080bc90d9126e1f82240826d90dd90462ab5c 100644 (file)
@@ -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
index e2e2138551d62ba6a7cbc387ed9ffd5f9df31562..ca186d70430118029f0e18dfe2a12f6b524d944e 100644 (file)
@@ -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)
index 3a5e37c634a54bee4efd58e2b12b2e11c39999ef..c0af4b2c86184382128a84ee9f2e0d0639029d8d 100644 (file)
 #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.
index 97f43aca2b54f8fda5210879a9dc6f4f2780824c..d3c137bb9c1bdc91eca13782a96bbb7521a292eb 100644 (file)
@@ -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;
index e1e9ba657f3881a2236e41f24cd36e24e87e8ea3..0f27af32b8a074eb4472c1e7ef4b121c332eac5d 100644 (file)
@@ -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));
index 88a06779c5292ab9b37063963465e45977c2ab96..06b9dafa68899d5c9076eb4ff575f894c7e49bd4 100644 (file)
@@ -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
index 9e6931fa6b8667ab419a2652428ee5ec9d1cfd7f..a2c1c876085b643c1ce6bdbe99a981d6cbd463b4 100644 (file)
@@ -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);
index c68d374bb4fb44a4e3992a02f1d19013a340043f..de2b6ff648987038ed175d0e75a90bc66e5a00e3 100644 (file)
@@ -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
index ca670bdf5804c2c1b3d223ff53192ae9a5305004..41e76802a6b0161a2b619059ff1f61c1106976c3 100644 (file)
@@ -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;
 }
                                                                        /*}}}*/
index fb33ff17d97f20f85a3cfcc9128cc7e7c98f7a8b..db5b87fc07f9aeafa811bb73eec496d7f50040cc 100644 (file)
 
 #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