[libdvdnav-devel] [PATCH] add __DEPRECATED__ modifier which can be used to deprecate API calls where compiler supports it
Lawrence D'Oliveiro
ldo at geek-central.gen.nz
Fri Jan 16 00:49:16 CET 2015
---
configure.ac | 6 ++++++
src/dvdread/ifo_read.h | 6 ++++++
2 files changed, 12 insertions(+)
diff --git a/configure.ac b/configure.ac
index 9142673..6eb4c20 100644
--- a/configure.ac
+++ b/configure.ac
@@ -47,6 +47,12 @@ AC_SUBST([DVDREAD_LTVERSION], [$DVDREAD_LT_CURRENT:$DVDREAD_LT_REVISION:$DVDREAD
AC_PROG_CC
+AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([__attribute__((deprecated)) extern void f(void);], [])],
+ [echo C compiler supports "__attribute__((deprecated))"; AC_DEFINE([HAVE_ATTRIBUTE_DEPRECATED], [1], [define to 1 if C compiler allows nested routines])],
+ [echo WARNING: C compiler does not support "__attribute__((deprecated))"]
+)
+
AC_CHECK_HEADERS_ONCE([sys/param.h limits.h dlfcn.h])
AC_SYS_LARGEFILE
diff --git a/src/dvdread/ifo_read.h b/src/dvdread/ifo_read.h
index 97f4179..8b58b61 100644
--- a/src/dvdread/ifo_read.h
+++ b/src/dvdread/ifo_read.h
@@ -25,6 +25,12 @@
#include "ifo_types.h"
#include "dvdread/dvd_reader.h"
+#if defined(HAVE_ATTRIBUTE_DEPRECATED)
+ #define __DEPRECATED__ __attribute__((deprecated))
+#else
+ #define __DEPRECATED__
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
--
2.1.0
More information about the libdvdnav-devel
mailing list