[gnome-builder] macros: add IDE_FALLTHROUGH macro



commit 3426dc472cb0b10228d92a955b6261114656d741
Author: Christian Hergert <chergert redhat com>
Date:   Thu Mar 16 14:06:12 2017 -0700

    macros: add IDE_FALLTHROUGH macro
    
    This should be used where we want to explicitly fallthrough to the next
    case statement in a switch. On GCC 7, we can use
    __attribute__((fallthrough)) to denote we explicitely want to fallthrough.
    
    This is useful to silence -Wimplicit-fallthrough.

 libide/ide-macros.h |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/libide/ide-macros.h b/libide/ide-macros.h
index 65bcd33..e3c6bed 100644
--- a/libide/ide-macros.h
+++ b/libide/ide-macros.h
@@ -50,6 +50,12 @@ G_BEGIN_DECLS
 /* strlen() generally gets hoisted out automatically */
 #define IDE_LITERAL_LENGTH(s) (strlen(s))
 
+#if __GNUC__ >= 7
+# define IDE_FALLTHROUGH __attribute__((fallthrough))
+#else
+# define IDE_FALLTHROUGH
+#endif
+
 static inline gboolean
 ide_str_empty0 (const gchar *str)
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]