]> git.saurik.com Git - apt.git/commitdiff
move defines for version to macros.h
authorDavid Kalnischkies <david@kalnischkies.de>
Sat, 1 Mar 2014 21:27:11 +0000 (22:27 +0100)
committerDavid Kalnischkies <david@kalnischkies.de>
Thu, 13 Mar 2014 12:58:45 +0000 (13:58 +0100)
also adds namespaced attributes for good usage

Git-Dch: Ignore

apt-pkg/contrib/macros.h
apt-pkg/init.h
buildlib/libversion.mak
prepare-release

index e53d01b8fcafaa32ce64c4900b36fb55b264df2f..294242e686b8a0bd7cff6705fe9309d070dff6e7 100644 (file)
 #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_UNUSED      __attribute__((unused))
+       #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_UNUSED
+       #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))
+#else
+       #define APT_SENTINEL
+#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 __cold
+       #define __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
index b6f3df7537b65eb52635b583631c02fcdb5bffce..4ee7a95acc4182ba21cc28fd17cefc0499dd3d55 100644 (file)
@@ -1,6 +1,5 @@
 // -*- mode: cpp; mode: fold -*-
 // Description                                                         /*{{{*/
-// $Id: init.h,v 1.9.2.2 2004/01/02 18:51:00 mdz Exp $
 /* ######################################################################
 
    Init - Initialize the package library
 #include <apt-pkg/configuration.h>
 #include <apt-pkg/pkgsystem.h>
 #endif
+#include <apt-pkg/macros.h>
 
 class pkgSystem;
 class Configuration;
 
-// 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
-    
 extern const char *pkgVersion;
 extern const char *pkgLibVersion;
 
index 796c956e7becab3a7c3b999d85359a0384eca446..deb3da377882a8ff835ff6ba1faa73c4f31dd8bc 100644 (file)
@@ -2,9 +2,9 @@
 # Version number of libapt-pkg.
 # Please increase MAJOR with each ABI break,
 # with each non-ABI break to the lib, please increase RELEASE.
-# The versionnumber is extracted from apt-pkg/init.h - see also there.
-LIBAPTPKG_MAJOR=$(shell awk -v ORS='.' '/^\#define APT_PKG_M/ {print $$3}' $(BASE)/apt-pkg/init.h | sed 's/\.$$//')
-LIBAPTPKG_RELEASE=$(shell grep -E '^\#define APT_PKG_RELEASE' $(BASE)/apt-pkg/init.h | cut -d ' ' -f 3)
+# The versionnumber is extracted from apt-pkg/macros.h - see also there.
+LIBAPTPKG_MAJOR=$(shell awk -v ORS='.' '/^\#define APT_PKG_M/ {print $$3}' $(BASE)/apt-pkg/contrib/macros.h | sed 's/\.$$//')
+LIBAPTPKG_RELEASE=$(shell grep -E '^\#define APT_PKG_RELEASE' $(BASE)/apt-pkg/contrib/macros.h | cut -d ' ' -f 3)
 
 # Version number of libapt-inst
 # Please increase MAJOR with each ABI break,
index 6229ee1fdc64243dc6844ab30634e09c51849105..7b7fd122448592db2f46b655958e64a92d144838 100755 (executable)
@@ -11,7 +11,7 @@ fi
 VERSION=$(dpkg-parsechangelog | sed -n -e '/^Version:/s/^Version: //p')
 DISTRIBUTION=$(dpkg-parsechangelog | sed -n -e '/^Distribution:/s/^Distribution: //p')
 
-LIBAPTPKGVERSION="$(awk -v ORS='.' '/^\#define APT_PKG_M/ {print $3}' apt-pkg/init.h | sed 's/\.$//')"
+LIBAPTPKGVERSION="$(awk -v ORS='.' '/^\#define APT_PKG_M/ {print $3}' apt-pkg/contrib/macros.h | sed 's/\.$//')"
 LIBAPTINSTVERSION="$(egrep '^MAJOR=' apt-inst/makefile |cut -d '=' -f 2)"
 
 librarysymbolsfromfile() {