cedric pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=2995cc16b7bf30b5972bd86bea3c1a0c591b89c0

commit 2995cc16b7bf30b5972bd86bea3c1a0c591b89c0
Author: Cedric BAIL <ced...@osg.samsung.com>
Date:   Mon Jun 5 11:51:59 2017 -0700

    eina: add EINA_FALLTHROUGH to disable warning on useful case serie with no 
break.
    
    GCC has started introducing a detection for series of case in a switch 
statement
    without break for each case. We do use that trick a lot to reduce our code 
base.
    Even if in most case we have documented this so that people using coverity 
don't
    try to fix it. Now with GCC we need to silence it properly to avoid future
    problem.
---
 src/lib/eina/eina_types.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/src/lib/eina/eina_types.h b/src/lib/eina/eina_types.h
index 57e7518151..1fd7a1e26c 100644
--- a/src/lib/eina/eina_types.h
+++ b/src/lib/eina/eina_types.h
@@ -133,6 +133,9 @@
 #ifdef EINA_SENTINEL
 # undef EINA_SENTINEL
 #endif
+#ifdef EINA_FALLTHROUGH
+# undef EINA_FALLTHROUGH
+#endif
 #ifdef EINA_PREFETCH
 # undef EINA_PREFETCH
 #endif
@@ -193,6 +196,7 @@
 #  define EINA_UNLIKELY(exp)    __builtin_expect((exp), 0)
 #  define EINA_LIKELY(exp)      __builtin_expect((exp), 1)
 #  define EINA_SENTINEL __attribute__((__sentinel__))
+#  define EINA_FALLTHROUGH __attribute__ ((fallthrough));
 #  ifndef __clang__
 #   define EINA_PREFETCH(arg) (arg ? __builtin_prefetch(arg) : (void) arg)
 #   define EINA_PREFETCH_WRITE(arg) (arg ? __builtin_prefetch(arg, 1) : (void) 
arg)
@@ -214,6 +218,7 @@
 #  define EINA_UNLIKELY(exp) exp
 #  define EINA_LIKELY(exp)   exp
 #  define EINA_SENTINEL
+#  define EINA_FALLTHROUGH
 #  define EINA_PREFETCH(arg) ((void) (arg))
 #  define EINA_PREFETCH_WRITE(arg) ((void) (arg))
 #  define EINA_PREFETCH_NOCACHE(arg) ((void) (arg))
@@ -239,6 +244,7 @@
 # define EINA_UNLIKELY(exp) exp
 # define EINA_LIKELY(exp)   exp
 # define EINA_SENTINEL
+# define EINA_FALLTHROUGH
 # define EINA_PREFETCH(arg) ((void) (arg))
 # define EINA_PREFETCH_WRITE(arg) ((void) (arg))
 # define EINA_PREFETCH_NOCACHE(arg) ((void) (arg))
@@ -268,6 +274,7 @@
 # define EINA_UNLIKELY(exp) exp
 # define EINA_LIKELY(exp)   exp
 # define EINA_SENTINEL
+# define EINA_FALLTHROUGH
 # define EINA_PREFETCH(arg) ((void) (arg))
 # define EINA_PREFETCH_WRITE(arg) ((void) (arg))
 # define EINA_PREFETCH_NOCACHE(arg) ((void) (arg))
@@ -363,6 +370,14 @@
 # define EINA_SENTINEL
 
 /**
+ * @def EINA_FALLTHROUGH
+ * @brief Attribute from gcc to prevent warning and indicate that we expect
+ * to actually go to the next switch statement
+ * @since 1.20
+ */
+# define EINA_FALLTHROUGH
+
+/**
  * @def EINA_PREFETCH
  * @brief Hints that the pointer @parg needs to be pre-fetched into cache
  * This hints to the compiler to probably issue a prefetch command for the

-- 


Reply via email to