Skip to content

Commit 217a90e

Browse files
authored
Merge pull request FRRouting#18720 from mjstapp/compile_wnoreturn
*: enable the missing-noreturn compiler warning
2 parents dd42058 + 0157724 commit 217a90e

27 files changed

+42
-45
lines changed

babeld/babel_main.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ Copyright 2011 by Matthieu Boutier and Juliusz Chroboczek
3434
#include "babel_zebra.h"
3535
#include "babel_errors.h"
3636

37-
static void babel_fail(void);
37+
static FRR_NORETURN void babel_fail(void);
3838
static void babel_init_random(void);
39-
static void babel_exit_properly(void);
39+
static FRR_NORETURN void babel_exit_properly(void);
4040
static void babel_save_state_file(void);
4141

4242

@@ -85,8 +85,7 @@ struct zebra_privs_t babeld_privs =
8585
.cap_num_i = 0
8686
};
8787

88-
static void
89-
babel_sigexit(void)
88+
static FRR_NORETURN void babel_sigexit(void)
9089
{
9190
zlog_notice("Terminating on signal");
9291

@@ -208,8 +207,7 @@ main(int argc, char **argv)
208207
return 0;
209208
}
210209

211-
static void
212-
babel_fail(void)
210+
static FRR_NORETURN void babel_fail(void)
213211
{
214212
exit(1);
215213
}
@@ -297,8 +295,7 @@ babel_load_state_file(void)
297295
return ;
298296
}
299297

300-
static void
301-
babel_exit_properly(void)
298+
static FRR_NORETURN void babel_exit_properly(void)
302299
{
303300
debugf(BABEL_DEBUG_COMMON, "Exiting...");
304301
usleep(roughly(10000));

bfdd/bfdd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static void sigusr1_handler(void)
5757
zlog_rotate();
5858
}
5959

60-
static void sigterm_handler(void)
60+
static FRR_NORETURN void sigterm_handler(void)
6161
{
6262
bglobal.bg_shutdown = true;
6363

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,9 +468,9 @@ AC_C_FLAG([-Wwrite-strings])
468468
AC_C_FLAG([-Wundef])
469469
AC_C_FLAG([-Wimplicit-fallthrough])
470470
AC_C_FLAG([-Wshadow])
471+
AC_C_FLAG([-Wmissing-noreturn])
471472
if test "$enable_gcc_ultra_verbose" = "yes" ; then
472473
AC_C_FLAG([-Wcast-qual])
473-
AC_C_FLAG([-Wmissing-noreturn])
474474
AC_C_FLAG([-Wmissing-format-attribute])
475475
AC_C_FLAG([-Wunreachable-code])
476476
AC_C_FLAG([-Wpacked])

eigrpd/eigrp_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static void sighup(void)
9292
}
9393

9494
/* SIGINT / SIGTERM handler. */
95-
static void sigint(void)
95+
static FRR_NORETURN void sigint(void)
9696
{
9797
zlog_notice("Terminating on signal");
9898

ldpd/lde.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,7 @@ lde_init(struct ldpd_init *init)
176176
zclient_sync_init();
177177
}
178178

179-
static void
180-
lde_shutdown(void)
179+
static FRR_NORETURN void lde_shutdown(void)
181180
{
182181
/* close pipes */
183182
if (iev_ldpe) {

ldpd/ldpd.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,8 +443,7 @@ main(int argc, char *argv[])
443443
return (0);
444444
}
445445

446-
static void
447-
ldpd_shutdown(void)
446+
static FRR_NORETURN void ldpd_shutdown(void)
448447
{
449448
pid_t pid;
450449
int status;

ldpd/ldpe.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#include "libfrr.h"
2626
#include "zlog_live.h"
2727

28-
static void ldpe_shutdown(void);
28+
static FRR_NORETURN void ldpe_shutdown(void);
2929
static void ldpe_dispatch_main(struct event *thread);
3030
static void ldpe_dispatch_lde(struct event *thread);
3131
#ifdef __OpenBSD__
@@ -66,8 +66,7 @@ struct zebra_privs_t ldpe_privs =
6666
};
6767

6868
/* SIGINT / SIGTERM handler. */
69-
static void
70-
sigint(void)
69+
static FRR_NORETURN void sigint(void)
7170
{
7271
ldpe_shutdown();
7372
}
@@ -182,8 +181,7 @@ ldpe_init(struct ldpd_init *init)
182181
accept_init();
183182
}
184183

185-
static void
186-
ldpe_shutdown(void)
184+
static FRR_NORETURN void ldpe_shutdown(void)
187185
{
188186
struct if_addr *if_addr;
189187
struct adj *adj;

lib/command_lex.l

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
/* ignore harmless bugs in old versions of flex */
1919
#pragma GCC diagnostic ignored "-Wsign-compare"
2020
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
21+
#pragma GCC diagnostic ignored "-Wmissing-noreturn"
2122

2223
#include "lib/command_parse.h"
2324

lib/compiler.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,6 +461,9 @@ _Static_assert(sizeof(_uint64_t) == 8 && sizeof(_int64_t) == 8,
461461
#define _DATA_SECTION(name) __attribute__((section(".data." name)))
462462
#endif
463463

464+
/* Wrapper for the 'noreturn' metadata */
465+
#define FRR_NORETURN __attribute__((noreturn))
466+
464467
#ifdef __cplusplus
465468
}
466469
#endif

lib/defun_lex.l

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
/* ignore harmless bugs in old versions of flex */
3030
#pragma GCC diagnostic ignored "-Wsign-compare"
3131
#pragma GCC diagnostic ignored "-Wunused-value"
32+
#pragma GCC diagnostic ignored "-Wmissing-noreturn"
3233

3334
#include "config.h"
3435
#include <Python.h>

lib/libfrr.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ static void rcv_signal(int signum)
868868
/* poll() is interrupted by the signal; handled below */
869869
}
870870

871-
static void frr_daemon_wait(int fd)
871+
static FRR_NORETURN void frr_daemon_wait(int fd)
872872
{
873873
struct pollfd pfd[1];
874874
int ret;

lib/memory.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,7 @@ typedef int qmem_walk_fn(void *arg, struct memgroup *mg, struct memtype *mt);
183183
extern int qmem_walk(qmem_walk_fn *func, void *arg);
184184
extern int log_memstats(const char *daemon_name, bool enabled);
185185

186-
extern __attribute__((__noreturn__)) void memory_oom(size_t size,
187-
const char *name);
186+
extern FRR_NORETURN void memory_oom(size_t size, const char *name);
188187

189188
#ifdef __cplusplus
190189
}

lib/sigevent.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,17 +206,17 @@ static void *program_counter(void *context)
206206
return NULL;
207207
}
208208

209-
static void __attribute__((noreturn))
210-
exit_handler(int signo, siginfo_t *siginfo, void *context)
209+
static void FRR_NORETURN exit_handler(int signo, siginfo_t *siginfo,
210+
void *context)
211211
{
212212
void *pc = program_counter(context);
213213

214214
zlog_signal(signo, "exiting...", siginfo, pc);
215215
_exit(128 + signo);
216216
}
217217

218-
static void __attribute__((noreturn))
219-
core_handler(int signo, siginfo_t *siginfo, void *context)
218+
static void FRR_NORETURN core_handler(int signo, siginfo_t *siginfo,
219+
void *context)
220220
{
221221
void *pc = program_counter(context);
222222

mgmtd/mgmt_fe_adapter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2030,7 +2030,7 @@ void mgmt_fe_adapter_init(struct event_loop *tm)
20302030
}
20312031
}
20322032

2033-
static void mgmt_fe_abort_if_session(void *data)
2033+
static FRR_NORETURN void mgmt_fe_abort_if_session(void *data)
20342034
{
20352035
struct mgmt_fe_session_ctx *session = data;
20362036

nhrpd/nhrp_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static void nhrp_sigusr1(void)
7878
zlog_rotate();
7979
}
8080

81-
static void nhrp_request_stop(void)
81+
static FRR_NORETURN void nhrp_request_stop(void)
8282
{
8383
debugf(NHRP_DEBUG_COMMON, "Exiting...");
8484
frr_early_fini();

ospf6d/ospf6_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,14 @@ static void sighup(void)
125125
}
126126

127127
/* SIGINT handler. */
128-
static void sigint(void)
128+
static FRR_NORETURN void sigint(void)
129129
{
130130
zlog_notice("Terminating on signal SIGINT");
131131
ospf6_exit(0);
132132
}
133133

134134
/* SIGTERM handler. */
135-
static void sigterm(void)
135+
static FRR_NORETURN void sigterm(void)
136136
{
137137
zlog_notice("Terminating on signal SIGTERM");
138138
ospf6_exit(0);

ospfd/ospf_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ static void sighup(void)
9999
}
100100

101101
/* SIGINT / SIGTERM handler. */
102-
static void sigint(void)
102+
static FRR_NORETURN void sigint(void)
103103
{
104104
zlog_notice("Terminating on signal");
105105
bfd_protocol_integration_set_shutdown(true);

pathd/path_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static void sighup(void)
5555
}
5656

5757
/* SIGINT / SIGTERM handler. */
58-
static void sigint(void)
58+
static FRR_NORETURN void sigint(void)
5959
{
6060
zlog_notice("Terminating on signal");
6161
zlog_notice("Unregister from opaque,etc ");

pbrd/pbr_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static void sighup(void)
6565
}
6666

6767
/* SIGINT / SIGTERM handler. */
68-
static void sigint(void)
68+
static FRR_NORETURN void sigint(void)
6969
{
7070
zlog_notice("Terminating on signal");
7171

pimd/pim6_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ static void pim6_sighup(void)
5656
zlog_info("SIGHUP received, ignoring");
5757
}
5858

59-
static void pim6_sigint(void)
59+
static FRR_NORETURN void pim6_sigint(void)
6060
{
6161
zlog_notice("Terminating on signal SIGINT");
6262
pim6_terminate();
6363
exit(1);
6464
}
6565

66-
static void pim6_sigterm(void)
66+
static FRR_NORETURN void pim6_sigterm(void)
6767
{
6868
zlog_notice("Terminating on signal SIGTERM");
6969
pim6_terminate();

pimd/pim_signals.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ static void pim_sighup(void)
2525
zlog_info("SIGHUP received, ignoring");
2626
}
2727

28-
static void pim_sigint(void)
28+
static FRR_NORETURN void pim_sigint(void)
2929
{
3030
zlog_notice("Terminating on signal SIGINT");
3131
pim_terminate();
3232
exit(1);
3333
}
3434

35-
static void pim_sigterm(void)
35+
static FRR_NORETURN void pim_sigterm(void)
3636
{
3737
zlog_notice("Terminating on signal SIGTERM");
3838
pim_terminate();

ripd/rip_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ static void sighup(void)
6969
}
7070

7171
/* SIGINT handler. */
72-
static void sigint(void)
72+
static FRR_NORETURN void sigint(void)
7373
{
7474
struct vrf *vrf;
7575

ripngd/ripng_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static void sighup(void)
6767
}
6868

6969
/* SIGINT handler. */
70-
static void sigint(void)
70+
static FRR_NORETURN void sigint(void)
7171
{
7272
struct vrf *vrf;
7373

sharpd/sharp_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static void sighup(void)
9090
}
9191

9292
/* SIGINT / SIGTERM handler. */
93-
static void sigint(void)
93+
static FRR_NORETURN void sigint(void)
9494
{
9595
zlog_notice("Terminating on signal");
9696

staticd/static_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ static void sighup(void)
6565
}
6666

6767
/* SIGINT / SIGTERM handler. */
68-
static void sigint(void)
68+
static FRR_NORETURN void sigint(void)
6969
{
7070
zlog_notice("Terminating on signal");
7171

vtysh/vtysh_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ static void vtysh_signal_init(void)
156156
}
157157

158158
/* Help information display. */
159-
static void usage(int status)
159+
static FRR_NORETURN void usage(int status)
160160
{
161161
if (status != 0)
162162
fprintf(stderr, "Try `%s --help' for more information.\n",

watchfrr/watchfrr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ void watchfrr_status(struct vty *vty)
10901090
}
10911091
}
10921092

1093-
static void sigint(void)
1093+
static FRR_NORETURN void sigint(void)
10941094
{
10951095
zlog_notice("Terminating on signal");
10961096
systemd_send_stopping();
@@ -1268,7 +1268,7 @@ static void netns_setup(const char *nsname)
12681268

12691269
#else /* !GNU_LINUX */
12701270

1271-
static void netns_setup(const char *nsname)
1271+
static FRR_NORETURN void netns_setup(const char *nsname)
12721272
{
12731273
fprintf(stderr, "network namespaces are only available on Linux\n");
12741274
exit(1);

0 commit comments

Comments
 (0)