[vlc-devel] [PATCH 1/2] VLC_FALLTHROUGH macro to avoid unnecessary warnings

chishtiawais511 at gmail.com chishtiawais511 at gmail.com
Thu Mar 21 20:10:36 CET 2019


From: Awais Chishti <chishtiawais511 at gmail.com>

---
 include/vlc_common.h | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/include/vlc_common.h b/include/vlc_common.h
index 033c618677..f3eb10271a 100644
--- a/include/vlc_common.h
+++ b/include/vlc_common.h
@@ -185,6 +185,19 @@
 # define VLC_USED
 #endif
 
+/**
+ * Explicitly indicate fallthrough
+ *
+ * Use this macro as a replacement for //fallthrough comments in switch blocks.
+ * 
+ * This may disable inaccurate compiler warnings of implicit fallthrough.
+ */
+#ifdef __GNUC__
+# define VLC_FALLTHROUGH __attribute__ ((fallthrough));
+#else
+# define VLC_FALLTHROUGH
+#endif
+
 #if defined (__ELF__) || defined (__MACH__)
 # define VLC_WEAK __attribute__((weak))
 #else
-- 
2.21.0



More information about the vlc-devel mailing list