[PATCH] treewide: improve strict-aliasing

Morten Brørup mb at smartsharesystems.com
Mon Aug 31 08:36:49 CEST 2026


Grout is built with -Wstrict-aliasing=2, which requires
type casting to the generic "void *", like this:

	struct conn *conn;
	// create a new connection object
	if (rte_mempool_get(conn_pool, (void *)&conn) < 0)
		return NULL;

Change to -Wstrict-aliasing=3, so we can use more accurate
type casting, like this:

	struct conn *conn;
	// create a new connection object
	if (rte_mempool_get(conn_pool, (void **)&conn) < 0)
		return NULL;

Grout currently compiles just fine with -Wstrict-aliasing=3.

For reference, rte_mempool_get is declared as:

static __rte_always_inline int
rte_mempool_get(struct rte_mempool *mp, void **obj_p);

Signed-off-by: Morten Brørup <mb at smartsharesystems.com>
---
 meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index 144d1765..f0ac6ab6 100644
--- a/meson.build
+++ b/meson.build
@@ -33,7 +33,7 @@ endforeach
 
 # additional project C flags (keep alpha sorted)
 add_project_arguments('-Wmissing-prototypes', language: 'c')
-add_project_arguments('-Wstrict-aliasing=2', language: 'c')
+add_project_arguments('-Wstrict-aliasing=3', language: 'c')
 add_project_arguments('-fstrict-aliasing', language: 'c')
 
 # optional project C flags (keep alpha sorted)
-- 
2.43.0



More information about the grout mailing list