From e8e1946edf6ba87ef53832cdceccc39d7f0c3f26 Mon Sep 17 00:00:00 2001 From: paul Date: Thu, 19 Jan 2006 20:16:55 +0000 Subject: [compiler] miscellaneous trivial compiler warning fixes 2006-01-19 Paul Jakma * (general) various miscellaneous compiler warning fixes. Remove redundant break statements from switch clauses which return. return from main, not exit, cause it annoys SOS. Remove stray semi-colons which cause empty-statement warnings. * zebra/main.c: (sighup) remove private declaration of external function. --- bgpd/ChangeLog | 9 +++++++++ bgpd/bgp_aspath.c | 8 -------- bgpd/bgp_attr.c | 1 - bgpd/bgp_clist.c | 1 - bgpd/bgp_community.c | 1 - bgpd/bgp_ecommunity.c | 1 - bgpd/bgp_filter.c | 3 --- bgpd/bgp_main.c | 2 +- bgpd/bgp_packet.c | 1 - bgpd/bgp_route.c | 2 +- bgpd/bgp_routemap.c | 8 -------- bgpd/bgp_vty.c | 16 ++++------------ bgpd/bgpd.c | 2 -- ospfd/ChangeLog | 9 +++++++++ ospfd/ospf_dump.c | 1 - ospfd/ospf_lsa.c | 4 ---- ospfd/ospf_main.c | 2 +- ospfd/ospf_routemap.c | 8 -------- ospfd/ospf_vty.c | 2 +- ripd/ChangeLog | 4 ++++ ripd/rip_main.c | 2 +- ripngd/ChangeLog | 9 +++++++++ ripngd/ripng_main.c | 2 +- ripngd/ripng_routemap.c | 8 -------- zebra/ChangeLog | 11 +++++++++++ zebra/main.c | 5 +---- zebra/zebra_rib.c | 4 ++-- zebra/zserv.c | 1 - 28 files changed, 55 insertions(+), 72 deletions(-) diff --git a/bgpd/ChangeLog b/bgpd/ChangeLog index 234ecb5d..c96bc649 100644 --- a/bgpd/ChangeLog +++ b/bgpd/ChangeLog @@ -1,3 +1,12 @@ +2006-01-19 Paul Jakma + + * (general) various miscellaneous compiler warning fixes. + Remove redundant break statements from switch clauses + which return. + return from main, not exit, cause it annoys SOS. + Remove stray semi-colons which cause empty-statement + warnings. + 2006-01-17 Paul Jakma * bgp_nexthop.c: (zlookup_read*) convert to new Zserv format. diff --git a/bgpd/bgp_aspath.c b/bgpd/bgp_aspath.c index e9a6d6a2..2cc5ed35 100644 --- a/bgpd/bgp_aspath.c +++ b/bgpd/bgp_aspath.c @@ -1309,37 +1309,30 @@ aspath_gettoken (const char *buf, enum as_token *token, u_short *asno) { case '\0': return NULL; - break; case '{': *token = as_token_set_start; p++; return p; - break; case '}': *token = as_token_set_end; p++; return p; - break; case '(': *token = as_token_confed_seq_start; p++; return p; - break; case ')': *token = as_token_confed_seq_end; p++; return p; - break; case '[': *token = as_token_confed_set_start; p++; return p; - break; case ']': *token = as_token_confed_set_end; p++; return p; - break; } /* Check actual AS value. */ @@ -1423,7 +1416,6 @@ aspath_str2aspath (const char *str) default: aspath_free (aspath); return NULL; - break; } } diff --git a/bgpd/bgp_attr.c b/bgpd/bgp_attr.c index 4b94b11e..3b27517d 100644 --- a/bgpd/bgp_attr.c +++ b/bgpd/bgp_attr.c @@ -983,7 +983,6 @@ bgp_mp_reach_parse (struct peer *peer, bgp_size_t length, struct attr *attr, zlog_info ("Wrong multiprotocol next hop length: %d", attr->mp_nexthop_len); return -1; - break; } snpa_num = stream_getc (s); diff --git a/bgpd/bgp_clist.c b/bgpd/bgp_clist.c index e5b4344e..f75fc55b 100644 --- a/bgpd/bgp_clist.c +++ b/bgpd/bgp_clist.c @@ -41,7 +41,6 @@ community_list_master_lookup (struct community_list_handler *ch, int master) { case COMMUNITY_LIST_MASTER: return &ch->community_list; - break; case EXTCOMMUNITY_LIST_MASTER: return &ch->extcommunity_list; } diff --git a/bgpd/bgp_community.c b/bgpd/bgp_community.c index 35e644b1..3033db14 100644 --- a/bgpd/bgp_community.c +++ b/bgpd/bgp_community.c @@ -594,7 +594,6 @@ community_str2com (const char *str) default: if (com) community_free (com); - return NULL; break; } } diff --git a/bgpd/bgp_ecommunity.c b/bgpd/bgp_ecommunity.c index bcd37ea6..64f4438f 100644 --- a/bgpd/bgp_ecommunity.c +++ b/bgpd/bgp_ecommunity.c @@ -500,7 +500,6 @@ ecommunity_str2com (const char *str, int type, int keyword_included) if (ecom) ecommunity_free (ecom); return NULL; - break; } } return ecom; diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c index de572c0a..ab7f0703 100644 --- a/bgpd/bgp_filter.c +++ b/bgpd/bgp_filter.c @@ -303,13 +303,10 @@ filter_type_str (enum as_filter_type type) { case AS_FILTER_PERMIT: return "permit"; - break; case AS_FILTER_DENY: return "deny"; - break; default: return ""; - break; } } diff --git a/bgpd/bgp_main.c b/bgpd/bgp_main.c index f9f0373d..0baae3bf 100644 --- a/bgpd/bgp_main.c +++ b/bgpd/bgp_main.c @@ -313,5 +313,5 @@ main (int argc, char **argv) thread_call (&thread); /* Not reached. */ - exit (0); + return (0); } diff --git a/bgpd/bgp_packet.c b/bgpd/bgp_packet.c index fa218e29..07c3cbb1 100644 --- a/bgpd/bgp_packet.c +++ b/bgpd/bgp_packet.c @@ -678,7 +678,6 @@ bgp_write (struct thread *thread) peer->status = Idle; bgp_timer_set (peer); return 0; - break; case BGP_MSG_KEEPALIVE: peer->keepalive_out++; break; diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index f2621c1f..e0d2a317 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -8100,7 +8100,7 @@ ALIAS (show_bgp_community_list, "Address family\n" "Display routes matching the community-list\n" "community-list number\n" - "community-list name\n"); + "community-list name\n") /* old command */ DEFUN (show_ipv6_bgp_community_list, diff --git a/bgpd/bgp_routemap.c b/bgpd/bgp_routemap.c index bc9b6f78..15ba9452 100644 --- a/bgpd/bgp_routemap.c +++ b/bgpd/bgp_routemap.c @@ -2046,11 +2046,9 @@ bgp_route_match_add (struct vty *vty, struct route_map_index *index, case RMAP_RULE_MISSING: vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE); return CMD_WARNING; - break; case RMAP_COMPILE_ERROR: vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); return CMD_WARNING; - break; } } return CMD_SUCCESS; @@ -2071,11 +2069,9 @@ bgp_route_match_delete (struct vty *vty, struct route_map_index *index, case RMAP_RULE_MISSING: vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE); return CMD_WARNING; - break; case RMAP_COMPILE_ERROR: vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); return CMD_WARNING; - break; } } return CMD_SUCCESS; @@ -2096,11 +2092,9 @@ bgp_route_set_add (struct vty *vty, struct route_map_index *index, case RMAP_RULE_MISSING: vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE); return CMD_WARNING; - break; case RMAP_COMPILE_ERROR: vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); return CMD_WARNING; - break; } } return CMD_SUCCESS; @@ -2121,11 +2115,9 @@ bgp_route_set_delete (struct vty *vty, struct route_map_index *index, case RMAP_RULE_MISSING: vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE); return CMD_WARNING; - break; case RMAP_COMPILE_ERROR: vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); return CMD_WARNING; - break; } } return CMD_SUCCESS; diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index c8d5b2ac..6ee48236 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -324,17 +324,14 @@ DEFUN (router_bgp, vty_out (vty, "Please specify 'bgp multiple-instance' first%s", VTY_NEWLINE); return CMD_WARNING; - break; case BGP_ERR_AS_MISMATCH: vty_out (vty, "BGP is already running; AS is %d%s", as, VTY_NEWLINE); return CMD_WARNING; - break; case BGP_ERR_INSTANCE_MISMATCH: vty_out (vty, "BGP view name and AS number mismatch%s", VTY_NEWLINE); vty_out (vty, "BGP instance is already running; AS is %d%s", as, VTY_NEWLINE); return CMD_WARNING; - break; } vty->node = BGP_NODE; @@ -1276,11 +1273,9 @@ peer_remote_as_vty (struct vty *vty, const char *peer_str, case BGP_ERR_PEER_GROUP_MEMBER: vty_out (vty, "%% Peer-group AS %d. Cannot configure remote-as for member%s", as, VTY_NEWLINE); return CMD_WARNING; - break; case BGP_ERR_PEER_GROUP_PEER_TYPE_DIFFERENT: vty_out (vty, "%% The AS# can not be changed from %d to %s, peer-group members must be all internal or all external%s", as, as_str, VTY_NEWLINE); return CMD_WARNING; - break; } return bgp_vty_return (vty, ret); } @@ -2671,7 +2666,7 @@ ALIAS (neighbor_disable_connected_check, NEIGHBOR_CMD2 "enforce-multihop", NEIGHBOR_STR NEIGHBOR_ADDR_STR2 - "Enforce EBGP neighbors perform multihop\n"); + "Enforce EBGP neighbors perform multihop\n") /* Enforce multihop. */ ALIAS (no_neighbor_disable_connected_check, @@ -2680,7 +2675,7 @@ ALIAS (no_neighbor_disable_connected_check, NO_STR NEIGHBOR_STR NEIGHBOR_ADDR_STR2 - "Enforce EBGP neighbors perform multihop\n"); + "Enforce EBGP neighbors perform multihop\n") DEFUN (neighbor_description, neighbor_description_cmd, @@ -3804,7 +3799,7 @@ ALIAS (no_neighbor_maximum_prefix, NEIGHBOR_ADDR_STR2 "Maximum number of prefix accept from this peer\n" "maximum no. of prefix limit\n" - "Only give warning message when limit is exceeded\n"); + "Only give warning message when limit is exceeded\n") ALIAS (no_neighbor_maximum_prefix, no_neighbor_maximum_prefix_threshold_warning_cmd, @@ -3815,7 +3810,7 @@ ALIAS (no_neighbor_maximum_prefix, "Maximum number of prefix accept from this peer\n" "maximum no. of prefix limit\n" "Threshold value (%) at which to generate a warning msg\n" - "Only give warning message when limit is exceeded\n"); + "Only give warning message when limit is exceeded\n") ALIAS (no_neighbor_maximum_prefix, no_neighbor_maximum_prefix_restart_cmd, @@ -9646,13 +9641,10 @@ community_direct_str (int direct) { case COMMUNITY_DENY: return "deny"; - break; case COMMUNITY_PERMIT: return "permit"; - break; default: return "unknown"; - break; } } diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c index ea365dec..1f1b4fd2 100644 --- a/bgpd/bgpd.c +++ b/bgpd/bgpd.c @@ -85,7 +85,6 @@ bgp_option_set (int flag) break; default: return BGP_ERR_INVALID_FLAG; - break; } return 0; } @@ -105,7 +104,6 @@ bgp_option_unset (int flag) break; default: return BGP_ERR_INVALID_FLAG; - break; } return 0; } diff --git a/ospfd/ChangeLog b/ospfd/ChangeLog index e5f83378..a5a1753a 100644 --- a/ospfd/ChangeLog +++ b/ospfd/ChangeLog @@ -1,3 +1,12 @@ +2006-01-19 Paul Jakma + + * (general) various miscellaneous compiler warning fixes. + Remove redundant break statements from switch clauses + which return. + return from main, not exit, cause it annoys SOS. + Remove stray semi-colons which cause empty-statement + warnings. + 2006-01-18 Juergen Kammer * ospf_lsa.c: (ospf_router_lsa_new) dont take reference to the diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c index 859e3bc9..95d24b1a 100644 --- a/ospfd/ospf_dump.c +++ b/ospfd/ospf_dump.c @@ -181,7 +181,6 @@ ospf_area_desc_string (struct ospf_area *area) break; default: return ospf_area_name_string (area); - break; } return buf; diff --git a/ospfd/ospf_lsa.c b/ospfd/ospf_lsa.c index 89e4d535..8ef4da66 100644 --- a/ospfd/ospf_lsa.c +++ b/ospfd/ospf_lsa.c @@ -3219,13 +3219,11 @@ ospf_lsa_lookup (struct ospf_area *area, u_int32_t type, case OSPF_OPAQUE_AREA_LSA: #endif /* HAVE_OPAQUE_LSA */ return ospf_lsdb_lookup_by_id (area->lsdb, type, id, adv_router); - break; case OSPF_AS_EXTERNAL_LSA: #ifdef HAVE_OPAQUE_LSA case OSPF_OPAQUE_AS_LSA: #endif /* HAVE_OPAQUE_LSA */ return ospf_lsdb_lookup_by_id (ospf->lsdb, type, id, adv_router); - break; default: break; } @@ -3244,7 +3242,6 @@ ospf_lsa_lookup_by_id (struct ospf_area *area, u_int32_t type, { case OSPF_ROUTER_LSA: return ospf_lsdb_lookup_by_id (area->lsdb, type, id, id); - break; case OSPF_NETWORK_LSA: for (rn = route_top (NETWORK_LSDB (area)); rn; rn = route_next (rn)) if ((lsa = rn->info)) @@ -3259,7 +3256,6 @@ ospf_lsa_lookup_by_id (struct ospf_area *area, u_int32_t type, /* Currently not used. */ assert (1); return ospf_lsdb_lookup_by_id (area->lsdb, type, id, id); - break; case OSPF_AS_EXTERNAL_LSA: case OSPF_AS_NSSA_LSA: #ifdef HAVE_OPAQUE_LSA diff --git a/ospfd/ospf_main.c b/ospfd/ospf_main.c index 3225d7d7..c105f192 100644 --- a/ospfd/ospf_main.c +++ b/ospfd/ospf_main.c @@ -321,6 +321,6 @@ main (int argc, char **argv) thread_call (&thread); /* Not reached. */ - exit (0); + return (0); } diff --git a/ospfd/ospf_routemap.c b/ospfd/ospf_routemap.c index 6c89b22a..adf81583 100644 --- a/ospfd/ospf_routemap.c +++ b/ospfd/ospf_routemap.c @@ -110,11 +110,9 @@ ospf_route_match_delete (struct vty *vty, struct route_map_index *index, case RMAP_RULE_MISSING: vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE); return CMD_WARNING; - break; case RMAP_COMPILE_ERROR: vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); return CMD_WARNING; - break; } } @@ -135,11 +133,9 @@ ospf_route_match_add (struct vty *vty, struct route_map_index *index, case RMAP_RULE_MISSING: vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE); return CMD_WARNING; - break; case RMAP_COMPILE_ERROR: vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); return CMD_WARNING; - break; } } @@ -160,11 +156,9 @@ ospf_route_set_add (struct vty *vty, struct route_map_index *index, case RMAP_RULE_MISSING: vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE); return CMD_WARNING; - break; case RMAP_COMPILE_ERROR: vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); return CMD_WARNING; - break; } } @@ -186,11 +180,9 @@ ospf_route_set_delete (struct vty *vty, struct route_map_index *index, case RMAP_RULE_MISSING: vty_out (vty, "%% Can't find rule.%s", VTY_NEWLINE); return CMD_WARNING; - break; case RMAP_COMPILE_ERROR: vty_out (vty, "%% Argument is malformed.%s", VTY_NEWLINE); return CMD_WARNING; - break; } } diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index 32dfdea0..0b74bdf1 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -3870,7 +3870,7 @@ show_ip_ospf_database_summary (struct vty *vty, struct ospf *ospf, int self) #ifdef HAVE_OPAQUE_LSA case OSPF_OPAQUE_AS_LSA: #endif /* HAVE_OPAQUE_LSA */ - break;; + break; default: continue; } diff --git a/ripd/ChangeLog b/ripd/ChangeLog index 2b79a61d..c979a11d 100644 --- a/ripd/ChangeLog +++ b/ripd/ChangeLog @@ -1,3 +1,7 @@ +2006-01-19 Paul Jakma + + * ripd.c: (main) return from main, not exit, cause it annoys SOS. + 2006-01-17 Paul Jakma * ripd.c: (rip_auth_md5) remove pdigest, not needed. diff --git a/ripd/rip_main.c b/ripd/rip_main.c index 88e63678..c9d564b7 100644 --- a/ripd/rip_main.c +++ b/ripd/rip_main.c @@ -298,5 +298,5 @@ main (int argc, char **argv) thread_call (&thread); /* Not reached. */ - exit (0); + return (0); } diff --git a/ripngd/ChangeLog b/ripngd/ChangeLog index 46d4f9f7..556ca8b4 100644 --- a/ripngd/ChangeLog +++ b/ripngd/ChangeLog @@ -1,3 +1,12 @@ +2006-01-19 Paul Jakma + + * (general) various miscellaneous compiler warning fixes. + Remove redundant break statements from switch clauses + which return. + return from main, not exit, cause it annoys SOS. + Remove stray semi-colons which cause empty-statement + warnings. + 2005-10-01 Andrew J. Schorr * ripng_zebra.c: (ripng_redistribute_write) Remove local hard-coded diff --git a/ripngd/ripng_main.c b/ripngd/ripng_main.c index 5885f47c..e6276c1b 100644 --- a/ripngd/ripng_main.c +++ b/ripngd/ripng_main.c @@ -299,5 +299,5 @@ main (int argc, char **argv) thread_call (&thread); /* Not reached. */ - exit (0); + return 0; } diff --git a/ripngd/ripng_routemap.c b/ripngd/ripng_routemap.c index 1c17e6c3..abaa61e1 100644 --- a/ripngd/ripng_routemap.c +++ b/ripngd/ripng_routemap.c @@ -57,11 +57,9 @@ ripng_route_match_add (struct vty *vty, struct route_map_index *index, case RMAP_RULE_MISSING: vty_out (vty, "Can't find rule.%s", VTY_NEWLINE); return CMD_WARNING; - break; case RMAP_COMPILE_ERROR: vty_out (vty, "Argument is malformed.%s", VTY_NEWLINE); return CMD_WARNING; - break; } } return CMD_SUCCESS; @@ -81,11 +79,9 @@ ripng_route_match_delete (struct vty *vty, struct route_map_index *index, case RMAP_RULE_MISSING: vty_out (vty, "Can't find rule.%s", VTY_NEWLINE); return CMD_WARNING; - break; case RMAP_COMPILE_ERROR: vty_out (vty, "Argument is malformed.%s", VTY_NEWLINE); return CMD_WARNING; - break; } } return CMD_SUCCESS; @@ -105,11 +101,9 @@ ripng_route_set_add (struct vty *vty, struct route_map_index *index, case RMAP_RULE_MISSING: vty_out (vty, "Can't find rule.%s", VTY_NEWLINE); return CMD_WARNING; - break; case RMAP_COMPILE_ERROR: vty_out (vty, "Argument is malformed.%s", VTY_NEWLINE); return CMD_WARNING; - break; } } return CMD_SUCCESS; @@ -129,11 +123,9 @@ ripng_route_set_delete (struct vty *vty, struct route_map_index *index, case RMAP_RULE_MISSING: vty_out (vty, "Can't find rule.%s", VTY_NEWLINE); return CMD_WARNING; - break; case RMAP_COMPILE_ERROR: vty_out (vty, "Argument is malformed.%s", VTY_NEWLINE); return CMD_WARNING; - break; } } return CMD_SUCCESS; diff --git a/zebra/ChangeLog b/zebra/ChangeLog index b33180f7..b40f78fb 100644 --- a/zebra/ChangeLog +++ b/zebra/ChangeLog @@ -1,3 +1,14 @@ +2006-01-19 Paul Jakma + + * (general) various miscellaneous compiler warning fixes. + Remove redundant break statements from switch clauses + which return. + Remove stray semi-colons which cause empty-statement + warnings. + * main.c: (sighup) remove private declaration of external + function. + (main) return from main, not exit, cause it annoys SOS. + 2006-01-18 Gunnar Stigen * zebra_rib.c: Take interface metric into account. diff --git a/zebra/main.c b/zebra/main.c index 67108c4e..dbe1b537 100644 --- a/zebra/main.c +++ b/zebra/main.c @@ -163,9 +163,6 @@ sighup (void) static void sigint (void) { - /* Decrared in rib.c */ - void rib_close (); - zlog_notice ("Terminating on signal"); if (!retain_mode) @@ -378,5 +375,5 @@ main (int argc, char **argv) thread_call (&thread); /* Not reached... */ - exit (0); + return 0; } diff --git a/zebra/zebra_rib.c b/zebra/zebra_rib.c index 5d9cb2f6..a591776a 100644 --- a/zebra/zebra_rib.c +++ b/zebra/zebra_rib.c @@ -1497,7 +1497,7 @@ static_ipv4_nexthop_same (struct nexthop *nexthop, struct static_ipv4 *si) if (nexthop->type == NEXTHOP_TYPE_BLACKHOLE && si->type == STATIC_IPV4_BLACKHOLE) return 1; - return 0;; + return 0; } /* Uninstall static route from RIB. */ @@ -2045,7 +2045,7 @@ static_ipv6_nexthop_same (struct nexthop *nexthop, struct static_ipv6 *si) && IPV6_ADDR_SAME (&nexthop->gate.ipv6, &si->ipv6) && strcmp (nexthop->ifname, si->ifname) == 0) return 1; - return 0;; + return 0; } static void diff --git a/zebra/zserv.c b/zebra/zserv.c index f8bfcfaa..aa88ab5d 100644 --- a/zebra/zserv.c +++ b/zebra/zserv.c @@ -138,7 +138,6 @@ zebra_server_send_message(struct zserv *client) client->t_suicide = thread_add_event(zebrad.master, zserv_delayed_close, client, 0); return -1; - break; case BUFFER_EMPTY: THREAD_OFF(client->t_write); break; -- cgit v1.2.1