The following commit has been merged in the master branch:
commit 28b0443163ac43515197dbef8ff441990be43866
Author: Guillem Jover <[email protected]>
Date:   Sat Mar 13 07:29:23 2010 +0100

    libdpkg: Use __attribute__ keyword depending on compiler support
    
    Check for compiler support from preprocessor macros and selectively
    enable specific __attribute__ specifications. We avoid exposing the
    configure variable HAVE_C_ATTRIBUTE, which was never defined for the
    installed headers. Remove the now unused DPKG_C_ATTRIBUTE autoconf
    macro.

diff --git a/configure.ac b/configure.ac
index 15cdfb0..8b7e213 100644
--- a/configure.ac
+++ b/configure.ac
@@ -114,7 +114,6 @@ DPKG_TYPE_PTRDIFF_T
 AC_CHECK_SIZEOF([unsigned int])
 AC_CHECK_SIZEOF([unsigned long])
 DPKG_DECL_SYS_SIGLIST
-DPKG_C_ATTRIBUTE
 
 # Checks for library functions.
 DPKG_FUNC_VA_COPY
diff --git a/debian/changelog b/debian/changelog
index 39c530c..ebecbfc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ dpkg (1.15.6.1) UNRELEASED; urgency=low
   * Fix two memory leaks introduced in 1.15.6.
   * Always use C99 variadic macros, as the build requires them anyway, we
     avoid exposing the configure variable HAVE_C99 on installed headers.
+  * Use __attribute__ keyword depending on compiler support, we avoid
+    exposing the configure variable HAVE_C_ATTRIBUTE on installed headers.
 
  -- Guillem Jover <[email protected]>  Sat, 13 Mar 2010 05:23:34 +0100
 
diff --git a/lib/dpkg/macros.h b/lib/dpkg/macros.h
index 6b2a354..ca371ef 100644
--- a/lib/dpkg/macros.h
+++ b/lib/dpkg/macros.h
@@ -27,19 +27,23 @@
 
 /* Language definitions. */
 
-#if HAVE_C_ATTRIBUTE
+#if defined(__GNUC__) && (__GNUC__ >= 3)
 #define DPKG_ATTR_UNUSED       __attribute__((unused))
 #define DPKG_ATTR_CONST                __attribute__((const))
 #define DPKG_ATTR_NORET                __attribute__((noreturn))
 #define DPKG_ATTR_PRINTF(n)    __attribute__((format(printf, n, n + 1)))
 #define DPKG_ATTR_VPRINTF(n)   __attribute__((format(printf, n, 0)))
-#define DPKG_ATTR_SENTINEL     __attribute__((sentinel))
 #else
 #define DPKG_ATTR_UNUSED
 #define DPKG_ATTR_CONST
 #define DPKG_ATTR_NORET
 #define DPKG_ATTR_PRINTF(n)
 #define DPKG_ATTR_VPRINTF(n)
+#endif
+
+#if defined(__GNUC__) && (__GNUC__ >= 4)
+#define DPKG_ATTR_SENTINEL     __attribute__((sentinel))
+#else
 #define DPKG_ATTR_SENTINEL
 #endif
 
diff --git a/m4/dpkg-compiler.m4 b/m4/dpkg-compiler.m4
index db68e6f..08154ae 100644
--- a/m4/dpkg-compiler.m4
+++ b/m4/dpkg-compiler.m4
@@ -38,23 +38,6 @@ AC_DEFUN([DPKG_COMPILER_OPTIMISATIONS],
 fi])dnl
 ])
 
-# DPKG_C_ATTRIBUTE
-# ----------------
-# Check whether the C compiler supports __attribute__, defines HAVE_C_ATTRIBUTE
-AC_DEFUN([DPKG_C_ATTRIBUTE],
-[AC_CACHE_CHECK([whether compiler supports __attribute__], [dpkg_cv_attribute],
-       [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
-               [[]],
-               [[extern int testfunction(int x) __attribute__((unused))]]
-       )],
-       [dpkg_cv_attribute=yes],
-       [dpkg_cv_attribute=no])])
-AS_IF([test "x$dpkg_cv_attribute" = "xyes"],
-       [AC_DEFINE([HAVE_C_ATTRIBUTE], 1,
-               [Define to 1 if compiler supports '__attribute__', 0 
otherwise.])],
-       [AC_DEFINE([HAVE_C_ATTRIBUTE], 0)])dnl
-])# DPKG_C_ATTRIBUTE
-
 # DPKG_TRY_C99([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND])
 # ------------------------------------------------------
 # Try compiling some C99 code to see whether it works

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]

Reply via email to