[vlc-devel] [PATCH][RFC] Add a macro to silence unused return value warning

Petri Hintukainen phintuka at gmail.com
Mon Dec 21 21:34:55 CET 2015


Sometimes checking the return value does not make any sense.
For example, when doing best-effort cleanup in error path.
---
 include/vlc_common.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/vlc_common.h b/include/vlc_common.h
index 86c2f27..eb27c92 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -784,6 +784,8 @@ static inline void SetQWLE (void *p, uint64_t qw)
 /* */
 #define VLC_UNUSED(x) (void)(x)
 
+#define VLC_UNUSED_RESULT(f) do { if (f) {}} while (0)
+
 /* Stuff defined in src/extras/libc.c */
 
 #if defined(_WIN32)
-- 
2.5.0



More information about the vlc-devel mailing list