From 90bb53f8c9b7ca3db6841a5005af791b93782d96 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Sat, 3 May 2008 14:34:45 +0100 Subject: Add support for "deprecated" attribute. --- configure.ac | 1 + m4/attributes.m4 | 23 +++++++++++++++++++++++ src/xine-utils/attributes.h | 6 ++++++ 3 files changed, 30 insertions(+) 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__)) -- cgit v1.2.3