Putting declarations inside switch block but before the first case statement cause clang to flag them as unreachable code. Simpler to just move.
Signed-off-by: Stephen Hemminger <[email protected]> --- lib/ethdev/rte_flow.c | 71 +++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 37 deletions(-) diff --git a/lib/ethdev/rte_flow.c b/lib/ethdev/rte_flow.c index ae08e100fa..393e365f9f 100644 --- a/lib/ethdev/rte_flow.c +++ b/lib/ethdev/rte_flow.c @@ -704,29 +704,28 @@ rte_flow_conv_item_spec(void *buf, const size_t size, type == RTE_FLOW_CONV_ITEM_LAST ? item->last : type == RTE_FLOW_CONV_ITEM_MASK ? item->mask : NULL; + union { + const struct rte_flow_item_raw *raw; + const struct rte_flow_item_geneve_opt *geneve_opt; + } spec; + union { + const struct rte_flow_item_raw *raw; + } last; + union { + const struct rte_flow_item_raw *raw; + } mask; + union { + const struct rte_flow_item_raw *raw; + const struct rte_flow_item_geneve_opt *geneve_opt; + } src; + union { + struct rte_flow_item_raw *raw; + struct rte_flow_item_geneve_opt *geneve_opt; + } dst; + void *deep_src; + size_t tmp; switch (item->type) { - union { - const struct rte_flow_item_raw *raw; - const struct rte_flow_item_geneve_opt *geneve_opt; - } spec; - union { - const struct rte_flow_item_raw *raw; - } last; - union { - const struct rte_flow_item_raw *raw; - } mask; - union { - const struct rte_flow_item_raw *raw; - const struct rte_flow_item_geneve_opt *geneve_opt; - } src; - union { - struct rte_flow_item_raw *raw; - struct rte_flow_item_geneve_opt *geneve_opt; - } dst; - void *deep_src; - size_t tmp; - case RTE_FLOW_ITEM_TYPE_RAW: spec.raw = item->spec; last.raw = item->last ? item->last : item->spec; @@ -809,21 +808,20 @@ rte_flow_conv_action_conf(void *buf, const size_t size, const struct rte_flow_action *action) { size_t off; + union { + const struct rte_flow_action_rss *rss; + const struct rte_flow_action_vxlan_encap *vxlan_encap; + const struct rte_flow_action_nvgre_encap *nvgre_encap; + } src; + union { + struct rte_flow_action_rss *rss; + struct rte_flow_action_vxlan_encap *vxlan_encap; + struct rte_flow_action_nvgre_encap *nvgre_encap; + } dst; + size_t tmp; + int ret; switch (action->type) { - union { - const struct rte_flow_action_rss *rss; - const struct rte_flow_action_vxlan_encap *vxlan_encap; - const struct rte_flow_action_nvgre_encap *nvgre_encap; - } src; - union { - struct rte_flow_action_rss *rss; - struct rte_flow_action_vxlan_encap *vxlan_encap; - struct rte_flow_action_nvgre_encap *nvgre_encap; - } dst; - size_t tmp; - int ret; - case RTE_FLOW_ACTION_TYPE_RSS: src.rss = action->conf; dst.rss = buf; @@ -1241,12 +1239,11 @@ rte_flow_conv(enum rte_flow_conv_op op, const void *src, struct rte_flow_error *error) { + const struct rte_flow_attr *attr; + const struct rte_flow_item *item; int ret; switch (op) { - const struct rte_flow_attr *attr; - const struct rte_flow_item *item; - case RTE_FLOW_CONV_OP_NONE: ret = 0; break; -- 2.53.0

