[PATCH 1/9] ring: use C11 alignof

Tyler Retzlaff roretzla at linux.microsoft.com
Thu Jan 25 00:17:48 CET 2024


Replace use of __alignof__(e) with C11 alignof(typeof(e)) to improve
portability between toolchains

Signed-off-by: Tyler Retzlaff <roretzla at linux.microsoft.com>
---
 lib/ring/rte_ring.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/ring/rte_ring.c b/lib/ring/rte_ring.c
index c59f626..a783299 100644
--- a/lib/ring/rte_ring.c
+++ b/lib/ring/rte_ring.c
@@ -7,6 +7,7 @@
  * Used as BSD-3 Licensed with permission from Kip Macy.
  */
 
+#include <stdalign.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdint.h>
@@ -288,7 +289,7 @@ struct rte_ring *
 	 * rte_errno for us appropriately - hence no check in this function
 	 */
 	mz = rte_memzone_reserve_aligned(mz_name, ring_size, socket_id,
-					 mz_flags, __alignof__(*r));
+					 mz_flags, alignof(typeof(*r)));
 	if (mz != NULL) {
 		r = mz->addr;
 		/* no need to check return value here, we already checked the
-- 
1.8.3.1



More information about the dev mailing list