From: Tyler Retzlaff <roretzla@linux.microsoft.com>
To: dev@dpdk.org
Cc: Ajit Khaparde <ajit.khaparde@broadcom.com>,
Akhil Goyal <gakhil@marvell.com>,
Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
Anoob Joseph <anoobj@marvell.com>,
Bruce Richardson <bruce.richardson@intel.com>,
Chaoyong He <chaoyong.he@corigine.com>,
Chenbo Xia <chenbox@nvidia.com>,
David Hunt <david.hunt@intel.com>,
Ferruh Yigit <ferruh.yigit@amd.com>,
Harry van Haaren <harry.van.haaren@intel.com>,
Hemant Agrawal <hemant.agrawal@nxp.com>,
Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>,
Jerin Jacob <jerinj@marvell.com>,
Jingjing Wu <jingjing.wu@intel.com>,
Jochen Behrens <jbehrens@vmware.com>,
John McNamara <john.mcnamara@intel.com>,
Kiran Kumar K <kirankumark@marvell.com>,
Konstantin Ananyev <konstantin.v.ananyev@yandex.ru>,
Maxime Coquelin <maxime.coquelin@redhat.com>,
Nicolas Chautru <nicolas.chautru@intel.com>,
Nithin Dabilpuram <ndabilpuram@marvell.com>,
Ori Kam <orika@nvidia.com>,
Pavan Nikhilesh <pbhagavatula@marvell.com>,
Sachin Saxena <sachin.saxena@nxp.com>,
Somnath Kotur <somnath.kotur@broadcom.com>,
Thomas Monjalon <thomas@monjalon.net>,
Volodymyr Fialko <vfialko@marvell.com>,
Zhirun Yan <zhirun.yan@intel.com>,
david.marchand@redhat.com,
Tyler Retzlaff <roretzla@linux.microsoft.com>
Subject: [PATCH v2 10/21] test: use C11 alignof
Date: Tue, 13 Feb 2024 10:34:41 -0800 [thread overview]
Message-ID: <1707849292-19519-11-git-send-email-roretzla@linux.microsoft.com> (raw)
In-Reply-To: <1707849292-19519-1-git-send-email-roretzla@linux.microsoft.com>
Replace use of __alignof__(T) with C11 alignof(T) to improve portability
between toolchains.
Replace use of __alignof__(e) with C11 alignof(typeof(e)) to improve
portability between toolchains
Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
---
app/test/test_distributor.c | 3 ++-
app/test/test_graph.c | 3 ++-
app/test/test_mbuf.c | 9 +++++----
app/test/test_ring_stress_impl.h | 6 ++++--
4 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/app/test/test_distributor.c b/app/test/test_distributor.c
index 6cb27f4..d2037b7 100644
--- a/app/test/test_distributor.c
+++ b/app/test/test_distributor.c
@@ -5,6 +5,7 @@
#include "test.h"
#include <unistd.h>
+#include <stdalign.h>
#include <string.h>
#include <rte_cycles.h>
#include <rte_errno.h>
@@ -831,7 +832,7 @@ int test_error_distributor_create_numworkers(void)
static const struct rte_mbuf_dynfield seq_dynfield_desc = {
.name = "test_distributor_dynfield_seq",
.size = sizeof(seq_dynfield_t),
- .align = __alignof__(seq_dynfield_t),
+ .align = alignof(seq_dynfield_t),
};
seq_dynfield_offset =
rte_mbuf_dynfield_register(&seq_dynfield_desc);
diff --git a/app/test/test_graph.c b/app/test/test_graph.c
index 3dd017e..b8409bc 100644
--- a/app/test/test_graph.c
+++ b/app/test/test_graph.c
@@ -7,6 +7,7 @@
#include <assert.h>
#include <inttypes.h>
#include <signal.h>
+#include <stdalign.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
@@ -935,7 +936,7 @@ struct test_node_register {
static const struct rte_mbuf_dynfield graph_dynfield_desc = {
.name = "test_graph_dynfield",
.size = sizeof(graph_dynfield_t),
- .align = __alignof__(graph_dynfield_t),
+ .align = alignof(graph_dynfield_t),
};
graph_dynfield_offset =
rte_mbuf_dynfield_register(&graph_dynfield_desc);
diff --git a/app/test/test_mbuf.c b/app/test/test_mbuf.c
index d7393df..51ea6ef 100644
--- a/app/test/test_mbuf.c
+++ b/app/test/test_mbuf.c
@@ -5,6 +5,7 @@
#include "test.h"
#include <string.h>
+#include <stdalign.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
@@ -2534,19 +2535,19 @@ struct test_case {
const struct rte_mbuf_dynfield dynfield = {
.name = "test-dynfield",
.size = sizeof(uint8_t),
- .align = __alignof__(uint8_t),
+ .align = alignof(uint8_t),
.flags = 0,
};
const struct rte_mbuf_dynfield dynfield2 = {
.name = "test-dynfield2",
.size = sizeof(uint16_t),
- .align = __alignof__(uint16_t),
+ .align = alignof(uint16_t),
.flags = 0,
};
const struct rte_mbuf_dynfield dynfield3 = {
.name = "test-dynfield3",
.size = sizeof(uint8_t),
- .align = __alignof__(uint8_t),
+ .align = alignof(uint8_t),
.flags = 0,
};
const struct rte_mbuf_dynfield dynfield_fail_big = {
@@ -2564,7 +2565,7 @@ struct test_case {
const struct rte_mbuf_dynfield dynfield_fail_flag = {
.name = "test-dynfield",
.size = sizeof(uint8_t),
- .align = __alignof__(uint8_t),
+ .align = alignof(uint8_t),
.flags = 1,
};
const struct rte_mbuf_dynflag dynflag_fail_flag = {
diff --git a/app/test/test_ring_stress_impl.h b/app/test/test_ring_stress_impl.h
index 62f046a..2dec897 100644
--- a/app/test/test_ring_stress_impl.h
+++ b/app/test/test_ring_stress_impl.h
@@ -2,6 +2,8 @@
* Copyright(c) 2020 Intel Corporation
*/
+#include <stdalign.h>
+
#include "test_ring_stress.h"
/**
@@ -285,7 +287,7 @@ struct ring_elem {
*data = NULL;
sz = num * sizeof(*elm);
- elm = rte_zmalloc(NULL, sz, __alignof__(*elm));
+ elm = rte_zmalloc(NULL, sz, alignof(typeof(*elm)));
if (elm == NULL) {
printf("%s: alloc(%zu) for %u elems data failed",
__func__, sz, num);
@@ -297,7 +299,7 @@ struct ring_elem {
/* alloc ring */
nr = 2 * num;
sz = rte_ring_get_memsize(nr);
- r = rte_zmalloc(NULL, sz, __alignof__(*r));
+ r = rte_zmalloc(NULL, sz, alignof(typeof(*r)));
if (r == NULL) {
printf("%s: alloc(%zu) for FIFO with %u elems failed",
__func__, sz, nr);
--
1.8.3.1
next prev parent reply other threads:[~2024-02-13 18:36 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-24 23:17 [PATCH 0/9] " Tyler Retzlaff
2024-01-24 23:17 ` [PATCH 1/9] ring: " Tyler Retzlaff
2024-01-24 23:17 ` [PATCH 2/9] mbuf: " Tyler Retzlaff
2024-01-24 23:17 ` [PATCH 3/9] ethdev: " Tyler Retzlaff
2024-01-24 23:17 ` [PATCH 4/9] eventdev: " Tyler Retzlaff
2024-01-24 23:17 ` [PATCH 5/9] stack: " Tyler Retzlaff
2024-01-24 23:17 ` [PATCH 6/9] node: " Tyler Retzlaff
2024-01-24 23:17 ` [PATCH 7/9] pdcp: " Tyler Retzlaff
2024-01-25 4:36 ` [EXT] " Anoob Joseph
2024-01-24 23:17 ` [PATCH 8/9] reorder: " Tyler Retzlaff
2024-01-25 0:36 ` [EXT] " Volodymyr Fialko
2024-01-24 23:17 ` [PATCH 9/9] security: " Tyler Retzlaff
2024-01-25 6:28 ` [EXT] " Akhil Goyal
2024-01-25 7:19 ` [PATCH 0/9] " Morten Brørup
2024-01-25 12:51 ` fengchengwen
2024-02-13 11:04 ` David Marchand
2024-02-13 18:34 ` [PATCH v2 00/21] " Tyler Retzlaff
2024-02-13 18:34 ` [PATCH v2 01/21] ring: " Tyler Retzlaff
2024-02-13 18:34 ` [PATCH v2 02/21] mbuf: " Tyler Retzlaff
2024-02-13 18:34 ` [PATCH v2 03/21] ethdev: " Tyler Retzlaff
2024-02-13 18:34 ` [PATCH v2 04/21] eventdev: " Tyler Retzlaff
2024-02-13 18:34 ` [PATCH v2 05/21] stack: " Tyler Retzlaff
2024-02-13 18:34 ` [PATCH v2 06/21] node: " Tyler Retzlaff
2024-02-13 18:34 ` [PATCH v2 07/21] pdcp: " Tyler Retzlaff
2024-02-13 18:34 ` [PATCH v2 08/21] reorder: " Tyler Retzlaff
2024-02-13 18:34 ` [PATCH v2 09/21] security: " Tyler Retzlaff
2024-02-13 18:34 ` Tyler Retzlaff [this message]
2024-02-13 18:34 ` [PATCH v2 11/21] examples: " Tyler Retzlaff
2024-02-13 18:34 ` [PATCH v2 12/21] app/eventdev: " Tyler Retzlaff
2024-02-13 18:34 ` [PATCH v2 13/21] drivers/bus: " Tyler Retzlaff
2024-02-13 18:34 ` [PATCH v2 14/21] event/sw: " Tyler Retzlaff
2024-02-13 18:34 ` [PATCH v2 15/21] net/bnxt: " Tyler Retzlaff
2024-02-13 19:19 ` Ajit Khaparde
2024-02-13 18:34 ` [PATCH v2 16/21] net/iavf: " Tyler Retzlaff
2024-02-13 18:34 ` [PATCH v2 17/21] net/nfp: " Tyler Retzlaff
2024-02-13 18:34 ` [PATCH v2 18/21] net/sfc: " Tyler Retzlaff
2024-02-13 18:34 ` [PATCH v2 19/21] net/virtio: " Tyler Retzlaff
2024-02-13 18:34 ` [PATCH v2 20/21] net/vmxnet3: " Tyler Retzlaff
2024-02-13 18:34 ` [PATCH v2 21/21] devtools: forbid direct use of compiler alignof and typeof Tyler Retzlaff
2024-02-14 12:19 ` [PATCH v2 00/21] use C11 alignof David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1707849292-19519-11-git-send-email-roretzla@linux.microsoft.com \
--to=roretzla@linux.microsoft.com \
--cc=ajit.khaparde@broadcom.com \
--cc=andrew.rybchenko@oktetlabs.ru \
--cc=anoobj@marvell.com \
--cc=bruce.richardson@intel.com \
--cc=chaoyong.he@corigine.com \
--cc=chenbox@nvidia.com \
--cc=david.hunt@intel.com \
--cc=david.marchand@redhat.com \
--cc=dev@dpdk.org \
--cc=ferruh.yigit@amd.com \
--cc=gakhil@marvell.com \
--cc=harry.van.haaren@intel.com \
--cc=hemant.agrawal@nxp.com \
--cc=honnappa.nagarahalli@arm.com \
--cc=jbehrens@vmware.com \
--cc=jerinj@marvell.com \
--cc=jingjing.wu@intel.com \
--cc=john.mcnamara@intel.com \
--cc=kirankumark@marvell.com \
--cc=konstantin.v.ananyev@yandex.ru \
--cc=maxime.coquelin@redhat.com \
--cc=ndabilpuram@marvell.com \
--cc=nicolas.chautru@intel.com \
--cc=orika@nvidia.com \
--cc=pbhagavatula@marvell.com \
--cc=sachin.saxena@nxp.com \
--cc=somnath.kotur@broadcom.com \
--cc=thomas@monjalon.net \
--cc=vfialko@marvell.com \
--cc=zhirun.yan@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).