eventdev: do not use zero length arrays

Message ID 20240725171609.142344-1-stephen@networkplumber.org (mailing list archive)
State New
Delegated to: Jerin Jacob
Headers
Series eventdev: do not use zero length arrays |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/github-robot: build success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS
ci/intel-Functional success Functional PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-marvell-Functional success Functional Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-broadcom-Functional success Functional Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-unit-arm64-testing success Testing PASS
ci/iol-unit-amd64-testing success Testing PASS
ci/iol-compile-amd64-testing pending Testing pending
ci/iol-compile-arm64-testing success Testing PASS
ci/iol-sample-apps-testing success Testing PASS

Commit Message

Stephen Hemminger July 25, 2024, 5:15 p.m. UTC
Zero length array's are a GNU C extension and should be replaced
by use of flexible arrayrs. This has been fixed almost everywhere
in DPDK 24.07 but looks like some event code got missed.

Generated by devtools/cocci/zero_length_array.cocci

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/event/opdl/opdl_ring.c       | 2 +-
 drivers/event/sw/event_ring.h        | 2 +-
 lib/eventdev/rte_event_dma_adapter.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)
  

Patch

diff --git a/drivers/event/opdl/opdl_ring.c b/drivers/event/opdl/opdl_ring.c
index 6799ec996b..60991c4b03 100644
--- a/drivers/event/opdl/opdl_ring.c
+++ b/drivers/event/opdl/opdl_ring.c
@@ -119,7 +119,7 @@  struct opdl_ring {
 	/* Stages indexed by ID */
 	struct opdl_stage *stages;
 	/* Memory for storing slot data */
-	alignas(RTE_CACHE_LINE_SIZE) uint8_t slots[0];
+	alignas(RTE_CACHE_LINE_SIZE) uint8_t slots[];
 };
 
 
diff --git a/drivers/event/sw/event_ring.h b/drivers/event/sw/event_ring.h
index 29db267b77..35931888dd 100644
--- a/drivers/event/sw/event_ring.h
+++ b/drivers/event/sw/event_ring.h
@@ -27,7 +27,7 @@  struct rob_ring {
 	uint32_t size;
 	uint32_t write_idx;
 	uint32_t read_idx;
-	alignas(RTE_CACHE_LINE_SIZE) void *ring[0];
+	alignas(RTE_CACHE_LINE_SIZE) void *ring[];
 };
 
 static inline struct rob_ring *
diff --git a/lib/eventdev/rte_event_dma_adapter.h b/lib/eventdev/rte_event_dma_adapter.h
index 768390cd30..5c480b82ff 100644
--- a/lib/eventdev/rte_event_dma_adapter.h
+++ b/lib/eventdev/rte_event_dma_adapter.h
@@ -204,7 +204,7 @@  struct rte_event_dma_adapter_op {
 	/**< Number of source segments. */
 	uint16_t nb_dst;
 	/**< Number of destination segments. */
-	struct rte_dma_sge src_dst_seg[0];
+	struct rte_dma_sge src_dst_seg[];
 	/**< Source and destination segments. */
 };