Commit 050580d4 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

LIBVLC_USED: tag for function whose result must be used

GCC will print a warning if the result of such function is ignored
This is useful for functions returning an allocated object (which
would leak if ignored), "getter" functions, and functions that are
"likely" to fail.
parent e5fdeda4
......@@ -55,6 +55,15 @@
# include <stdbool.h>
#endif
/* Format string sanity checks */
#ifdef __GNUC__
# define LIBVLC_FORMAT(x,y) __attribute__ ((format(printf,x,y)))
# define LIBVLC_USED __attribute__ ((warn_unused_result))
#else
# define LIBVLC_FORMAT(x,y)
# define LIBVLC_USED
#endif
/*****************************************************************************
* Basic types definitions
*****************************************************************************/
......@@ -740,13 +749,6 @@ static inline uint64_t ntoh64 (uint64_t ll)
}
#define hton64(i) ntoh64(i)
/* Format string sanity checks */
#ifdef __GNUC__
# define LIBVLC_FORMAT(x,y) __attribute__ ((format(printf,x,y)))
#else
# define LIBVLC_FORMAT(x,y)
#endif
/* */
#define VLC_UNUSED(x) (void)(x)
......
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