[PATCH v2 4/4] app: examples: replace zero-length arrays with undimensioned ones

Bruce Richardson bruce.richardson at intel.com
Thu Jun 2 18:13:24 CEST 2022


This patch replaces instances of zero-sized arrays i.e. those at the end
of structures with "[0]" with the more standard syntax of "[]".
Replacement was done using coccinelle script, with some cleanup of
whitespace afterwards.

Signed-off-by: Bruce Richardson <bruce.richardson at intel.com>
Acked-by: Morten Brørup <mb at smartsharesystems.com>
Acked-by: Stephen Hemminger <stephen at networkplumber.org>
---
 app/test/test_table_tables.c   | 2 +-
 examples/ip_reassembly/main.c  | 2 +-
 examples/ptpclient/ptpclient.c | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/app/test/test_table_tables.c b/app/test/test_table_tables.c
index 010dd5a794..26908e6112 100644
--- a/app/test/test_table_tables.c
+++ b/app/test/test_table_tables.c
@@ -53,7 +53,7 @@ struct rte_bucket_4_8 {
 	uint64_t next_valid;
 	uint64_t key[4];
 	/* Cache line 1 */
-	uint8_t data[0];
+	uint8_t data[];
 };
 
 #if RTE_TABLE_HASH_LRU_STRATEGY == 3
diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c
index 6e4c11c3c7..3ebf895aa0 100644
--- a/examples/ip_reassembly/main.c
+++ b/examples/ip_reassembly/main.c
@@ -126,7 +126,7 @@ struct mbuf_table {
 	uint32_t len;
 	uint32_t head;
 	uint32_t tail;
-	struct rte_mbuf *m_table[0];
+	struct rte_mbuf *m_table[];
 };
 
 struct rx_queue {
diff --git a/examples/ptpclient/ptpclient.c b/examples/ptpclient/ptpclient.c
index de799f698b..1f1c9c9c52 100644
--- a/examples/ptpclient/ptpclient.c
+++ b/examples/ptpclient/ptpclient.c
@@ -90,7 +90,7 @@ struct sync_msg {
 struct follow_up_msg {
 	struct ptp_header   hdr;
 	struct tstamp       precise_origin_tstamp;
-	uint8_t             suffix[0];
+	uint8_t             suffix[];
 } __rte_packed;
 
 struct delay_req_msg {
@@ -102,7 +102,7 @@ struct delay_resp_msg {
 	struct ptp_header    hdr;
 	struct tstamp        rx_tstamp;
 	struct port_id       req_port_id;
-	uint8_t              suffix[0];
+	uint8_t              suffix[];
 } __rte_packed;
 
 struct ptp_message {
-- 
2.34.1



More information about the dev mailing list