30/06/2025 12:50, Bruce Richardson: > C++ does not allow zero-sized unions - they end up being of size 1-byte, > which leads to C/C++ compatibility issues, flagged by the compiler. > > lib/node/rte_node_mbuf_dynfield.h:78:2: error: union has size 0 in C, > size 1 in C++ [-Werror,-Wextern-c-compat] > 78 | union { > | ^ > 1 error generated. > > Fix the error by omitting the persistent_data field when it is > zero-sized, since it's unusable. Any app using the field must already > specify a size for the persistent data. [...] > --- a/lib/node/rte_node_mbuf_dynfield.h > +++ b/lib/node/rte_node_mbuf_dynfield.h > @@ -69,6 +69,7 @@ typedef struct rte_node_mbuf_overload_fields { > * 2. Overloadable fields: Fields which can be repurposed by two adjacent > nodes. > */ > typedef struct rte_node_mbuf_dynfield { > +#if RTE_NODE_MBUF_PERSISTENT_FIELDS_SIZE > 0 > /** > * Persistent mbuf region across nodes in graph walk > * > @@ -78,6 +79,7 @@ typedef struct rte_node_mbuf_dynfield { > union { > uint8_t persistent_data[RTE_NODE_MBUF_PERSISTENT_FIELDS_SIZE]; > }; > +#endif
I didn't do a deep analysis but I think I would prefer this option 2.