diff options
author | Igor Ryzhov <iryzhov@nfware.com> | 2023-10-10 23:15:32 +0200 |
---|---|---|
committer | Igor Ryzhov <iryzhov@nfware.com> | 2023-10-12 20:23:18 +0200 |
commit | 7d67b9ff28d09de58c632f80ef7d330e45e698f6 (patch) | |
tree | 16c8afc9dc80d70951f83d2f1182ace0edc7ee49 /ldpd | |
parent | Merge pull request #14559 from opensourcerouting/feature/update_dev_versions_... (diff) | |
download | frr-7d67b9ff28d09de58c632f80ef7d330e45e698f6.tar.xz frr-7d67b9ff28d09de58c632f80ef7d330e45e698f6.zip |
build: add -Wimplicit-fallthrough
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>
Diffstat (limited to 'ldpd')
-rw-r--r-- | ldpd/init.c | 4 | ||||
-rw-r--r-- | ldpd/ldp_vty_exec.c | 2 | ||||
-rw-r--r-- | ldpd/neighbor.c | 15 |
3 files changed, 6 insertions, 15 deletions
diff --git a/ldpd/init.c b/ldpd/init.c index f0cb98e5c..c34d18f8b 100644 --- a/ldpd/init.c +++ b/ldpd/init.c @@ -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, diff --git a/ldpd/ldp_vty_exec.c b/ldpd/ldp_vty_exec.c index 906b5c1bf..f3bcd1b25 100644 --- a/ldpd/ldp_vty_exec.c +++ b/ldpd/ldp_vty_exec.c @@ -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; diff --git a/ldpd/neighbor.c b/ldpd/neighbor.c index 5209c55bb..d40728b04 100644 --- a/ldpd/neighbor.c +++ b/ldpd/neighbor.c @@ -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); |