[8/9] reorder: use C11 alignof

Message ID 1706138276-28224-9-git-send-email-roretzla@linux.microsoft.com (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers
Series use C11 alignof |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Tyler Retzlaff Jan. 24, 2024, 11:17 p.m. UTC
  Replace use of __alignof__(T) with C11 alignof(T) to improve portability
between toolchains.

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

Comments

Volodymyr Fialko Jan. 25, 2024, 12:36 a.m. UTC | #1
> -----Original Message-----
> From: Tyler Retzlaff <roretzla@linux.microsoft.com>
> Sent: Thursday, January 25, 2024 12:18 AM
> To: dev@dpdk.org
> Cc: Akhil Goyal <gakhil@marvell.com>; Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>;
> Anoob Joseph <anoobj@marvell.com>; Ferruh Yigit <ferruh.yigit@amd.com>; Honnappa Nagarahalli
> <honnappa.nagarahalli@arm.com>; Jerin Jacob <jerinj@marvell.com>; Konstantin Ananyev
> <konstantin.v.ananyev@yandex.ru>; Nithin Kumar Dabilpuram <ndabilpuram@marvell.com>; Ori Kam
> <orika@nvidia.com>; Pavan Nikhilesh Bhagavatula <pbhagavatula@marvell.com>; Thomas Monjalon
> <thomas@monjalon.net>; Volodymyr Fialko <vfialko@marvell.com>; Tyler Retzlaff
> <roretzla@linux.microsoft.com>
> Subject: [EXT] [PATCH 8/9] reorder: use C11 alignof
> 
> External Email
> 
> ----------------------------------------------------------------------
> Replace use of __alignof__(T) with C11 alignof(T) to improve portability between toolchains.
> 
> Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> ---
>  lib/reorder/rte_reorder.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 

__alignof__ is supported by GCC from C99, but since DPDK 23.11 C11 compiler is required anyway, It should be fine to switch.

Acked-by: Volodymyr Fialko <vfialko@marvell.com>

/Volodymyr
  

Patch

diff --git a/lib/reorder/rte_reorder.c b/lib/reorder/rte_reorder.c
index ff81544..c080b2c 100644
--- a/lib/reorder/rte_reorder.c
+++ b/lib/reorder/rte_reorder.c
@@ -2,6 +2,7 @@ 
  * Copyright(c) 2010-2014 Intel Corporation
  */
 
+#include <stdalign.h>
 #include <string.h>
 #include <sys/queue.h>
 
@@ -72,7 +73,7 @@  struct rte_reorder_buffer *
 	static const struct rte_mbuf_dynfield reorder_seqn_dynfield_desc = {
 		.name = RTE_REORDER_SEQN_DYNFIELD_NAME,
 		.size = sizeof(rte_reorder_seqn_t),
-		.align = __alignof__(rte_reorder_seqn_t),
+		.align = alignof(rte_reorder_seqn_t),
 	};
 
 	if (b == NULL) {