summaryrefslogtreecommitdiff
path: root/apt-pkg/contrib/macros.h
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2014-06-12 08:36:58 +0200
committerMichael Vogt <mvo@debian.org>2014-06-12 08:36:58 +0200
commitcfc7f735774ba30dbee1897248f8dfedf0229a4c (patch)
treeb4e0ac29a6b398045a803e890f5cdabcca189d6a /apt-pkg/contrib/macros.h
parenta0187f0f82a184b850b05b62e5a59b6a2055a506 (diff)
parent7701680af12a2c1a65121533c6ebcd635c013c25 (diff)
Merge tag '1.0.1ubuntu2' into ubuntu/trusty
Conflicts: configure.ac debian/changelog debian/control test/integration/framework
Diffstat (limited to 'apt-pkg/contrib/macros.h')
-rw-r--r--apt-pkg/contrib/macros.h88
1 files changed, 71 insertions, 17 deletions
diff --git a/apt-pkg/contrib/macros.h b/apt-pkg/contrib/macros.h
index e53d01b8f..2d6448e5e 100644
--- a/apt-pkg/contrib/macros.h
+++ b/apt-pkg/contrib/macros.h
@@ -54,37 +54,91 @@
#define CLRFLAG(v,f) ((v) &=~FLAG(f))
#define CHKFLAG(v,f) ((v) & FLAG(f) ? true : false)
-// some nice optional GNUC features
-#if __GNUC__ >= 3
- #define __must_check __attribute__ ((warn_unused_result))
- #define __deprecated __attribute__ ((deprecated))
- #define __attrib_const __attribute__ ((__const__))
- /* likely() and unlikely() can be used to mark boolean expressions
- as (not) likely true which will help the compiler to optimise */
+#ifdef __GNUC__
+#define APT_GCC_VERSION (__GNUC__ << 8 | __GNUC_MINOR__)
+#else
+#define APT_GCC_VERSION 0
+#endif
+
+/* likely() and unlikely() can be used to mark boolean expressions
+ as (not) likely true which will help the compiler to optimise */
+#if APT_GCC_VERSION >= 0x0300
#define likely(x) __builtin_expect (!!(x), 1)
#define unlikely(x) __builtin_expect (!!(x), 0)
#else
- #define __must_check /* no warn_unused_result */
- #define __deprecated /* no deprecated */
- #define __attrib_const /* no const attribute */
#define likely(x) (x)
#define unlikely(x) (x)
#endif
+#if APT_GCC_VERSION >= 0x0300
+ #define APT_DEPRECATED __attribute__ ((deprecated))
+ #define APT_CONST __attribute__((const))
+ #define APT_PURE __attribute__((pure))
+ #define APT_NORETURN __attribute__((noreturn))
+ #define APT_PRINTF(n) __attribute__((format(printf, n, n + 1)))
+#else
+ #define APT_DEPRECATED
+ #define APT_CONST
+ #define APT_PURE
+ #define APT_NORETURN
+ #define APT_PRINTF(n)
+#endif
+
+#if APT_GCC_VERSION > 0x0302
+ #define APT_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
+ #define APT_MUSTCHECK __attribute__((warn_unused_result))
+#else
+ #define APT_NONNULL(...)
+ #define APT_REQRET
+#endif
+
+#if APT_GCC_VERSION >= 0x0400
+ #define APT_SENTINEL __attribute__((sentinel))
+ #define APT_PUBLIC __attribute__ ((visibility ("default")))
+ #define APT_HIDDEN __attribute__ ((visibility ("hidden")))
+#else
+ #define APT_SENTINEL
+ #define APT_PUBLIC
+ #define APT_HIDDEN
+#endif
+
// cold functions are unlikely() to be called
-#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4
- #define __cold __attribute__ ((__cold__))
- #define __hot __attribute__ ((__hot__))
+#if APT_GCC_VERSION >= 0x0403
+ #define APT_COLD __attribute__ ((__cold__))
+ #define APT_HOT __attribute__ ((__hot__))
#else
- #define __cold /* no cold marker */
- #define __hot /* no hot marker */
+ #define APT_COLD
+ #define APT_HOT
#endif
-#ifdef __GNUG__
-// Methods have a hidden this parameter that is visible to this attribute
+#ifndef APT_10_CLEANER_HEADERS
+#if APT_GCC_VERSION >= 0x0300
+ #define __must_check __attribute__ ((warn_unused_result))
+ #define __deprecated __attribute__ ((deprecated))
+ #define __attrib_const __attribute__ ((__const__))
#define __like_printf(n) __attribute__((format(printf, n, n + 1)))
#else
+ #define __must_check /* no warn_unused_result */
+ #define __deprecated /* no deprecated */
+ #define __attrib_const /* no const attribute */
#define __like_printf(n) /* no like-printf */
#endif
+#if APT_GCC_VERSION >= 0x0403
+ #define __cold __attribute__ ((__cold__))
+ #define __hot __attribute__ ((__hot__))
+#else
+ #define __cold /* no cold marker */
+ #define __hot /* no hot marker */
+#endif
+#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.
+// Non-ABI-Breaks should only increase RELEASE number.
+// See also buildlib/libversion.mak
+#define APT_PKG_MAJOR 4
+#define APT_PKG_MINOR 12
+#define APT_PKG_RELEASE 0
#endif