scst: Make scst/include/backport.h again compatible with MOFED

Fix the following build failure on RHEL 7 + MOFED 5.0:

In file included from <command-line>:0:0:
/usr/src/ofa_kernel/default/include/linux/compat-2.6.h:40:29: warning: "__GCC4_has_attribute___fallthrough__" is not defined [-Wundef]
 # define __has_attribute(x) __GCC4_has_attribute_##x
                             ^
/usr/src/packages/BUILD/scst-3.5.0.7946/iscsi-scst/kernel/isert-scst/../../../scst/include/backport.h:250:5: note: in expansion of macro '__has_attribute'
 #if __has_attribute(__fallthrough__)

Reported-by: Chesnokov Gleb <Chesnokov.G@raidix.com>


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@9163 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2020-09-16 02:59:28 +00:00
parent 443c7ec5d9
commit 4933f27d8d

View File

@@ -246,13 +246,14 @@ static inline void cpu_to_be32_array(__be32 *dst, const u32 *src, size_t len)
* pseudo keyword for switch/case use") # v5.4
*/
#ifndef fallthrough
#ifdef __has_attribute
#if __GNUC__ >= 5
#if __has_attribute(__fallthrough__)
#define fallthrough __attribute__((__fallthrough__))
#else
#define fallthrough do {} while (0) /* fallthrough */
#endif
#else
/* gcc 4.x doesn't support __has_attribute() */
#define fallthrough do {} while (0) /* fallthrough */
#endif
#endif