[libdvdnav-devel] [PATCH] add __DEPRECATED__ modifier which can be used to deprecate API calls where compiler supports it

Andrew Clayton andrew at digital-domain.net
Fri Jan 16 03:41:18 CET 2015


On Fri, 16 Jan 2015 15:22:52 +1300, Lawrence D'Oliveiro wrote:

> On Fri, 16 Jan 2015 00:29:48 +0000, Andrew Clayton wrote:
> 
> > Would it perhaps be better to keep the configure output consistent?
> > e.g
> > 
> > Checking if gcc supports __attribute__((deprecated))... yes
> 
> OK.

FWIW

Reviewed-by: Andrew Clayton <andrew at digital-domain.net>
 
> ---
>  configure.ac           | 7 +++++++
>  src/dvdread/ifo_read.h | 6 ++++++
>  2 files changed, 13 insertions(+)
> 
> diff --git a/configure.ac b/configure.ac
> index 9142673..697b234 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -47,6 +47,13 @@ AC_SUBST([DVDREAD_LTVERSION],
> [$DVDREAD_LT_CURRENT:$DVDREAD_LT_REVISION:$DVDREAD 
>  AC_PROG_CC
>  
> +AS_ECHO_N(["checking whether C compiler supports
> __attribute__((deprecated))... "]) +AC_COMPILE_IFELSE(
> +    [AC_LANG_PROGRAM([__attribute__((deprecated)) extern void
> f(void);], [])],
> +    [AS_ECHO([yes]); AC_DEFINE([HAVE_ATTRIBUTE_DEPRECATED], [1],
> [define to 1 if C compiler allows __attribute__((deprecated))])],
> +    [AS_ECHO([no])]
> +)
> +
>  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


More information about the libdvdnav-devel mailing list