]> git.puffer.fish Git - matthieu/frr.git/commitdiff
build: add -Wimplicit-fallthrough
authorIgor Ryzhov <iryzhov@nfware.com>
Tue, 10 Oct 2023 21:15:32 +0000 (00:15 +0300)
committerIgor Ryzhov <iryzhov@nfware.com>
Thu, 12 Oct 2023 18:23:18 +0000 (21:23 +0300)
Also:
- replace all /* fallthrough */ comments with portable fallthrough;
pseudo keyword to accomodate both gcc and clang
- add missing break; statements as required by older versions of gcc
- cleanup some code to remove unnecessary fallthrough

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
48 files changed:
bgpd/bgp_aspath.c
bgpd/bgp_attr.c
bgpd/bgp_clist.c
bgpd/bgp_fsm.c
bgpd/bgp_open.c
bgpd/bgp_routemap_nb_config.c
bgpd/bgpd.c
bgpd/rfapi/bgp_rfapi_cfg.c
bgpd/rfapi/rfapi_vty.c
configure.ac
ldpd/init.c
ldpd/ldp_vty_exec.c
ldpd/neighbor.c
lib/base64.c
lib/command_match.c
lib/compiler.h
lib/jhash.c
lib/libfrr.c
lib/nexthop.c
lib/nexthop_group.c
lib/printf/printf-pos.c
lib/printf/vfprintf.c
lib/routemap_northbound.c
lib/vty.c
lib/workqueue.c
lib/zclient.c
lib/zlog_5424.c
nhrpd/nhrp_packet.c
nhrpd/nhrp_peer.c
ospf6d/ospf6_message.c
ospf6d/ospf6_route.c
ospf6d/ospf6_route.h
ospf6d/ospf6_snmp.c
ospfd/ospf_flood.c
ospfd/ospf_interface.c
ospfd/ospf_lsa.c
ospfd/ospf_nsm.c
ospfd/ospf_packet.c
pbrd/pbr_nht.c
pimd/pim_nht.c
tests/bgpd/test_capability.c
tools/frr-llvm-cg.c
watchfrr/watchfrr.c
zebra/dplane_fpm_nl.c
zebra/rt_netlink.c
zebra/zebra_mpls.c
zebra/zebra_nhg.c
zebra/zebra_rib.c

index 0e70de9d4669743f377b43467c5afba9ecec09f7..12bd45d9e3595b887911c578b009866bd9d2e253 100644 (file)
@@ -1892,7 +1892,7 @@ struct aspath *aspath_reconcile_as4(struct aspath *aspath,
                                                "[AS4] AS4PATHmangle: AS_CONFED_SEQUENCE falls across 2/4 ASN boundary somewhere, broken..");
                                hops = seg->length;
                        }
-               /* fallthru */
+                       fallthrough;
                case AS_SEQUENCE:
                        cpasns = MIN(seg->length, hops);
                        hops -= seg->length;
index 4014b4b92afc7a1de342bb726dabcb92f6b83de9..6925aff727e23f659fc822b390ca5b1df05359f2 100644 (file)
@@ -2323,11 +2323,8 @@ int bgp_mp_reach_parse(struct bgp_attr_parser_args *args,
                                /*
                                 * NOTE: intentional fall through
                                 * - for consistency in rx processing
-                                *
-                                * The following comment is to signal GCC this intention
-                                * and suppress the warning
                                 */
-       /* FALLTHRU */
+               fallthrough;
        case BGP_ATTR_NHLEN_IPV4:
                stream_get(&attr->mp_nexthop_global_in, s, IPV4_MAX_BYTELEN);
                /* Probably needed for RFC 2283 */
index e52230713420493563e6126e5c3143577df4a5fd..8336d6f3115f7425d5d83deff415113d7d3359a9 100644 (file)
@@ -128,6 +128,7 @@ static void community_entry_free(struct community_entry *entry)
                XFREE(MTYPE_COMMUNITY_LIST_CONFIG, entry->config);
                if (entry->reg)
                        bgp_regex_free(entry->reg);
+               break;
        default:
                break;
        }
index eef3b644080a4315b91db4f512c8d48fc5ac5c89..aa806b8dc147e16476596d2c8070151fe9e2c5d2 100644 (file)
@@ -445,7 +445,7 @@ void bgp_timer_set(struct peer_connection *connection)
 
                EVENT_OFF(peer->connection->t_pmax_restart);
                EVENT_OFF(peer->t_refresh_stalepath);
-       /* fallthru */
+               fallthrough;
        case Clearing:
                EVENT_OFF(connection->t_start);
                EVENT_OFF(connection->t_connect);
@@ -2384,6 +2384,7 @@ void bgp_fsm_nht_update(struct peer_connection *connection, struct peer *peer,
                    && (peer->gtsm_hops == BGP_GTSM_HOPS_CONNECTED
                        || peer->bgp->fast_convergence))
                        BGP_EVENT_ADD(connection, TCP_fatal_error);
+               break;
        case Clearing:
        case Deleted:
        case BGP_STATUS_MAX:
index 28a2448a2067c570fa259c113dd74b606594b32c..866930c732230cb6440dfc4e287fb9cae9833f30 100644 (file)
@@ -1028,6 +1028,7 @@ static int bgp_capability_parse(struct peer *peer, size_t length,
                                                BGP_NOTIFY_OPEN_MALFORMED_ATTR);
                                return -1;
                        }
+                       break;
                /* we deliberately ignore unknown codes, see below */
                default:
                        break;
index 370295b6c31ea3683b25e98d79f07c75bc4a4a0f..6ea8ebe6ab3500ca92befedd62916d6a6554fe50 100644 (file)
@@ -1747,7 +1747,7 @@ int lib_route_map_entry_set_action_rmap_set_action_ipv6_address_modify(
                            || IN6_IS_ADDR_LINKLOCAL(&i6a))
                                return NB_ERR_VALIDATION;
                }
-       /* FALLTHROUGH */
+               return NB_OK;
        case NB_EV_PREPARE:
        case NB_EV_ABORT:
                return NB_OK;
index 2fb4e6bccd8d53525675e37f267c5fc7855782d8..12e462a8ca739e111a20edbd0f2c88aa0216a592 100644 (file)
@@ -186,7 +186,6 @@ int bgp_option_set(int flag)
 int bgp_option_unset(int flag)
 {
        switch (flag) {
-       /* Fall through.  */
        case BGP_OPT_NO_ZEBRA:
        case BGP_OPT_NO_FIB:
                UNSET_FLAG(bm->options, flag);
index 5b6961d18af56640d0115344a600fe80a1d1f42d..676d0771cd66543e9bd8b16ff4260d3b53887076 100644 (file)
@@ -1720,7 +1720,8 @@ DEFUN (vnc_nve_group_export_no_routemap,
        switch (argv[idx]->text[0]) {
        case 'z':
                is_bgp = 0;
-       /* fall thru */
+               idx += 2;
+               break;
        case 'b':
                idx += 2;
                break;
@@ -3590,7 +3591,9 @@ DEFUN (vnc_l2_group_rt,
 
        switch (argv[1]->arg[0]) {
        case 'b':
-               do_export = 1; /* fall through */
+               do_export = 1;
+               do_import = 1;
+               break;
        case 'i':
                do_import = 1;
                break;
index 252b6d632aef4d243847b16fabf148bf1a445c7c..43625b11a6748ac2ee3df8f7ef10345b04a1a2b7 100644 (file)
@@ -4151,6 +4151,7 @@ static int rfapi_vty_show_nve_summary(struct vty *vty,
 
                case SHOW_NVE_SUMMARY_RESPONSES:
                        rfapiRibShowResponsesSummary(vty);
+                       break;
 
                case SHOW_NVE_SUMMARY_UNKNOWN_NVES:
                case SHOW_NVE_SUMMARY_MAX:
index d097a13fda72dff2d577833b7bc8b7690084a2bf..9985cdcbf8a0fa97f5ac091d7bb2432fa7c6a113 100644 (file)
@@ -365,6 +365,7 @@ AC_C_FLAG([-Wpointer-arith])
 AC_C_FLAG([-Wbad-function-cast])
 AC_C_FLAG([-Wwrite-strings])
 AC_C_FLAG([-Wundef])
+AC_C_FLAG([-Wimplicit-fallthrough])
 if test "$enable_gcc_ultra_verbose" = "yes" ; then
   AC_C_FLAG([-Wcast-qual])
   AC_C_FLAG([-Wmissing-noreturn])
index f0cb98e5c03e56500f2bf8319ae4b3b0bffc82b7..c34d18f8b2378dc81605f92d7a101b11500b2cc5 100644 (file)
@@ -229,7 +229,7 @@ send_capability(struct nbr *nbr, uint16_t capability, int enable)
                 * Announcement Parameter in Capability messages sent to
                 * its peers".
                 */
-               /* FALLTHROUGH */
+               fallthrough;
        default:
                fatalx("send_capability: unsupported capability");
        }
@@ -333,7 +333,7 @@ recv_capability(struct nbr *nbr, char *buf, uint16_t len)
                         * parameter and process any other Capability Parameters
                         * in the message".
                         */
-                       /* FALLTHROUGH */
+                       fallthrough;
                default:
                        if (!CHECK_FLAG(ntohs(tlv.type), UNKNOWN_FLAG))
                                send_notification_rtlvs(nbr, S_UNSSUPORTDCAP,
index 906b5c1bf29c8999c5c7385a075a09d64efab83a..f3bcd1b254c86ff8b5c9ee8364fa02983c900c7e 100644 (file)
@@ -1106,7 +1106,7 @@ show_lib_msg(struct vty *vty, struct imsg *imsg, struct show_params *params)
                if (params->lib.remote_label != NO_LABEL &&
                    params->lib.remote_label != rt->remote_label)
                        return (0);
-               /* FALLTHROUGH */
+               fallthrough;
        case IMSG_CTL_SHOW_LIB_RCVD:
                rt = imsg->data;
 
index 5209c55bb8549420ee2fbc57df8066bf4693d589..d40728b0436b116156a7e4c3c3028c89ab1303b5 100644 (file)
@@ -505,21 +505,12 @@ nbr_start_idtimer(struct nbr *nbr)
 {
        int     secs;
 
-       secs = INIT_DELAY_TMR;
-       switch(nbr->idtimer_cnt) {
-       default:
+       if (nbr->idtimer_cnt > 2) {
                /* do not further increase the counter */
                secs = MAX_DELAY_TMR;
-               break;
-       case 2:
-               secs *= 2;
-               /* FALLTHROUGH */
-       case 1:
-               secs *= 2;
-               /* FALLTHROUGH */
-       case 0:
+       } else {
+               secs = INIT_DELAY_TMR * (1 << nbr->idtimer_cnt);
                nbr->idtimer_cnt++;
-               break;
        }
 
        EVENT_OFF(nbr->initdelay_timer);
index 1507b0252b4e7761de87f140b5dd078a0ec1db73..ee2e838c01d12d89e561b390267733924074dc8e 100644 (file)
@@ -9,6 +9,7 @@
 #endif
 
 #include "base64.h"
+#include "compiler.h"
 
 static const int CHARS_PER_LINE = 72;
 static const char *ENCODING =
@@ -41,6 +42,7 @@ int base64_encode_block(const char *plaintext_in, int length_in, char *code_out,
 
        switch (state_in->step) {
                while (1) {
+                       fallthrough;
                        case step_A:
                                if (plainchar == plaintextend) {
                                        state_in->result = result;
@@ -51,7 +53,7 @@ int base64_encode_block(const char *plaintext_in, int length_in, char *code_out,
                                result = (fragment & 0x0fc) >> 2;
                                *codechar++ = base64_encode_value(result);
                                result = (fragment & 0x003) << 4;
-                               /* fall through */
+                               fallthrough;
                        case step_B:
                                if (plainchar == plaintextend) {
                                        state_in->result = result;
@@ -62,7 +64,7 @@ int base64_encode_block(const char *plaintext_in, int length_in, char *code_out,
                                result |= (fragment & 0x0f0) >> 4;
                                *codechar++ = base64_encode_value(result);
                                result = (fragment & 0x00f) << 2;
-                               /* fall through */
+                               fallthrough;
                        case step_C:
                                if (plainchar == plaintextend) {
                                        state_in->result = result;
@@ -146,6 +148,7 @@ int base64_decode_block(const char *code_in, int length_in, char *plaintext_out,
 
        switch (state_in->step) {
                while (1) {
+                       fallthrough;
                        case step_a:
                                do {
                                        if (codec == code_in+length_in) {
@@ -156,7 +159,7 @@ int base64_decode_block(const char *code_in, int length_in, char *plaintext_out,
                                        fragmt = base64_decode_value(*codec++);
                                } while (fragmt < 0);
                                *plainc = (fragmt & 0x03f) << 2;
-                               /* fall through */
+                               fallthrough;
                        case step_b:
                                do {
                                        if (codec == code_in+length_in) {
@@ -168,7 +171,7 @@ int base64_decode_block(const char *code_in, int length_in, char *plaintext_out,
                                } while (fragmt < 0);
                                *plainc++ |= (fragmt & 0x030) >> 4;
                                *plainc = (fragmt & 0x00f) << 4;
-                               /* fall through */
+                               fallthrough;
                        case step_c:
                                do {
                                        if (codec == code_in+length_in) {
@@ -180,7 +183,7 @@ int base64_decode_block(const char *code_in, int length_in, char *plaintext_out,
                                } while (fragmt < 0);
                                *plainc++ |= (fragmt & 0x03c) >> 2;
                                *plainc = (fragmt & 0x003) << 6;
-                               /* fall through */
+                               fallthrough;
                        case step_d:
                                do {
                                        if (codec == code_in+length_in) {
index f740b726008cf7ab5a757e460f11aa00c43a31ab..97e6aeb4698a5b99ccb7ba59bb44d59e6a83b55e 100644 (file)
@@ -405,10 +405,10 @@ enum matcher_rv command_complete(struct graph *graph, vector vline,
                                listnode_add(next, newstack);
                                break;
                        case partly_match:
-                               trace_matcher("trivial_match\n");
+                               trace_matcher("partly_match\n");
                                if (exact_match_exists && !last_token)
                                        break;
-                       /* fallthru */
+                               fallthrough;
                        case exact_match:
                                trace_matcher("exact_match\n");
                                if (last_token) {
index ce6727685f1318fca1dfcf2e53266d91dbe0bf92..0a54c02d20522b786c7889adf5ac37b689c76a74 100644 (file)
@@ -33,7 +33,7 @@ extern "C" {
 #  define _RET_NONNULL    , returns_nonnull
 #endif
 #if __has_attribute(fallthrough)
-#  define _FALLTHROUGH __attribute__((fallthrough));
+#  define fallthrough __attribute__((fallthrough));
 #endif
 # define _CONSTRUCTOR(x)  constructor(x)
 # define _DEPRECATED(x) deprecated(x)
@@ -57,7 +57,7 @@ extern "C" {
 #  define __has_attribute(x) 0
 #endif
 #if __GNUC__ >= 7
-#  define _FALLTHROUGH __attribute__((fallthrough));
+#  define fallthrough __attribute__((fallthrough));
 #endif
 #endif
 
@@ -112,8 +112,8 @@ extern "C" {
 #ifndef _ALLOC_SIZE
 # define _ALLOC_SIZE(x)
 #endif
-#ifndef _FALLTHROUGH
-#define _FALLTHROUGH
+#ifndef fallthrough
+#define fallthrough
 #endif
 #ifndef _DEPRECATED
 #define _DEPRECATED(x) deprecated
index 0d561ef3a4f25db2b60725e9fdb63a0ff2b6af45..4e02112e098fefe4b82d04662300c8f5d0adf1c1 100644 (file)
@@ -86,34 +86,34 @@ uint32_t jhash(const void *key, uint32_t length, uint32_t initval)
        switch (len) {
        case 11:
                c += ((uint32_t)k[10] << 24);
-       /* fallthru */
+               fallthrough;
        case 10:
                c += ((uint32_t)k[9] << 16);
-       /* fallthru */
+               fallthrough;
        case 9:
                c += ((uint32_t)k[8] << 8);
-       /* fallthru */
+               fallthrough;
        case 8:
                b += ((uint32_t)k[7] << 24);
-       /* fallthru */
+               fallthrough;
        case 7:
                b += ((uint32_t)k[6] << 16);
-       /* fallthru */
+               fallthrough;
        case 6:
                b += ((uint32_t)k[5] << 8);
-       /* fallthru */
+               fallthrough;
        case 5:
                b += k[4];
-       /* fallthru */
+               fallthrough;
        case 4:
                a += ((uint32_t)k[3] << 24);
-       /* fallthru */
+               fallthrough;
        case 3:
                a += ((uint32_t)k[2] << 16);
-       /* fallthru */
+               fallthrough;
        case 2:
                a += ((uint32_t)k[1] << 8);
-       /* fallthru */
+               fallthrough;
        case 1:
                a += k[0];
        }
@@ -148,7 +148,7 @@ uint32_t jhash2(const uint32_t *k, uint32_t length, uint32_t initval)
        switch (len) {
        case 2:
                b += k[1];
-       /* fallthru */
+               fallthrough;
        case 1:
                a += k[0];
        }
index 33237df5fca3a28b3f3bc6ba138d4f7c254407a7..e80355f3b8cfe67873ac5e97bac6af3454bed964 100644 (file)
@@ -218,7 +218,8 @@ bool frr_zclient_addr(struct sockaddr_storage *sa, socklen_t *sa_len,
                        break;
                case '6':
                        path++;
-               /* fallthrough */
+                       af = AF_INET6;
+                       break;
                default:
                        af = AF_INET6;
                        break;
index 8df57e36a2011399cb73ebe8a6bc932d87dfe9a9..4ddb53cd969052097c2e842fdf6a430f4c375499 100644 (file)
@@ -173,7 +173,7 @@ static int _nexthop_cmp_no_labels(const struct nexthop *next1,
                ret = _nexthop_gateway_cmp(next1, next2);
                if (ret != 0)
                        return ret;
-               /* Intentional Fall-Through */
+               fallthrough;
        case NEXTHOP_TYPE_IFINDEX:
                if (next1->ifindex < next2->ifindex)
                        return -1;
@@ -295,7 +295,7 @@ int nexthop_cmp_basic(const struct nexthop *nh1,
                ret = nexthop_g_addr_cmp(nh1->type, &nh1->gate, &nh2->gate);
                if (ret != 0)
                        return ret;
-               /* Intentional Fall-Through */
+               fallthrough;
        case NEXTHOP_TYPE_IFINDEX:
                if (nh1->ifindex < nh2->ifindex)
                        return -1;
index 25370eba4828d74f010a732b4dd3ec46e7935097..c75ff7b4cde691d1ddce98c8f3c0329effc40c34 100644 (file)
@@ -180,7 +180,7 @@ static struct nexthop *nhg_nh_find(const struct nexthop_group *nhg,
                                                 &nexthop->gate, &nh->gate);
                        if (ret != 0)
                                continue;
-                       /* Intentional Fall-Through */
+                       fallthrough;
                case NEXTHOP_TYPE_IFINDEX:
                        if (nexthop->ifindex != nh->ifindex)
                                continue;
index ac775bea4e2be5c12e4796c5db48dc7eaa2514a7..b2ba1a714d69b9de78e57d3346d3f8bea44490b1 100644 (file)
@@ -355,7 +355,7 @@ reswitch:   switch (ch) {
                        goto rflag;
                case 'C':
                        flags |= LONGINT;
-                       /*FALLTHROUGH*/
+                       fallthrough;
                case 'c':
                        error = addtype(&types,
                                        (flags & LONGINT) ? T_WINT : T_INT);
@@ -364,7 +364,7 @@ reswitch:   switch (ch) {
                        break;
                case 'D':
                        flags |= LONGINT;
-                       /*FALLTHROUGH*/
+                       fallthrough;
                case 'd':
                case 'i':
                        if ((error = addsarg(&types, flags)))
@@ -408,7 +408,7 @@ reswitch:   switch (ch) {
 #endif
                case 'O':
                        flags |= LONGINT;
-                       /*FALLTHROUGH*/
+                       fallthrough;
                case 'o':
                        if ((error = adduarg(&types, flags)))
                                goto error;
@@ -419,7 +419,7 @@ reswitch:   switch (ch) {
                        break;
                case 'S':
                        flags |= LONGINT;
-                       /*FALLTHROUGH*/
+                       fallthrough;
                case 's':
                        error = addtype(&types,
                                        (flags & LONGINT) ? TP_WCHAR : TP_CHAR);
@@ -428,7 +428,7 @@ reswitch:   switch (ch) {
                        break;
                case 'U':
                        flags |= LONGINT;
-                       /*FALLTHROUGH*/
+                       fallthrough;
                case 'u':
                case 'X':
                case 'x':
@@ -549,7 +549,7 @@ reswitch:   switch (ch) {
                        goto rflag;
                case 'C':
                        flags |= LONGINT;
-                       /*FALLTHROUGH*/
+                       fallthrough;
                case 'c':
                        error = addtype(&types,
                                        (flags & LONGINT) ? T_WINT : T_INT);
@@ -558,7 +558,7 @@ reswitch:   switch (ch) {
                        break;
                case 'D':
                        flags |= LONGINT;
-                       /*FALLTHROUGH*/
+                       fallthrough;
                case 'd':
                case 'i':
                        if ((error = addsarg(&types, flags)))
@@ -602,7 +602,7 @@ reswitch:   switch (ch) {
 #endif
                case 'O':
                        flags |= LONGINT;
-                       /*FALLTHROUGH*/
+                       fallthrough;
                case 'o':
                        if ((error = adduarg(&types, flags)))
                                goto error;
@@ -613,7 +613,7 @@ reswitch:   switch (ch) {
                        break;
                case 'S':
                        flags |= LONGINT;
-                       /*FALLTHROUGH*/
+                       fallthrough;
                case 's':
                        error = addtype(&types,
                            (flags & LONGINT) ? TP_WCHAR : TP_CHAR);
@@ -622,7 +622,7 @@ reswitch:   switch (ch) {
                        break;
                case 'U':
                        flags |= LONGINT;
-                       /*FALLTHROUGH*/
+                       fallthrough;
                case 'u':
                case 'X':
                case 'x':
index 78f8be05cbf9c13b1be165226356cbbc9dd4ecad..2083642d5eb6f567baf1af618227cefa17824318 100644 (file)
@@ -340,7 +340,7 @@ reswitch:   switch (ch) {
                        if (width >= 0)
                                goto rflag;
                        width = -width;
-                       /* FALLTHROUGH */
+                       fallthrough;
                case '-':
                        flags |= LADJUST;
                        goto rflag;
@@ -434,7 +434,7 @@ reswitch:   switch (ch) {
                        break;
                case 'C':
                        flags |= LONGINT;
-                       /*FALLTHROUGH*/
+                       fallthrough;
                case 'c':
 #ifdef WCHAR_SUPPORT
                        if (flags & LONGINT) {
@@ -460,7 +460,7 @@ reswitch:   switch (ch) {
                        break;
                case 'D':
                        flags |= LONGINT;
-                       /*FALLTHROUGH*/
+                       fallthrough;
                case 'd':
                case 'i':
                        if (flags & INTMAX_SIZE)
@@ -551,7 +551,7 @@ reswitch:   switch (ch) {
                        break;
                case 'O':
                        flags |= LONGINT;
-                       /*FALLTHROUGH*/
+                       fallthrough;
                case 'o':
                        if (flags & INTMAX_SIZE)
                                ujval = UJARG();
@@ -595,7 +595,7 @@ reswitch:   switch (ch) {
                        goto nosign;
                case 'S':
                        flags |= LONGINT;
-                       /*FALLTHROUGH*/
+                       fallthrough;
                case 's':
 #ifdef WCHAR_SUPPORT
                        if (flags & LONGINT) {
@@ -621,7 +621,7 @@ reswitch:   switch (ch) {
                        break;
                case 'U':
                        flags |= LONGINT;
-                       /*FALLTHROUGH*/
+                       fallthrough;
                case 'u':
                        if (flags & INTMAX_SIZE)
                                ujval = UJARG();
index 5767e0aacf75f0b0890c3e8decae6a4399a8617f..9e25d2beb2ca6cb605c30a4b547417ab56405997 100644 (file)
@@ -364,7 +364,6 @@ lib_route_map_entry_exit_policy_modify(struct nb_cb_modify_args *args)
                case 0: /* permit-or-deny */
                        break;
                case 1: /* next */
-                       /* FALLTHROUGH */
                case 2: /* goto */
                        rm_action =
                                yang_dnode_get_enum(args->dnode, "../action");
@@ -885,7 +884,7 @@ static int lib_route_map_entry_set_action_ipv4_address_modify(
                yang_dnode_get_ipv4(&ia, args->dnode, NULL);
                if (ia.s_addr == INADDR_ANY || !ipv4_unicast_valid(&ia))
                        return NB_ERR_VALIDATION;
-               /* FALLTHROUGH */
+               return NB_OK;
        case NB_EV_PREPARE:
        case NB_EV_ABORT:
                return NB_OK;
@@ -944,7 +943,7 @@ static int lib_route_map_entry_set_action_ipv6_address_modify(
                yang_dnode_get_ipv6(&i6a, args->dnode, NULL);
                if (!IN6_IS_ADDR_LINKLOCAL(&i6a))
                        return NB_ERR_VALIDATION;
-               /* FALLTHROUGH */
+               return NB_OK;
        case NB_EV_PREPARE:
        case NB_EV_ABORT:
                return NB_OK;
index ed8b71ed22d548d04ab5ba53cf4fef3504172789..ffb7274b901cb9de074857ba4be7fa61b4aa83f0 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -1565,7 +1565,7 @@ static void vty_read(struct event *thread)
                        break;
                case '\r':
                        vty->escape = VTY_CR;
-                       /* fallthru */
+                       fallthrough;
                case '\n':
                        vty_out(vty, "\n");
                        buffer_flush_available(vty->obuf, vty->wfd);
index fa5d585360cc3ceb87baeafb046d23563fd959c5..2281c4c369c039dd0504bb846d9babf489681ac1 100644 (file)
@@ -271,9 +271,10 @@ void work_queue_run(struct event *thread)
                switch (ret) {
                case WQ_QUEUE_BLOCKED: {
                        /* decrement item->ran again, cause this isn't an item
-                        * specific error, and fall through to WQ_RETRY_LATER
+                        * specific error, and retry later
                         */
                        item->ran--;
+                       goto stats;
                }
                case WQ_RETRY_LATER: {
                        goto stats;
@@ -296,9 +297,10 @@ void work_queue_run(struct event *thread)
                        break;
                }
                case WQ_RETRY_NOW:
-               /* a RETRY_NOW that gets here has exceeded max_tries, same as
-                * ERROR */
-               /* fallthru */
+                       /* a RETRY_NOW that gets here has exceeded max_tries, same
+                        * as ERROR
+                        */
+                       fallthrough;
                case WQ_SUCCESS:
                default: {
                        work_queue_item_remove(wq, item);
index f8f9cf7aba05ea25d9c3a83af2e797ccf85737bc..47d6c5fbaf8d861a8796c8d2a1643d5ee4a63cdb 100644 (file)
@@ -891,7 +891,7 @@ static int zapi_nexthop_cmp_no_labels(const struct zapi_nexthop *next1,
                                         &next2->gate);
                if (ret != 0)
                        return ret;
-               /* Intentional Fall-Through */
+               fallthrough;
        case NEXTHOP_TYPE_IFINDEX:
                if (next1->ifindex < next2->ifindex)
                        return -1;
index 9bc1c819a8575249a69f35fec836948f119e45fd..3049e4a849e84c4b4bd42f0cc6edf01c0151bbe6 100644 (file)
@@ -913,7 +913,7 @@ static int zlog_5424_open(struct zlog_cfg_5424 *zcf, int sock_type)
                }
 
                flags = O_NONBLOCK;
-               /* fallthru */
+               fallthrough;
 
        case ZLOG_5424_DST_FILE:
                if (!zcf->filename)
index 9d0b30cfeea2363068b1e745ff26dcca3ddf342f..c6bd3bbbde0d2888bcc83611b4b2762f9fd0364d 100644 (file)
@@ -270,7 +270,7 @@ int nhrp_ext_reply(struct zbuf *zb, struct nhrp_packet_header *hdr,
        default:
                if (type & NHRP_EXTENSION_FLAG_COMPULSORY)
                        goto err;
-       /* fallthru */
+               fallthrough;
        case NHRP_EXTENSION_FORWARD_TRANSIT_NHS:
        case NHRP_EXTENSION_REVERSE_TRANSIT_NHS:
                /* Supported compulsory extensions, and any
index ffb6cf7506436839025b2ff9e60c729c0170fcc6..9926dcaf53a0f5d7da90c813f3abf53fb5df4c03 100644 (file)
@@ -139,7 +139,7 @@ static void nhrp_peer_ifp_notify(struct notifier_block *n, unsigned long cmd)
                                           nhrp_peer_vc_notify);
                        __nhrp_peer_check(p);
                }
-               /* fallthru */ /* to post config update */
+               fallthrough; /* to post config update */
        case NOTIFY_INTERFACE_ADDRESS_CHANGED:
                notifier_call(&p->notifier_list, NOTIFY_PEER_IFCONFIG_CHANGED);
                break;
@@ -1050,7 +1050,7 @@ static void nhrp_peer_forward(struct nhrp_peer *p,
                                 * append our selves to the transit NHS list
                                 */
                                goto err;
-               /* fallthru */
+                       fallthrough;
                case NHRP_EXTENSION_RESPONDER_ADDRESS:
                        /* Supported compulsory extensions, and any
                         * non-compulsory that is not explicitly handled,
@@ -1220,7 +1220,7 @@ void nhrp_peer_recv(struct nhrp_peer *p, struct zbuf *zb)
                                /* FIXME: send error-indication */
                        }
                }
-               /* fallthru */ /* FIXME: double check, is this correct? */
+               fallthrough; /* FIXME: double check, is this correct? */
        case NHRP_ROUTE_OFF_NBMA:
                if (packet_types[hdr->type].handler) {
                        packet_types[hdr->type].handler(&pp);
index 07da9a5ec1248475ddb9bd87c14566ad4ac8f8b8..7fbe08d30f15bdf172d4169e84ecf3b1e2ecd4e9 100644 (file)
@@ -631,8 +631,8 @@ static void ospf6_dbdesc_recv_master(struct ospf6_header *oh,
                                        "Neighbor state is not ExStart, ignore");
                        return;
                }
-       /* else fall through to ExStart */
-       /* fallthru */
+               /* else fall through to ExStart */
+               fallthrough;
        case OSPF6_NEIGHBOR_EXSTART:
                /* if neighbor obeys us as our slave, schedule negotiation_done
                   and process LSA Headers. Otherwise, ignore this message */
@@ -650,8 +650,8 @@ static void ospf6_dbdesc_recv_master(struct ospf6_header *oh,
                                  on->ospf6_if->interface->vrf->name, on->name);
                        return;
                }
-       /* fall through to exchange */
-
+               /* fall through to exchange */
+               fallthrough;
        case OSPF6_NEIGHBOR_EXCHANGE:
                if (!memcmp(dbdesc, &on->dbdesc_last,
                            sizeof(struct ospf6_dbdesc))) {
@@ -835,8 +835,8 @@ static void ospf6_dbdesc_recv_slave(struct ospf6_header *oh,
                                        "Neighbor state is not ExStart, ignore");
                        return;
                }
-       /* else fall through to ExStart */
-       /* fallthru */
+               /* else fall through to ExStart */
+               fallthrough;
        case OSPF6_NEIGHBOR_EXSTART:
                /* If the neighbor is Master, act as Slave. Schedule
                   negotiation_done
index 443032933d0f378d9cc047714976b4e6e8a99d16..ca026dc97f52099ddfb9578dd62978cfd131fd6a 100644 (file)
@@ -363,7 +363,7 @@ void ospf6_route_zebra_copy_nexthops(struct ospf6_route *route,
 
                        case NEXTHOP_TYPE_IPV6_IFINDEX:
                                nexthops[i].ifindex = nh->ifindex;
-                               /* FALLTHROUGH */
+                               fallthrough;
                        case NEXTHOP_TYPE_IPV6:
                                nexthops[i].gate.ipv6 = nh->address;
                                break;
index c2125951ec52a3ab87e0a1816f2dea32e58207e2..2c1d17efc3f799de4de0fecc01c7daad11c669ca 100644 (file)
@@ -67,7 +67,7 @@ static inline bool ospf6_nexthop_is_same(const struct ospf6_nexthop *nha,
        case NEXTHOP_TYPE_IPV6_IFINDEX:
                if (nha->ifindex != nhb->ifindex)
                        return false;
-               /* FALLTHROUGH */
+               fallthrough;
        case NEXTHOP_TYPE_IPV6:
                if (!IN6_ARE_ADDR_EQUAL(&nha->address, &nhb->address))
                        return false;
index f88667bfd07708e5c129373c8c2ee82c60aaec25..671291312a09397c95778b5f01e77c0b57a26892 100644 (file)
@@ -697,8 +697,8 @@ static uint8_t *ospfv3GeneralGroup(struct variable *v, oid *name,
        case OSPFv3REFERENCEBANDWIDTH:
                if (ospf6)
                        return SNMP_INTEGER(ospf6->ref_bandwidth);
-       /* Otherwise, like for "not implemented". */
-       /* fallthru */
+               /* Otherwise, like for "not implemented". */
+               return NULL;
        case OSPFv3RESTARTSUPPORT:
        case OSPFv3RESTARTINTERVAL:
        case OSPFv3RESTARTSTRICTLSACHECKING:
index dd8c9268f108acab654f24065401972c9d57eb6f..95a593ad4dc66cd298706ecf4a18e4fcd808ee33 100644 (file)
@@ -954,7 +954,7 @@ int ospf_flood_through(struct ospf *ospf, struct ospf_neighbor *inbr,
 
                if (IS_DEBUG_OSPF_NSSA)
                        zlog_debug("%s: LOCAL NSSA FLOOD of Type-7.", __func__);
-       /* Fallthrough */
+               fallthrough;
        default:
                lsa_ack_flag = ospf_flood_through_area(lsa->area, inbr, lsa);
                break;
index 7601419325d5da1c1b27bac75937e8978e7e3527..938d373d8b1fb4365bc80a4ac93fba73a942b12e 100644 (file)
@@ -1167,7 +1167,7 @@ static int ospf_vl_set_params(struct ospf_area *area,
                                if (IS_DEBUG_OSPF_EVENT)
                                        zlog_debug(
                                                "found back link through VL");
-                       /* fallthru */
+                               fallthrough;
                        case LSA_LINK_TYPE_TRANSIT:
                        case LSA_LINK_TYPE_POINTOPOINT:
                                if (!IPV4_ADDR_SAME(&vl_data->peer_addr,
index e47f832728926a8672b71a571c9f3ebec1835a8a..f125fa93b1e4011b415a89a09997717d0dffa511 100644 (file)
@@ -3096,13 +3096,14 @@ struct ospf_lsa *ospf_lsa_install(struct ospf *ospf, struct ospf_interface *oi,
                        /* Incoming "oi" for this LSA has set at LSUpd
                         * reception. */
                }
-       /* Fallthrough */
+               fallthrough;
        case OSPF_OPAQUE_AREA_LSA:
        case OSPF_OPAQUE_AS_LSA:
                new = ospf_opaque_lsa_install(lsa, rt_recalc);
                break;
        case OSPF_AS_NSSA_LSA:
                new = ospf_external_lsa_install(ospf, lsa, rt_recalc);
+               break;
        default: /* type-6,8,9....nothing special */
                break;
        }
index bcbe02879575e67071f9c276e96875f7e60bea9a..7c3f289e026f01b4d212f53d623cfb4a8df1766e 100644 (file)
@@ -107,7 +107,7 @@ static void nsm_timer_set(struct ospf_neighbor *nbr)
        case NSM_Down:
                EVENT_OFF(nbr->t_inactivity);
                EVENT_OFF(nbr->t_hello_reply);
-       /* fallthru */
+               fallthrough;
        case NSM_Attempt:
        case NSM_Init:
        case NSM_TwoWay:
index b37efa3efa21fc72d461a609fa2f86139f945958..4bf4ae95978fe82889267badb3048f91ea2cf946 100644 (file)
@@ -1042,7 +1042,7 @@ static void ospf_db_desc_proc(struct stream *s, struct ospf_interface *oi,
                        /* Neighbour has a more recent LSA, we must request it
                         */
                        ospf_ls_request_add(nbr, new);
-               /* fallthru */
+                       fallthrough;
                case 0:
                        /* If we have a copy of this LSA, it's either less
                         * recent
@@ -1231,7 +1231,7 @@ static void ospf_db_desc(struct ip *iph, struct ospf_header *ospfh,
                   through to case ExStart below.  */
                if (nbr->state != NSM_ExStart)
                        break;
-       /* fallthru */
+               fallthrough;
        case NSM_ExStart:
                /* Initial DBD */
                if ((IS_SET_DD_ALL(dd->flags) == OSPF_DD_FLAG_ALL)
@@ -1641,7 +1641,7 @@ static struct list *ospf_ls_upd_list_lsa(struct ospf_neighbor *nbr,
                case OSPF_OPAQUE_LINK_LSA:
                        lsa->oi = oi; /* Remember incoming interface for
                                         flooding control. */
-               /* Fallthrough */
+                       fallthrough;
                default:
                        lsa->area = oi->area;
                        break;
index 4f7882fb22135aad1400d3ce447b063dcdef92f3..b9d1ca9bb7abe9a7f7b288d82bef4bc7c7bb1f01 100644 (file)
@@ -534,6 +534,7 @@ void pbr_nht_set_seq_nhg_data(struct pbr_map_sequence *pbrms,
        case NEXTHOP_TYPE_IPV4:
        case NEXTHOP_TYPE_IPV4_IFINDEX:
                pbrms->family = AF_INET;
+               break;
        case NEXTHOP_TYPE_IFINDEX:
        case NEXTHOP_TYPE_BLACKHOLE:
                break;
@@ -889,7 +890,7 @@ static void pbr_nht_individual_nexthop_update(struct pbr_nexthop_cache *pnhc,
                        pbr_nht_individual_nexthop_interface_update(pnhc, pnhi);
                        break;
                }
-               /* Intentional fall thru */
+               fallthrough;
        case NEXTHOP_TYPE_IPV4_IFINDEX:
        case NEXTHOP_TYPE_IPV4:
        case NEXTHOP_TYPE_IPV6:
index 4e8e5f0df7353b2205b7abf268e75b323d0f19c5..af36caec650b1c6c791315968976d49dc46562ee 100644 (file)
@@ -338,7 +338,7 @@ bool pim_nht_bsr_rpf_check(struct pim_instance *pim, pim_addr bsr_addr,
                        if (nh->ifindex == IFINDEX_INTERNAL)
                                continue;
 
-                       /* fallthru */
+                       fallthrough;
                case NEXTHOP_TYPE_IPV4_IFINDEX:
                        nhaddr = nh->gate.ipv4;
                        break;
@@ -350,7 +350,7 @@ bool pim_nht_bsr_rpf_check(struct pim_instance *pim, pim_addr bsr_addr,
                        if (nh->ifindex == IFINDEX_INTERNAL)
                                continue;
 
-                       /* fallthru */
+                       fallthrough;
                case NEXTHOP_TYPE_IPV6_IFINDEX:
                        nhaddr = nh->gate.ipv6;
                        break;
index 9d3d0ecbc1280eb91b7ce3475f9d8727e5885554..38f896b30ca8a12dee9fe8c17f96e52cb28d751c 100644 (file)
@@ -835,7 +835,7 @@ static void parse_test(struct peer *peer, struct test_segment *t, int type)
        switch (type) {
        case CAPABILITY:
                len += 2; /* to cover the OPT-Param header */
-               _FALLTHROUGH
+               fallthrough;
        case OPT_PARAM:
                printf("len: %u\n", len);
                /* peek_for_as4 wants getp at capibility*/
index 3a7222e421fc772edf03c86dff8f977353d13332..f366ba62f9d23346a677365c25270d6a0d97a057 100644 (file)
@@ -231,7 +231,7 @@ static void walk_const_fptrs(struct json_object *js_call, LLVMValueRef value,
                                "%s: calls function pointer from unhandled const GEP\n",
                                prefix);
                        *hdr_written = true;
-                       /* fallthru */
+                       fallthrough;
                default:
                        /* to help the user / development */
                        if (!*hdr_written) {
index 89199da1af79a94ce77e60372f2b0475a0161f95..34acf683eff1aa0fba684292b020fd38ac4b6ba7 100644 (file)
@@ -908,7 +908,7 @@ static void phase_check(void)
                        "Phased restart: all routing daemon stop jobs have completed.");
                set_phase(PHASE_WAITING_DOWN);
 
-       /*FALLTHRU*/
+               fallthrough;
        case PHASE_WAITING_DOWN:
                if (gs.numdown + IS_UP(gs.special) < gs.numdaemons)
                        break;
@@ -918,7 +918,7 @@ static void phase_check(void)
                        1);
                set_phase(PHASE_ZEBRA_RESTART_PENDING);
 
-       /*FALLTHRU*/
+               fallthrough;
        case PHASE_ZEBRA_RESTART_PENDING:
                if (gs.special->restart.pid)
                        break;
@@ -927,7 +927,7 @@ static void phase_check(void)
                          gs.special->name);
                set_phase(PHASE_WAITING_ZEBRA_UP);
 
-       /*FALLTHRU*/
+               fallthrough;
        case PHASE_WAITING_ZEBRA_UP:
                if (!IS_UP(gs.special))
                        break;
index 2a8792523188d731d291b64785c1d042a95f3238..70bcfe4498f39018201d0452a77aebc577490c23 100644 (file)
@@ -859,7 +859,7 @@ static int fpm_nl_enqueue(struct fpm_nl_ctx *fnc, struct zebra_dplane_ctx *ctx)
                if (op == DPLANE_OP_ROUTE_DELETE)
                        break;
 
-               /* FALL THROUGH */
+               fallthrough;
        case DPLANE_OP_ROUTE_INSTALL:
                rv = netlink_route_multipath_msg_encode(RTM_NEWROUTE, ctx,
                                                        &nl_buf[nl_buf_len],
index bfe1910a58052c29ece2b4ec5ad2db03628097b6..a5dec0458c8065b23aa88e6f05982019b0fdcea8 100644 (file)
@@ -366,7 +366,8 @@ static inline int proto2zebra(int proto, int family, bool is_nexthop)
                        proto = ZEBRA_ROUTE_NHG;
                        break;
                }
-               /* Intentional fall thru */
+               proto = ZEBRA_ROUTE_KERNEL;
+               break;
        default:
                /*
                 * When a user adds a new protocol this will show up
index eac4fcc8e0605d4eb4f8fa4d42f6ffc8d261a5c0..c2e34faed61f1842b39e124185adb841075c6ed5 100644 (file)
@@ -1182,6 +1182,7 @@ static char *nhlfe2str(const struct zebra_nhlfe *nhlfe, char *buf, int size)
                break;
        case NEXTHOP_TYPE_IFINDEX:
                snprintf(buf, size, "Ifindex: %u", nexthop->ifindex);
+               break;
        case NEXTHOP_TYPE_BLACKHOLE:
                break;
        }
index 1879bafcac4dd7428c01d14a0053975af897506e..6517b7830bb08a7d499164b632c520c900b9deaf 100644 (file)
@@ -1310,6 +1310,7 @@ int nhg_ctx_process(struct nhg_ctx *ctx)
                break;
        case NHG_CTX_OP_DEL:
                ret = nhg_ctx_process_del(ctx);
+               break;
        case NHG_CTX_OP_NONE:
                break;
        }
index c05d69a2dd390d3ed108946c6831a12d69168a9e..79f6ad484cfdde8e30b1cb639e3cdc332306cfac 100644 (file)
@@ -4082,7 +4082,6 @@ static void _route_entry_dump_nh(const struct route_entry *re,
                         ifp ? ifp->name : "Unknown");
                break;
        case NEXTHOP_TYPE_IPV4:
-               /* fallthrough */
        case NEXTHOP_TYPE_IPV4_IFINDEX:
                inet_ntop(AF_INET, &nexthop->gate, nhname, INET6_ADDRSTRLEN);
                break;
@@ -5043,7 +5042,7 @@ struct route_table *rib_tables_iter_next(rib_tables_iter_t *iter)
                iter->vrf_id = VRF_DEFAULT;
                iter->afi_safi_ix = -1;
 
-       /* Fall through */
+               fallthrough;
 
        case RIB_TABLES_ITER_S_ITERATING:
                iter->afi_safi_ix++;