[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
Mon Jan 19 03:25:13 CET 2015

On Mon, 19 Jan 2015 02:02:30 +0000, Timothy Gu wrote:


Thanks for mentioning those, I shall look at them. :)

>> +    #define __DEPRECATED__ __attribute__((deprecated))
>> +#else
>> +    #define __DEPRECATED__
>> +#endif
> This simply won't work...
> 1. ifo_read.h does not include config.h, and thus will not ever get
> the definition of HAVE_ATTRIBUTE_DEPRECATED which is defined in
> config.h.

It does work--I did check that. For example, adding the following quick

diff --git a/src/dvdread/ifo_read.h b/src/dvdread/ifo_read.h
index 8b58b61..1436ec6 100644
--- a/src/dvdread/ifo_read.h
+++ b/src/dvdread/ifo_read.h
@@ -215,7 +215,7 @@ int ifoRead_TXTDT_MGI(ifo_handle_t *);
  * below are safe:  they will not mind if you attempt to free part of
an IFO
  * file which was not read in or which does not exist.
-void ifoFree_PTL_MAIT(ifo_handle_t *);
+__DEPRECATED__ void ifoFree_PTL_MAIT(ifo_handle_t *);
 void ifoFree_VTS_ATRT(ifo_handle_t *);
 void ifoFree_TT_SRPT(ifo_handle_t *);
 void ifoFree_VTS_PTT_SRPT(ifo_handle_t *);

and then building, produces the expected warning:

  CC       src/ifo_read.lo
src/ifo_read.c: In function ‘ifoClose’:
src/ifo_read.c:496:3: warning: ‘ifoFree_PTL_MAIT’ is deprecated
(declared at src/dvdread/ifo_read.h:218) [-Wdeprecated-declarations]

Of course, it could be working “accidentally”... :)

More information about the libdvdnav-devel mailing list