Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: Add a bunch of warnings to our build system #17954

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
6 changes: 2 additions & 4 deletions babeld/babel_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,7 @@ main(int argc, char **argv)
return 0;
}

static void
babel_fail(void)
static __attribute__((__noreturn__)) void babel_fail(void)
{
exit(1);
}
Expand Down Expand Up @@ -296,8 +295,7 @@ babel_load_state_file(void)
return ;
}

static void
babel_exit_properly(void)
static __attribute__((__noreturn__)) void babel_exit_properly(void)
{
debugf(BABEL_DEBUG_COMMON, "Exiting...");
usleep(roughly(10000));
Expand Down
2 changes: 1 addition & 1 deletion bfdd/bfdd.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ static void sigusr1_handler(void)
zlog_rotate();
}

static void sigterm_handler(void)
static __attribute__((__noreturn__)) void sigterm_handler(void)
{
bglobal.bg_shutdown = true;

Expand Down
7 changes: 3 additions & 4 deletions bgpd/bgp_bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -3532,7 +3532,6 @@ static int bmp_bgp_attribute_updated(struct bgp *bgp, bool withdraw)
struct bmp_targets *bt;
struct listnode *node;
struct bmp_imported_bgp *bib;
int ret = 0;
struct stream *s = bmp_peerstate(bgp->peer_self, withdraw);
struct bmp *bmp;
afi_t afi;
Expand All @@ -3543,7 +3542,7 @@ static int bmp_bgp_attribute_updated(struct bgp *bgp, bool withdraw)

if (bmpbgp) {
frr_each (bmp_targets, &bmpbgp->targets, bt) {
ret = bmp_bgp_attribute_updated_instance(bt, &bmpbgp->vrf_state, bgp,
(void)bmp_bgp_attribute_updated_instance(bt, &bmpbgp->vrf_state, bgp,
withdraw, s);
if (withdraw)
continue;
Expand All @@ -3565,8 +3564,8 @@ static int bmp_bgp_attribute_updated(struct bgp *bgp, bool withdraw)
frr_each (bmp_imported_bgps, &bt->imported_bgps, bib) {
if (bgp_lookup_by_name(bib->name) != bgp)
continue;
ret += bmp_bgp_attribute_updated_instance(bt, &bib->vrf_state, bgp,
withdraw, s);
(void)bmp_bgp_attribute_updated_instance(bt, &bib->vrf_state, bgp,
withdraw, s);
if (withdraw)
continue;
frr_each (bmp_session, &bt->sessions, bmp) {
Expand Down
12 changes: 7 additions & 5 deletions bgpd/bgp_rpki.c
Original file line number Diff line number Diff line change
Expand Up @@ -1553,20 +1553,21 @@ static int bgp_rpki_write_vrf(struct vty *vty, struct vrf *vrf)

for (ALL_LIST_ELEMENTS_RO(rpki_vrf->cache_list, cache_node, cache)) {
switch (cache->type) {
case TCP: {
struct tr_tcp_config *tcp_config;
#if defined(FOUND_SSH)
struct tr_ssh_config *ssh_config;
#endif
case TCP:

tcp_config = cache->tr_config.tcp_config;
vty_out(vty, "%s rpki cache tcp %s %s ", sep,
tcp_config->host, tcp_config->port);
if (tcp_config->bindaddr)
vty_out(vty, "source %s ",
tcp_config->bindaddr);
break;
}
#if defined(FOUND_SSH)
case SSH:
case SSH: {
struct tr_ssh_config *ssh_config;

ssh_config = cache->tr_config.ssh_config;
vty_out(vty, "%s rpki cache ssh %s %u %s %s %s ", sep,
ssh_config->host, ssh_config->port,
Expand All @@ -1579,6 +1580,7 @@ static int bgp_rpki_write_vrf(struct vty *vty, struct vrf *vrf)
vty_out(vty, "source %s ",
ssh_config->bindaddr);
break;
}
#endif
default:
break;
Expand Down
6 changes: 3 additions & 3 deletions bgpd/rfapi/rfapi_import.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,9 +181,6 @@ void rfapiCheckRefcount(struct agg_node *rn, safi_t safi, int lockoffset)
++count_monitor; /* rfapi_it_extra */

switch (safi) {
void *cursor;
int rc;

case SAFI_ENCAP:
for (hme = RFAPI_MONITOR_ENCAP(rn); hme;
hme = hme->next)
Expand All @@ -196,6 +193,9 @@ void rfapiCheckRefcount(struct agg_node *rn, safi_t safi, int lockoffset)
++count_monitor;

if (RFAPI_MONITOR_EXTERIOR(rn)->source) {
void *cursor;
int rc;

++count_monitor; /* sl */
cursor = NULL;
for (rc = skiplist_next(
Expand Down
5 changes: 5 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,11 @@ AC_C_FLAG([-Wbad-function-cast])
AC_C_FLAG([-Wwrite-strings])
AC_C_FLAG([-Wundef])
AC_C_FLAG([-Wimplicit-fallthrough])
AC_C_FLAG([-Werror=implicit])
AC_C_FLAG([-Werror=int-conversion])
AC_C_FLAG([-Werror=incompatible-pointer-types])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure we should be putting any -Werror here considering we have the global -Werror switch

AC_C_FLAG([-Wunreachable-code])
AC_C_FLAG([-Wmissing-noreturn])
if test "$enable_gcc_ultra_verbose" = "yes" ; then
AC_C_FLAG([-Wcast-qual])
AC_C_FLAG([-Wmissing-noreturn])
Expand Down
2 changes: 1 addition & 1 deletion eigrpd/eigrp_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static void sighup(void)
}

/* SIGINT / SIGTERM handler. */
static void sigint(void)
static __attribute__((__noreturn__)) void sigint(void)
{
zlog_notice("Terminating on signal");

Expand Down
3 changes: 1 addition & 2 deletions ldpd/lde.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ lde_init(struct ldpd_init *init)
zclient_sync_init();
}

static void
lde_shutdown(void)
static __attribute__((__noreturn__)) void lde_shutdown(void)
{
/* close pipes */
if (iev_ldpe) {
Expand Down
3 changes: 1 addition & 2 deletions ldpd/ldpd.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,8 +443,7 @@ main(int argc, char *argv[])
return (0);
}

static void
ldpd_shutdown(void)
static __attribute__((__noreturn__)) void ldpd_shutdown(void)
{
pid_t pid;
int status;
Expand Down
3 changes: 1 addition & 2 deletions ldpd/ldpe.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,7 @@ ldpe_init(struct ldpd_init *init)
accept_init();
}

static void
ldpe_shutdown(void)
static __attribute__((__noreturn__)) void ldpe_shutdown(void)
{
struct if_addr *if_addr;
struct adj *adj;
Expand Down
9 changes: 7 additions & 2 deletions lib/libfrr.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ static void rcv_signal(int signum)
/* poll() is interrupted by the signal; handled below */
}

static void frr_daemon_wait(int fd)
static __attribute__((__noreturn__)) void frr_daemon_wait(int fd)
{
struct pollfd pfd[1];
int ret;
Expand Down Expand Up @@ -1274,7 +1274,12 @@ void frr_fini(void)
master = NULL;
zlog_tls_buffer_fini();

if (0) {
/*
* The extra paranthesis around the 0 is telling the compiler that
* we are intentionally not calling zlog_fini(). So if you see
* this and are going... why.... this is why.
*/
if ((0)) {
/* this is intentionally disabled. zlog remains running until
* exit(), so even the very last item done during shutdown can
* have its zlog() messages written out.
Expand Down
2 changes: 1 addition & 1 deletion mgmtd/mgmt_fe_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -2018,7 +2018,7 @@ void mgmt_fe_adapter_init(struct event_loop *tm)
}
}

static void mgmt_fe_abort_if_session(void *data)
static __attribute__((__noreturn__)) void mgmt_fe_abort_if_session(void *data)
{
struct mgmt_fe_session_ctx *session = data;

Expand Down
8 changes: 4 additions & 4 deletions mgmtd/mgmt_testc.c
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ static void sigusr1(void)
zlog_rotate();
}

static void quit(int exit_code)
static __attribute__((__noreturn__)) void quit(int exit_code)
{
EVENT_OFF(event_timeout);
darr_free(__client_cbs.notif_xpaths);
Expand All @@ -166,19 +166,19 @@ static void quit(int exit_code)
exit(exit_code);
}

static void sigint(void)
static __attribute__((__noreturn__)) void sigint(void)
{
zlog_notice("Terminating on signal");
quit(0);
}

static void timeout(struct event *event)
static __attribute__((__noreturn__)) void timeout(struct event *event)
{
zlog_notice("Timeout, exiting");
quit(1);
}

static void success(struct event *event)
static __attribute__((__noreturn__)) void success(struct event *event)
{
zlog_notice("Success, exiting");
quit(0);
Expand Down
2 changes: 1 addition & 1 deletion nhrpd/nhrp_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static void nhrp_sigusr1(void)
zlog_rotate();
}

static void nhrp_request_stop(void)
static __attribute__((__noreturn__)) void nhrp_request_stop(void)
{
debugf(NHRP_DEBUG_COMMON, "Exiting...");
frr_early_fini();
Expand Down
4 changes: 2 additions & 2 deletions ospf6d/ospf6_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,14 +125,14 @@ static void sighup(void)
}

/* SIGINT handler. */
static void sigint(void)
static __attribute__((__noreturn__)) void sigint(void)
{
zlog_notice("Terminating on signal SIGINT");
ospf6_exit(0);
}

/* SIGTERM handler. */
static void sigterm(void)
static __attribute__((__noreturn__)) void sigterm(void)
{
zlog_notice("Terminating on signal SIGTERM");
ospf6_exit(0);
Expand Down
5 changes: 2 additions & 3 deletions ospfd/ospf_apiserver.c
Original file line number Diff line number Diff line change
Expand Up @@ -2087,6 +2087,8 @@ void ospf_apiserver_flush_opaque_lsa(struct ospf_apiserver *apiserv,
struct listnode *node, *nnode;
struct ospf *ospf;
struct ospf_area *area;
struct route_node *rn;
struct ospf_lsa *lsa;

ospf = ospf_lookup_by_vrf_id(VRF_DEFAULT);
assert(ospf);
Expand All @@ -2097,9 +2099,6 @@ void ospf_apiserver_flush_opaque_lsa(struct ospf_apiserver *apiserv,
param.opaque_type = opaque_type;

switch (lsa_type) {
struct route_node *rn;
struct ospf_lsa *lsa;

case OSPF_OPAQUE_LINK_LSA:
for (ALL_LIST_ELEMENTS(ospf->areas, node, nnode, area))
LSDB_LOOP (OPAQUE_LINK_LSDB(area), rn, lsa)
Expand Down
2 changes: 1 addition & 1 deletion ospfd/ospf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static void sighup(void)
}

/* SIGINT / SIGTERM handler. */
static void sigint(void)
static __attribute__((__noreturn__)) void sigint(void)
{
zlog_notice("Terminating on signal");
bfd_protocol_integration_set_shutdown(true);
Expand Down
2 changes: 1 addition & 1 deletion pathd/path_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static void sighup(void)
}

/* SIGINT / SIGTERM handler. */
static void sigint(void)
static __attribute__((__noreturn__)) void sigint(void)
{
zlog_notice("Terminating on signal");
zlog_notice("Unregister from opaque,etc ");
Expand Down
2 changes: 1 addition & 1 deletion pbrd/pbr_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static void sighup(void)
}

/* SIGINT / SIGTERM handler. */
static void sigint(void)
static __attribute__((__noreturn__)) void sigint(void)
{
zlog_notice("Terminating on signal");

Expand Down
4 changes: 2 additions & 2 deletions pimd/pim6_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@ static void pim6_sighup(void)
zlog_info("SIGHUP received, ignoring");
}

static void pim6_sigint(void)
static __attribute__((__noreturn__)) void pim6_sigint(void)
{
zlog_notice("Terminating on signal SIGINT");
pim6_terminate();
exit(1);
}

static void pim6_sigterm(void)
static __attribute__((__noreturn__)) void pim6_sigterm(void)
{
zlog_notice("Terminating on signal SIGTERM");
pim6_terminate();
Expand Down
2 changes: 1 addition & 1 deletion pimd/pim_bsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1802,7 +1802,7 @@ bool cand_addrsel_update(struct cand_addrsel *asel, struct vrf *vrf)

case CAND_ADDR_ANY:
is_any = true;
/* fallthru */
fallthrough;
case CAND_ADDR_LO:
FOR_ALL_INTERFACES (vrf, ifp) {
if (!if_is_up(ifp))
Expand Down
4 changes: 2 additions & 2 deletions pimd/pim_signals.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ static void pim_sighup(void)
zlog_info("SIGHUP received, ignoring");
}

static void pim_sigint(void)
static __attribute__((__noreturn__)) void pim_sigint(void)
{
zlog_notice("Terminating on signal SIGINT");
pim_terminate();
exit(1);
}

static void pim_sigterm(void)
static __attribute__((__noreturn__)) void pim_sigterm(void)
{
zlog_notice("Terminating on signal SIGTERM");
pim_terminate();
Expand Down
2 changes: 1 addition & 1 deletion ripd/rip_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ static void sighup(void)
}

/* SIGINT handler. */
static void sigint(void)
static __attribute__((__noreturn__)) void sigint(void)
{
struct vrf *vrf;

Expand Down
2 changes: 1 addition & 1 deletion ripngd/ripng_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ static void sighup(void)
}

/* SIGINT handler. */
static void sigint(void)
static __attribute__((__noreturn__)) void sigint(void)
{
struct vrf *vrf;

Expand Down
2 changes: 1 addition & 1 deletion sharpd/sharp_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ static void sighup(void)
}

/* SIGINT / SIGTERM handler. */
static void sigint(void)
static __attribute__((__noreturn__)) void sigint(void)
{
zlog_notice("Terminating on signal");

Expand Down
2 changes: 1 addition & 1 deletion staticd/static_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ static void sighup(void)
}

/* SIGINT / SIGTERM handler. */
static void sigint(void)
static __attribute__((__noreturn__)) void sigint(void)
{
zlog_notice("Terminating on signal");

Expand Down
2 changes: 1 addition & 1 deletion vtysh/vtysh_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ static void vtysh_signal_init(void)
}

/* Help information display. */
static void usage(int status)
static __attribute__((__noreturn__)) void usage(int status)
{
if (status != 0)
fprintf(stderr, "Try `%s --help' for more information.\n",
Expand Down
2 changes: 1 addition & 1 deletion watchfrr/watchfrr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,7 @@ void watchfrr_status(struct vty *vty)
}
}

static void sigint(void)
static __attribute__((__noreturn__)) void sigint(void)
{
zlog_notice("Terminating on signal");
systemd_send_stopping();
Expand Down
Loading