Skip to contentSkip to conversation

eventdev: replace zero-length-array

PATCH In review Stephen Hemminger 2 participants 3 messages Oct 1, 2024 – Oct 3, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 eventdev: replace zero-length-array

Zero Length Array's (ZLA) are a Gcc extension, and standard Variable Length Array (VLA) should be used instead.

---
 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(-)
drivers/event/opdl/opdl_ring.c +1 -1
index 6799ec996b..60991c4b03 100644
@@ -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[];
 };
 
 
drivers/event/sw/event_ring.h +1 -1
index 29db267b77..35931888dd 100644
@@ -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 *
lib/eventdev/rte_event_dma_adapter.h +1 -1
index 768390cd30..5c480b82ff 100644
@@ -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. */
 };
 
Signature · 1 line
2.45.2
#2 lore raw
Quoted 6 lines · On Thu, 3 Oct 2024 21:29:55 +0530 Jerin Jacob <[email protected]> wrote:
Quoted 4 lines · Stephen Hemminger

Zero Length Array's (ZLA) are a Gcc extension, and standard Variable Length Array (VLA) should be used instead.

Quoted 7 lines
Quoted 1 line

Isn't this patch same
https://patches.dpdk.org/project/dpdk/patch/[email protected]/
? It is already merged.
Making this as "Not Applicable"

I ran the devtools/cocci/zero_length_array.cocci script against main branch.