summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2024-12-26 21:32:44 +0000
committerDavid Kalnischkies <david@kalnischkies.de>2025-01-05 22:16:08 +0000
commit785a7a50b53bd0794e58cca31730818714992c00 (patch)
tree08c0b01e7949643ebccf4eca625041810a96c322 /apt-pkg
parent9000543eb219f83b6b9592b681fc6811bc56e26f (diff)
Drop APT_DEPRECATED usage
C++14 includes the standard attribute, so we can use that instead. Note that we drop the deprecation of {Pkg,Dep}Iterator::operator<< as this is ignored (a friends declaration must be a definition to have attributes) very noisily by GCC >= 12 and the methods can be somewhat useful in debugging if you are to lazy to get APT::Pretty{Pkg,Dep}.
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire-method.h2
-rw-r--r--apt-pkg/cacheiterators.h8
-rw-r--r--apt-pkg/contrib/macros.h8
-rw-r--r--apt-pkg/contrib/strutl.h2
-rw-r--r--apt-pkg/deb/deblistparser.h11
5 files changed, 16 insertions, 15 deletions
diff --git a/apt-pkg/acquire-method.h b/apt-pkg/acquire-method.h
index 387d0984d..bad0935d6 100644
--- a/apt-pkg/acquire-method.h
+++ b/apt-pkg/acquire-method.h
@@ -102,7 +102,7 @@ class APT_PUBLIC pkgAcqMethod
bool MediaFail(std::string Required,std::string Drive);
virtual void Exit() {};
- APT_DEPRECATED_MSG("Use SendMessage instead") void PrintStatus(char const * const header, const char* Format, va_list &args) const;
+ [[deprecated("Use SendMessage instead")]] void PrintStatus(char const * const header, const char* Format, va_list &args) const;
public:
enum CnfFlags
diff --git a/apt-pkg/cacheiterators.h b/apt-pkg/cacheiterators.h
index 9ed5c1719..31ce1b295 100644
--- a/apt-pkg/cacheiterators.h
+++ b/apt-pkg/cacheiterators.h
@@ -177,8 +177,8 @@ class APT_PUBLIC pkgCache::PkgIterator: public Iterator<Package, PkgIterator> {
OkState State() const APT_PURE;
const char *CurVersion() const APT_PURE;
- //Nice printable representation
- APT_DEPRECATED_MSG("Use APT::PrettyPkg instead") friend std::ostream& operator <<(std::ostream& out, PkgIterator i);
+ // for a nice printable representation you likely want APT::PrettyPkg instead
+ friend std::ostream& operator<<(std::ostream& out, PkgIterator i);
std::string FullName(bool const &Pretty = false) const;
// Constructors
@@ -364,8 +364,8 @@ class APT_PUBLIC pkgCache::DepIterator : public Iterator<Dependency, DepIterator
S2 = static_cast<DependencyData *>(newMap) + (S2 - static_cast<DependencyData const *>(oldMap));
}
- //Nice printable representation
- APT_DEPRECATED_MSG("Use APT::PrettyDep instead") friend std::ostream& operator <<(std::ostream& out, DepIterator D);
+ // for a nice printable representation you likely want APT::PrettyDep instead
+ friend std::ostream& operator<<(std::ostream& out, DepIterator D);
inline DepIterator(pkgCache &Owner, Dependency *Trg, Version* = 0) :
Iterator<Dependency, DepIterator>(Owner, Trg), Type(DepVer), S2(Trg == 0 ? Owner.DepDataP : (Owner.DepDataP + Trg->DependencyData)) {
diff --git a/apt-pkg/contrib/macros.h b/apt-pkg/contrib/macros.h
index c1fa73775..66437f305 100644
--- a/apt-pkg/contrib/macros.h
+++ b/apt-pkg/contrib/macros.h
@@ -36,16 +36,12 @@
#endif
#if APT_GCC_VERSION >= 0x0300
- #define APT_DEPRECATED __attribute__ ((deprecated))
- #define APT_DEPRECATED_MSG(X) __attribute__ ((deprecated(X)))
// __attribute__((const)) is too dangerous for us, we end up using it wrongly
#define APT_PURE __attribute__((pure))
#define APT_PRINTF(n) __attribute__((format(printf, n, n + 1)))
#define APT_WEAK __attribute__((weak));
#define APT_UNUSED __attribute__((unused))
#else
- #define APT_DEPRECATED
- #define APT_DEPRECATED_MSG
#define APT_PURE
#define APT_PRINTF(n)
#define APT_WEAK
@@ -135,8 +131,12 @@ AptScopeWrapper(F) -> AptScopeWrapper<F>;
#define CLRFLAG(v,f) ((v) &=~FLAG(f))
#define CHKFLAG(v,f) ((v) & FLAG(f) ? true : false)
#if APT_GCC_VERSION >= 0x0300
+ #define APT_DEPRECATED __attribute__ ((deprecated))
+ #define APT_DEPRECATED_MSG(X) __attribute__ ((deprecated(X)))
#define APT_NORETURN __attribute__((noreturn))
#else
+ #define APT_DEPRECATED
+ #define APT_DEPRECATED_MSG(X)
#define APT_NORETURN
#endif
#endif
diff --git a/apt-pkg/contrib/strutl.h b/apt-pkg/contrib/strutl.h
index 91f5fe44b..ecb61000d 100644
--- a/apt-pkg/contrib/strutl.h
+++ b/apt-pkg/contrib/strutl.h
@@ -56,7 +56,7 @@ namespace APT {
APT_PUBLIC bool UTF8ToCodeset(const char *codeset, const std::string &orig, std::string *dest);
APT_PUBLIC char *_strstrip(char *String);
APT_PUBLIC char *_strrstrip(char *String); // right strip only
-APT_DEPRECATED_MSG("Use SubstVar to avoid memory headaches") APT_PUBLIC char *_strtabexpand(char *String,size_t Len);
+[[deprecated("Use SubstVar to avoid memory headaches")]] APT_PUBLIC char *_strtabexpand(char *String,size_t Len);
APT_PUBLIC bool ParseQuoteWord(const char *&String,std::string &Res);
APT_PUBLIC bool ParseCWord(const char *&String,std::string &Res);
APT_PUBLIC std::string QuoteString(const std::string &Str,const char *Bad);
diff --git a/apt-pkg/deb/deblistparser.h b/apt-pkg/deb/deblistparser.h
index 200e04036..aec09ed2e 100644
--- a/apt-pkg/deb/deblistparser.h
+++ b/apt-pkg/deb/deblistparser.h
@@ -82,18 +82,19 @@ class APT_HIDDEN debListParser : public pkgCacheListParser
std::string const &Arch = "");
#if APT_PKG_ABI <= 600
+ [[deprecated("Use std::string_view variant instead")]]
APT_PUBLIC static const char *ParseDepends(const char *Start, const char *Stop,
APT::StringView &Package,
APT::StringView &Ver, unsigned int &Op,
- bool const ParseArchFlags = false, bool StripMultiArch = true,
- bool const ParseRestrictionsList = false,
- std::string Arch = "") APT_DEPRECATED_MSG("Use std::string_view variant instead");
+ bool ParseArchFlags = false, bool StripMultiArch = true,
+ bool ParseRestrictionsList = false,
+ std::string Arch = "");
#endif
APT_PUBLIC static const char *ParseDepends(const char *Start, const char *Stop,
std::string_view &Package,
std::string_view &Ver, unsigned int &Op,
- bool const ParseArchFlags = false, bool StripMultiArch = true,
- bool const ParseRestrictionsList = false,
+ bool ParseArchFlags = false, bool StripMultiArch = true,
+ bool ParseRestrictionsList = false,
std::string Arch = "");
APT_PUBLIC static const char *ConvertRelation(const char *I,unsigned int &Op);