[v2,19/21] net/virtio: use C11 alignof

Message ID 1707849292-19519-20-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__(T) with C11 alignof(T) to improve portability
between toolchains.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
 drivers/net/virtio/virtio_rxtx.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
  

Patch

diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c
index 99b9519..f69b945 100644
--- a/drivers/net/virtio/virtio_rxtx.c
+++ b/drivers/net/virtio/virtio_rxtx.c
@@ -2,6 +2,7 @@ 
  * Copyright(c) 2010-2014 Intel Corporation
  */
 
+#include <stdalign.h>
 #include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -1797,7 +1798,7 @@ 
 		    txm->nb_segs == 1 &&
 		    rte_pktmbuf_headroom(txm) >= hdr_size &&
 		    rte_is_aligned(rte_pktmbuf_mtod(txm, char *),
-			   __alignof__(struct virtio_net_hdr_mrg_rxbuf)))
+			   alignof(struct virtio_net_hdr_mrg_rxbuf)))
 			can_push = 1;
 		else if (virtio_with_feature(hw, VIRTIO_RING_F_INDIRECT_DESC) &&
 			 txm->nb_segs < VIRTIO_MAX_TX_INDIRECT)
@@ -1878,7 +1879,7 @@ 
 		    txm->nb_segs == 1 &&
 		    rte_pktmbuf_headroom(txm) >= hdr_size &&
 		    rte_is_aligned(rte_pktmbuf_mtod(txm, char *),
-				   __alignof__(struct virtio_net_hdr_mrg_rxbuf)))
+				   alignof(struct virtio_net_hdr_mrg_rxbuf)))
 			can_push = 1;
 		else if (virtio_with_feature(hw, VIRTIO_RING_F_INDIRECT_DESC) &&
 			 txm->nb_segs < VIRTIO_MAX_TX_INDIRECT)
@@ -1980,7 +1981,7 @@ 
 		     txm->nb_segs == 1 &&
 		     rte_pktmbuf_headroom(txm) >= hdr_size &&
 		     rte_is_aligned(rte_pktmbuf_mtod(txm, char *),
-				__alignof__(struct virtio_net_hdr_mrg_rxbuf))) {
+				alignof(struct virtio_net_hdr_mrg_rxbuf))) {
 			inorder_pkts[nb_inorder_pkts] = txm;
 			nb_inorder_pkts++;