netlink: Move static arrays of parsers into tests that use them

These are not documented as part of the API in the manpages and
raise warnings on GCC in the test-includes stage.

Reported by:	-Wunused-variable
This commit is contained in:
John Baldwin 2025-04-10 21:30:34 -04:00
parent b2f4d9b67f
commit 65eaf72620
5 changed files with 16 additions and 16 deletions

View file

@ -1327,9 +1327,4 @@ snl_send_msgs(struct snl_writer *nw)
return (snl_send(nw->ss, nw->base, offset));
}
static const struct snl_hdr_parser *snl_all_core_parsers[] = {
&snl_errmsg_parser, &snl_donemsg_parser,
&_nla_bit_parser, &_nla_bitset_parser,
};
#endif

View file

@ -172,8 +172,4 @@ snl_get_genl_mcast_group(struct snl_state *ss, const char *family_name,
return (0);
}
static const struct snl_hdr_parser *snl_all_genl_parsers[] = {
&_genl_ctrl_getfam_parser, &_genl_ctrl_mc_parser,
};
#endif

View file

@ -389,11 +389,4 @@ _cb_p_nh(struct snl_state *ss __unused, void *_target)
SNL_DECLARE_PARSER_EXT(snl_nhmsg_parser, sizeof(struct nhmsg),
sizeof(struct snl_parsed_nhop), _fp_p_nh, _nla_p_nh, _cb_p_nh);
static const struct snl_hdr_parser *snl_all_route_parsers[] = {
&_metrics_mp_nh_parser, &_mpath_nh_parser, &_metrics_parser, &snl_rtm_route_parser,
&_link_fbsd_parser, &snl_rtm_link_parser, &snl_rtm_link_parser_simple,
&_neigh_fbsd_parser, &snl_rtm_neigh_parser,
&_addr_fbsd_parser, &snl_rtm_addr_parser, &_nh_fbsd_parser, &snl_nhmsg_parser,
};
#endif

View file

@ -13,6 +13,18 @@
#include <atf-c.h>
static const struct snl_hdr_parser *snl_all_core_parsers[] = {
&snl_errmsg_parser, &snl_donemsg_parser,
&_nla_bit_parser, &_nla_bitset_parser,
};
static const struct snl_hdr_parser *snl_all_route_parsers[] = {
&_metrics_mp_nh_parser, &_mpath_nh_parser, &_metrics_parser, &snl_rtm_route_parser,
&_link_fbsd_parser, &snl_rtm_link_parser, &snl_rtm_link_parser_simple,
&_neigh_fbsd_parser, &snl_rtm_neigh_parser,
&_addr_fbsd_parser, &snl_rtm_addr_parser, &_nh_fbsd_parser, &snl_nhmsg_parser,
};
static void
require_netlink(void)
{

View file

@ -11,6 +11,10 @@
#include <atf-c.h>
static const struct snl_hdr_parser *snl_all_genl_parsers[] = {
&_genl_ctrl_getfam_parser, &_genl_ctrl_mc_parser,
};
static void
require_netlink(void)
{