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.
This commit is contained in:
Cedric BAIL 2017-06-05 11:51:59 -07:00
parent 183c45d35a
commit 2995cc16b7
1 changed files with 15 additions and 0 deletions

View File

@ -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))
@ -362,6 +369,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