Commit c10f0f7c authored by Andrew Clayton's avatar Andrew Clayton Committed by Jean-Baptiste Kempf Create an UNUSED #define for parameter passing

Some functions in libdvdread take parameters that are unused, e.g
file_read() in dvd_input.c. These functions can't be changed to remove
the unused parameters as they are public API.

GCC provides a __attribute__((unused)) annotation that can be used on
function parameters to inform the compiler of such and will squash
warnings of the following nature

    src/dvd_input.c: In function 'file_read':
    src/dvd_input.c:218:69: warning: unused parameter 'flags'
     static int file_read(dvd_input_t dev, void *buffer, int blocks,
                          int flags)

A check is added to for the use of GCC and if found it
creates an UNUSED #define set to __attribute__((unused)) otherwise it
just sets it empty.

If compilers on other systems have a similar feature this check can be
adjusted to accommodate them.
Signed-off-by: default avatarAndrew Clayton <>
Signed-off-by: Jean-Baptiste Kempf's avatarJean-Baptiste Kempf <>
parent 4d5cb547
......@@ -99,6 +99,12 @@ AS_IF([test "x$DOXYGEN" = "x"], [
AM_CONDITIONAL([APIDOC], [test "x$DOXYGEN" != "x" && test "x$enable_apidoc" = "xyes"])
AS_IF([test "x$ac_cv_c_compiler_gnu" = "xyes"], [
AC_DEFINE([UNUSED], [__attribute__((unused))], [Unused parameter annotation])
], [
AC_DEFINE([UNUSED], [], [Unused parameter annotation])
dnl ---------------------------------------------
dnl Output configuration files
dnl ---------------------------------------------
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment