node: fix C++ compatibility errors (option 1)
PATCH 1/1 node: fix C++ compatibility errors (option 1)
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 defaulting to a having a 1-byte sized union rather than zero-sized.
Fixes 746e8736da70 ("node: add global mbuf dynfield")
Signed-off-by Bruce Richardson <[email protected]>
--- lib/node/rte_node_mbuf_dynfield.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
lib/node/rte_node_mbuf_dynfield.h +3 -2
@@ -26,12 +26,13 @@ extern "C" {#ifndef RTE_NODE_MBUF_PERSISTENT_FIELDS_SIZE /** Size of persistent mbuf fields */ -#define RTE_NODE_MBUF_PERSISTENT_FIELDS_SIZE (0) +#define RTE_NODE_MBUF_PERSISTENT_FIELDS_SIZE (1)/* Must be non-zero to avoid a zero-sized +* union, which causes C++ compat issues*/ #endif /* !RTE_NODE_MBUF_PERSISTENT_FIELDS_SIZE */ #ifndef RTE_NODE_MBUF_OVERLOADABLE_FIELDS_SIZE /** Size of overloadable mbuf fields */ -#define RTE_NODE_MBUF_OVERLOADABLE_FIELDS_SIZE (8) +#define RTE_NODE_MBUF_OVERLOADABLE_FIELDS_SIZE (8)#endif /* !RTE_NODE_MBUF_OVERLOADABLE_FIELDS_SIZE */ /** Size of node mbuf dynamic field */
--
2.48.1