]> git.puffer.fish Git - mirror/frr.git/commitdiff
*: Allow returns to work with --enable-undefined-behavior 18731/head
authorDonald Sharp <sharpd@nvidia.com>
Mon, 28 Apr 2025 18:05:28 +0000 (14:05 -0400)
committerDonald Sharp <sharpd@nvidia.com>
Mon, 28 Apr 2025 18:05:28 +0000 (14:05 -0400)
If you have undefined behavior compilation checking gcc
starts to complain about a bunch of places that do not
have return's.  When most of them actually do and we
have the assert's to prove it.  I'm just doing this
to make the compiler happy for me, so I can continue
to do work.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
23 files changed:
bgpd/bgp_addpath.c
bgpd/bgp_route.c
bgpd/bgp_vty.c
bgpd/bgpd.c
bgpd/bgpd.h
bgpd/rfapi/rfapi_import.c
isisd/isis_adjacency.c
isisd/isis_pdu_counter.c
isisd/isisd.c
ldpd/lde_lib.c
lib/command_graph.c
lib/command_match.c
lib/ipaddr.h
lib/northbound.c
lib/prefix.c
pathd/path_cli.c
pathd/path_pcep_config.c
pathd/path_pcep_controller.c
pathd/path_pcep_debug.c
pathd/path_pcep_pcc.c
pathd/pathd.c
ripd/rip_nb_state.c
zebra/router-id.c

index 030db4b28eca831ebf38d62cf9f2408e82ca6b9a..1488fa19727c9b56de9a19b6e5f6fc9d4a451017 100644 (file)
@@ -175,6 +175,7 @@ bool bgp_addpath_tx_path(enum bgp_addpath_strat strat, struct bgp_path_info *pi)
        }
 
        assert(!"Reached end of function we should never hit");
+       return false;
 }
 
 static void bgp_addpath_flush_type_rn(struct bgp *bgp, afi_t afi, safi_t safi,
index ce6b73ac8ecbcef5c1a2fa2c145915d151d5edb2..f250b0338c20fe4c7e13b3d6a6c7ef61647a54e5 100644 (file)
@@ -13305,6 +13305,7 @@ const struct prefix_rd *bgp_rd_from_dest(const struct bgp_dest *dest,
        }
 
        assert(!"Reached end of function when we were not expecting it");
+       return NULL;
 }
 
 /* Display specified route of BGP table. */
index 1df8b4ffe2a800a8efffc693f3a174587af4fff8..0d718ac86379d935eff3e9ce5a3b5609009f6b71 100644 (file)
@@ -594,6 +594,7 @@ static const char *get_bgp_default_af_flag(afi_t afi, safi_t safi)
        /* all AFIs are accounted for above, so this shouldn't happen */
 
        assert(!"Reached end of function where we did not expect to");
+       return "DEV ESCAPE";
 }
 
 int bgp_get_vty(struct bgp **bgp, as_t *as, const char *name,
index 83f8057736a27971738545963b06d0cb1c49f148..ae5b55d2be48aa42bf6a591c609c0ef41c98b9b6 100644 (file)
@@ -1210,6 +1210,7 @@ const char *bgp_peer_get_connection_direction(struct peer_connection *connection
        }
 
        assert(!"DEV Escape: Expected switch to take care of this state");
+       return "DEV ESCAPE";
 }
 
 struct peer_connection *bgp_peer_connection_new(struct peer *peer)
index 2249a266c4b2f32f8a86d9d9e01c8c090dc1e5ce..73a015b63097a71c43f2ccb125b1fc31d44ed8c2 100644 (file)
@@ -2847,6 +2847,7 @@ static inline int afindex(afi_t afi, safi_t safi)
        }
 
        assert(!"Reached end of function we should never hit");
+       return BGP_AF_MAX;
 }
 
 /* If the peer is not a peer-group but is bound to a peer-group return 1 */
index 0d5a18afbb00414d927b9f586f62022cd10a8a71..da89f7bb170290d1bb52c8e9221e1be5d7b937d4 100644 (file)
@@ -3844,6 +3844,7 @@ rfapiBgpInfoFilteredImportFunction(safi_t safi)
        }
 
        assert(!"Reached end of function when we were not expecting to");
+       return NULL;
 }
 
 void rfapiProcessUpdate(struct peer *peer,
index 39ed076faba8af6962611537c4f566453535fc57..007c2998db29b085be0f9ef5fe9497d58900dc45 100644 (file)
@@ -486,6 +486,7 @@ const char *isis_adj_yang_state(enum isis_adj_state state)
        }
 
        assert(!"Reached end of function where we are not expecting to");
+       return "DEV ESCAPE";
 }
 
 void isis_adj_expire(struct event *thread)
@@ -944,4 +945,5 @@ int isis_adj_usage2levels(enum isis_adj_usage usage)
        }
 
        assert(!"Reached end of function where we are not expecting to");
+       return -1;
 }
index a3605a32a16234db97ea524d474844565379a6f3..6aaaa1143c77b834378db917bad0d471985597a6 100644 (file)
@@ -69,6 +69,7 @@ static const char *pdu_counter_index_to_name(enum pdu_counter_index index)
        }
 
        assert(!"Reached end of function where we were not expecting to");
+       return "DEV ESCAPE";
 }
 
 void pdu_counter_count(pdu_counter_t counter, uint8_t pdu_type)
index 2260ba664fcf7f38e005fea7d9458708bcc4c6cb..30b739305cec7cd1a57e6299b4c633c71ac70ce0 100644 (file)
@@ -2379,6 +2379,7 @@ static const char *pdu_counter_index_to_name_json(enum pdu_counter_index index)
        }
 
        assert(!"Reached end of function where we are not expecting to");
+       return "DEV ESCAPE";
 }
 
 static void common_isis_summary_json(struct json_object *json,
index 04bff9015856d6bfb87697f8e9f8b9f5c286d31b..7d038a30b99985627a913224790a8a5f1b86cffd 100644 (file)
@@ -1008,6 +1008,8 @@ lde_wildcard_apply(struct map *wcard, struct fec *fec, struct lde_map *me)
        default:
                fatalx("lde_wildcard_apply: unexpected fec type");
        }
+
+       return -1;
 }
 
 /* gabage collector timer: timer to remove dead entries from the LIB */
index 20ab6b321b5cb6e125b247334a03dae59ff93bba..87dc4e0281c80ee31460caded5bd40830f4fc88f 100644 (file)
@@ -274,6 +274,7 @@ static bool cmd_nodes_equal(struct graph_node *ga, struct graph_node *gb)
        }
 
        assert(!"Reached end of function we should never hit");
+       return false;
 }
 
 static void cmd_fork_bump_attr(struct graph_node *gn, struct graph_node *join,
index 97e6aeb4698a5b99ccb7ba59bb44d59e6a83b55e..ff07c48c13579734ad32e5f4135e6d9206eacb73 100644 (file)
@@ -547,6 +547,7 @@ static enum match_type min_match_level(enum cmd_token_type type)
        }
 
        assert(!"Reached end of function we should never hit");
+       return no_match;
 }
 
 /**
@@ -582,6 +583,7 @@ static int score_precedence(enum cmd_token_type type)
        }
 
        assert(!"Reached end of function we should never hit");
+       return -1;
 }
 
 /**
@@ -712,6 +714,7 @@ static enum match_type match_token(struct cmd_token *token, char *input_token)
        }
 
        assert(!"Reached end of function we should never hit");
+       return no_match;
 }
 
 #define IPV4_ADDR_STR   "0123456789."
index 888955fba0ab2cf27e8555ff7180ddac2686f53f..eb2c2d70f37fe1143941a242ebef8ed94c4690b4 100644 (file)
@@ -61,6 +61,7 @@ static inline int ipaddr_family(const struct ipaddr *ip)
        }
 
        assert(!"Reached end of function where we should never hit");
+       return AF_UNSPEC;
 }
 
 static inline int str2ipaddr(const char *str, struct ipaddr *ip)
@@ -151,6 +152,7 @@ static inline int ipaddr_cmp(const struct ipaddr *a, const struct ipaddr *b)
        }
 
        assert(!"Reached end of function we should never hit");
+       return -1;
 }
 
 static inline bool ipaddr_is_zero(const struct ipaddr *ip)
index a1e26d2523e073687940293bab15b6f1771c82df..cd8529382fc61617d40fb854b6dd89925b063805 100644 (file)
@@ -1102,6 +1102,7 @@ const char *nb_operation_name(enum nb_operation operation)
        }
 
        assert(!"Reached end of function we should never hit");
+       return "DEV ESCAPE";
 }
 
 bool nb_is_operation_allowed(struct nb_node *nb_node, enum nb_operation oper)
@@ -2620,6 +2621,7 @@ const char *nb_event_name(enum nb_event event)
        }
 
        assert(!"Reached end of function we should never hit");
+       return "DEV ESCAPE";
 }
 
 const char *nb_cb_operation_name(enum nb_cb_operation operation)
@@ -2654,6 +2656,7 @@ const char *nb_cb_operation_name(enum nb_cb_operation operation)
        }
 
        assert(!"Reached end of function we should never hit");
+       return "DEV ESCAPE";
 }
 
 const char *nb_err_name(enum nb_error error)
@@ -2682,6 +2685,7 @@ const char *nb_err_name(enum nb_error error)
        }
 
        assert(!"Reached end of function we should never hit");
+       return "DEV ESCAPE";
 }
 
 const char *nb_client_name(enum nb_client client)
@@ -2704,6 +2708,7 @@ const char *nb_client_name(enum nb_client client)
        }
 
        assert(!"Reached end of function we should never hit");
+       return "DEV ESCAPE";
 }
 
 static void nb_load_callbacks(const struct frr_yang_module_info *module)
index feaf3e5f1c9ac662cb45411feaf0bafa55b87560..221cfe5c2c2e9a1cbfae7f3d1f2234cbca68077e 100644 (file)
@@ -138,6 +138,7 @@ const char *afi2str_lower(afi_t afi)
        }
 
        assert(!"Reached end of function we should never reach");
+       return "DEV ESCAPE";
 }
 
 const char *afi2str(afi_t afi)
@@ -155,6 +156,7 @@ const char *afi2str(afi_t afi)
        }
 
        assert(!"Reached end of function we should never reach");
+       return "DEV ESCAPE";
 }
 
 const char *safi2str(safi_t safi)
@@ -180,6 +182,7 @@ const char *safi2str(safi_t safi)
        }
 
        assert(!"Reached end of function we should never reach");
+       return "DEV ESCAPE";
 }
 
 /* If n includes p prefix then return 1 else return 0. */
index 27236667b14a0fed742b98e03cae4ed6b66f05cd..254e4d7f03fbfed60aa07a2d7357f060f9cac700 100644 (file)
@@ -1077,6 +1077,7 @@ static const char *objfun_type_name(enum objfun_type type)
        }
 
        assert(!"Reached end of function we should never hit");
+       return "DEV ESCAPE";
 }
 
 DEFPY_NOSH(show_debugging_pathd, show_debugging_pathd_cmd,
index da7ee89f2fef1a4d50a6873365a8f72bf7161d08..7c5131366e7da9f96ec2c4e4474d39f30531e685 100644 (file)
@@ -483,6 +483,7 @@ status_int_to_ext(enum srte_policy_status status)
        }
 
        assert(!"Reached end of function where we are not expecting to");
+       return PCEP_LSP_OPERATIONAL_DOWN;
 }
 
 enum pcep_sr_subobj_nai pcep_nai_type(enum srte_segment_nai_type type)
@@ -536,4 +537,5 @@ enum srte_segment_nai_type srte_nai_type(enum pcep_sr_subobj_nai type)
        }
 
        assert(!"Reached end of function where we were not expecting to");
+       return SRTE_SEGMENT_NAI_TYPE_NONE;
 }
index a00a114086685def86f9ede261da76a9469889fa..d7166af82aa618d1aa2122e42fa731310bde7d3f 100644 (file)
@@ -1071,6 +1071,7 @@ const char *timer_type_name(enum pcep_ctrl_timer_type type)
        }
 
        assert(!"Reached end of function where we did not expect to");
+       return "DEV ESCAPE";
 }
 
 const char *timeout_type_name(enum pcep_ctrl_timeout_type type)
@@ -1085,4 +1086,5 @@ const char *timeout_type_name(enum pcep_ctrl_timeout_type type)
        }
 
        assert(!"Reached end of function where we did not expect to");
+       return "DEV ESCAPE";
 }
index 89e75743242066acbd89643a55854186ed0a5fad..bf906301bf4913a80e68233ae67a64bf07db6625 100644 (file)
@@ -80,6 +80,7 @@ const char *pcc_status_name(enum pcc_status status)
        }
 
        assert(!"Reached end of function where we do not expect to");
+       return "DEV ESCAPE";
 }
 
 const char *pcep_event_type_name(pcep_event_type event_type)
@@ -112,6 +113,7 @@ const char *pcep_event_type_name(pcep_event_type event_type)
        }
 
        assert(!"Reached end of function where we do not expect to");
+       return "DEV ESCAPE";
 }
 
 const char *pcep_error_type_name(enum pcep_error_type error_type)
@@ -636,6 +638,7 @@ const char *pcep_message_type_name(enum pcep_message_types pcep_message_type)
        }
 
        assert(!"Reached end of function where we are not expecting to");
+       return "DEV ESCAPE";
 }
 
 const char *pcep_object_class_name(enum pcep_object_classes obj_class)
@@ -692,6 +695,7 @@ const char *pcep_object_class_name(enum pcep_object_classes obj_class)
        }
 
        assert(!"Reached end of function where we are not expecting to");
+       return "DEV ESCAPE";
 }
 
 const char *pcep_object_type_name(enum pcep_object_classes obj_class,
@@ -767,6 +771,7 @@ const char *pcep_lsp_status_name(enum pcep_lsp_operational_status status)
        }
 
        assert(!"Reached end of function where we do not expect to");
+       return "DEV ESCAPE";
 }
 
 
@@ -818,6 +823,7 @@ const char *pcep_tlv_type_name(enum pcep_object_tlv_types tlv_type)
        }
 
        assert(!"Reached end of function where we do not expect to");
+       return "DEV ESCAPE";
 }
 
 const char *pcep_ro_type_name(enum pcep_ro_subobj_types ro_type)
@@ -841,6 +847,7 @@ const char *pcep_ro_type_name(enum pcep_ro_subobj_types ro_type)
        }
 
        assert(!"Reached end of function where we do not expect to");
+       return "DEV ESCAPE";
 }
 
 const char *pcep_nai_type_name(enum pcep_sr_subobj_nai nai_type)
@@ -865,6 +872,7 @@ const char *pcep_nai_type_name(enum pcep_sr_subobj_nai nai_type)
        }
 
        assert(!"Reached end of function where we do not expect to");
+       return "DEV ESCAPE";
 }
 
 const char *pcep_metric_type_name(enum pcep_metric_types type)
index f18eff28888ac39527a84b6f604f15a0af4088cb..b09ccdadc750552ed86741c996b70b7dd72447f9 100644 (file)
@@ -441,6 +441,7 @@ int pcep_pcc_disable(struct ctrl_state *ctrl_state, struct pcc_state *pcc_state)
        }
 
        assert(!"Reached end of function where we are not expecting to");
+       return -1;
 }
 
 void pcep_pcc_sync_path(struct ctrl_state *ctrl_state,
@@ -1955,6 +1956,7 @@ static uint32_t hash_nbkey(const struct lsp_nb_key *nbkey)
        }
 
        assert(!"Reached end of function where we were not expecting to");
+       return 0;
 }
 
 static int cmp_nbkey(const struct lsp_nb_key *a, const struct lsp_nb_key *b)
index 431fe4d1e31eee525d07743e2c7a1ee29baa4071..771f480a1fbb5b0f52ad652575ca9f3ad21532a4 100644 (file)
@@ -1030,6 +1030,7 @@ static uint32_t filter_type_to_flag(enum affinity_filter_type type)
        }
 
        assert(!"Reached end of function we should never hit");
+       return 0;
 }
 
 static const char *filter_type_name(enum affinity_filter_type type)
@@ -1046,6 +1047,7 @@ static const char *filter_type_name(enum affinity_filter_type type)
        }
 
        assert(!"Reached end of function we should never hit");
+       return "DEV ESCAPE";
 }
 
 /**
@@ -1277,6 +1279,7 @@ const char *srte_origin2str(enum srte_protocol_origin origin)
        }
 
        assert(!"Reached end of function we should never hit");
+       return "DEV ESCAPE";
 }
 
 void pathd_shutdown(void)
index fa0d382a0e095915b2228743e36e8aaa34aeca8f..3fb8d88bacbe8a92c5f499af1a35d8aa442d998f 100644 (file)
@@ -392,6 +392,7 @@ struct yang_data *ripd_instance_state_routes_route_next_hop_get_elem(
        }
 
        assert(!"Reached end of function where we do not expect to reach");
+       return NULL;
 }
 
 /*
@@ -418,6 +419,7 @@ struct yang_data *ripd_instance_state_routes_route_interface_get_elem(
        }
 
        assert(!"Reached end of function where we do not expect to reach");
+       return NULL;
 }
 
 /*
index 5a857abd8547375283ecae752e7b1c168c9578d6..73516eb730844754ff47fbf42115fa9b53fe6dd3 100644 (file)
@@ -107,6 +107,7 @@ int router_id_get(afi_t afi, struct prefix *p, struct zebra_vrf *zvrf)
        }
 
        assert(!"Reached end of function we should never hit");
+       return -1;
 }
 
 int router_id_set(afi_t afi, struct prefix *p, struct zebra_vrf *zvrf)