summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDarren Salt <linux@youmustbejoking.demon.co.uk>2008-05-03 14:34:45 +0100
committerDarren Salt <linux@youmustbejoking.demon.co.uk>2008-05-03 14:34:45 +0100
commit90bb53f8c9b7ca3db6841a5005af791b93782d96 (patch)
treedfb47862d7bb0ada90ce2bbc32a781f24ed3774a
parent8d953c5c5cac93671c779cbf9176c6115e7294fa (diff)
downloadxine-lib-90bb53f8c9b7ca3db6841a5005af791b93782d96.tar.gz
xine-lib-90bb53f8c9b7ca3db6841a5005af791b93782d96.tar.bz2
Add support for "deprecated" attribute.
-rw-r--r--configure.ac1
-rw-r--r--m4/attributes.m423
-rw-r--r--src/xine-utils/attributes.h6
3 files changed, 30 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index 0beac5ca7..bee221542 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2215,6 +2215,7 @@ AC_SUBST([VISIBILITY_FLAG])
CC_ATTRIBUTE_SENTINEL
CC_ATTRIBUTE_FORMAT
CC_ATTRIBUTE_FORMAT_ARG
+CC_ATTRIBUTE_DEPRECATED
AC_OPTIMIZATIONS
diff --git a/m4/attributes.m4 b/m4/attributes.m4
index 55f34c9f7..a74280696 100644
--- a/m4/attributes.m4
+++ b/m4/attributes.m4
@@ -322,3 +322,26 @@ AC_DEFUN([CC_ATTRIBUTE_ALIGNED], [
[Define the highest alignment supported])
fi
])
+
+AC_DEFUN([CC_ATTRIBUTE_DEPRECATED], [
+ AC_REQUIRE([CC_CHECK_WERROR])
+ ac_save_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS $cc_cv_werror"
+ AC_CACHE_CHECK([if compiler supports __attribute__((deprecated))],
+ [cc_cv_attribute_alias],
+ [AC_COMPILE_IFELSE([
+ void some_function(void) __attribute__((deprecated));
+ ],
+ [cc_cv_attribute_deprecated=yes],
+ [cc_cv_attribute_deprecated=no])
+ ])
+ CFLAGS="$ac_save_CFLAGS"
+
+ if test "x$cc_cv_attribute_deprecated" = "xyes"; then
+ AC_DEFINE([SUPPORT_ATTRIBUTE_DEPRECATED], 1, [Define this if the compiler supports the deprecated attribute])
+ $1
+ else
+ true
+ $2
+ fi
+])
diff --git a/src/xine-utils/attributes.h b/src/xine-utils/attributes.h
index 563832e5c..2085be571 100644
--- a/src/xine-utils/attributes.h
+++ b/src/xine-utils/attributes.h
@@ -63,6 +63,12 @@
# define XINE_SENTINEL
#endif
+#ifdef SUPPORT_ATTRIBUTE_DEPRECATED
+# define XINE_DEPRECATED __attribute__((__deprecated__))
+#else
+# define XINE_DEPRECATED
+#endif
+
#ifndef __attr_unused
# ifdef SUPPORT_ATTRIBUTE_UNUSED
# define __attr_unused __attribute__((__unused__))