Rework FALL_THROUGH definition to use fallthrough if defined.

This commit is contained in:
Kareem
2021-11-17 17:44:12 -07:00
parent 930e1ac473
commit 0772635972

View File

@ -311,13 +311,13 @@ decouple library dependencies with standard string, memory and so on.
#ifndef FALL_THROUGH
/* GCC 7 has new switch() fall-through detection */
#if defined(__GNUC__)
#if ((__GNUC__ > 7) || ((__GNUC__ == 7) && (__GNUC_MINOR__ >= 1)))
#if defined(WOLFSSL_LINUXKM) && defined(fallthrough)
#if defined(fallthrough)
#define FALL_THROUGH fallthrough
#else
/* Use __ notation to avoid conflicts */
#define FALL_THROUGH ; __attribute__ ((__fallthrough__))
#endif
#elif ((__GNUC__ > 7) || ((__GNUC__ == 7) && (__GNUC_MINOR__ >= 1)))
#define FALL_THROUGH ; __attribute__ ((fallthrough))
#elif defined(__clang__) && defined(__clang_major__) &&
(__clang_major__ >= 4)
#define FALL_THROUGH ; __attribute__ ((fallthrough))
#endif
#endif
#endif /* FALL_THROUGH */