[v2,05/21] stack: use C11 alignof

Message ID 1707849292-19519-6-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State Accepted, archived
Delegated to: David Marchand
Headers
Series use C11 alignof |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Tyler Retzlaff Feb. 13, 2024, 6:34 p.m. UTC
  Replace use of __alignof__(e) with C11 alignof(typeof(e)) to improve
portability between toolchains.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
---
 lib/stack/rte_stack.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Patch

diff --git a/lib/stack/rte_stack.c b/lib/stack/rte_stack.c
index 1dab6d6..7261281 100644
--- a/lib/stack/rte_stack.c
+++ b/lib/stack/rte_stack.c
@@ -2,6 +2,7 @@ 
  * Copyright(c) 2019 Intel Corporation
  */
 
+#include <stdalign.h>
 #include <string.h>
 #include <sys/queue.h>
 
@@ -90,7 +91,7 @@  struct rte_stack *
 	rte_mcfg_tailq_write_lock();
 
 	mz = rte_memzone_reserve_aligned(mz_name, sz, socket_id,
-					 0, __alignof__(*s));
+					 0, alignof(typeof(*s)));
 	if (mz == NULL) {
 		STACK_LOG_ERR("Cannot reserve stack memzone!");
 		rte_mcfg_tailq_write_unlock();