]> git.ipfire.org Git - thirdparty/ipset.git/commitdiff
netfilter: Use fallthrough pseudo-keyword
authorGustavo A. R. Silva <gustavoars@kernel.org>
Wed, 8 Jul 2020 20:09:39 +0000 (15:09 -0500)
committerJozsef Kadlecsik <kadlec@netfilter.org>
Sun, 20 Sep 2020 10:42:43 +0000 (12:42 +0200)
Replace the existing /* fall through */ comments and its variants with
the new pseudo-keyword macro fallthrough[1]. Also, remove unnecessary
fall-through markings when it is the case.

[1] https://www.kernel.org/doc/html/latest/process/deprecated.html?highlight=fallthrough#implicit-switch-case-fall-through

Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
kernel/include/linux/netfilter/ipset/ip_set_compat.h.in
kernel/net/netfilter/ipset/ip_set_core.c

index deed0580d874102cd6af264639d59b5a86f678a1..87e06414f35cb4e9321f0603049addefb2765db2 100644 (file)
@@ -469,5 +469,17 @@ static inline u16 nfnl_msg_type(u8 subsys, u8 msg_type)
 #define dev_get_by_index_rcu __dev_get_by_index
 #endif
 
+/* Compiler attributes */
+#ifndef __has_attribute
+# define __has_attribute(x) __GCC4_has_attribute_##x
+# define __GCC4_has_attribute___fallthrough__          0
+#endif
+
+#if __has_attribute(__fallthrough__)
+# define fallthrough                   __attribute__((__fallthrough__))
+#else
+# define fallthrough                   do {} while (0)  /* fallthrough */
+#endif
+
 #endif /* IP_SET_COMPAT_HEADERS */
 #endif /* __IP_SET_COMPAT_H */
index 8026537b680f767fb148bdfaa36437e6c43f666b..6fa31079ddd1f2aba55ce289258cc3c8e219544b 100644 (file)
@@ -1666,7 +1666,7 @@ dump_last:
                                goto next_set;
                        if (set->variant->uref)
                                set->variant->uref(set, cb, true);
-                       /* fall through */
+                       fallthrough;
                default:
                        ret = set->variant->list(set, skb, cb);
                        if (!cb->args[IPSET_CB_ARG0])