All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: david.marchand@redhat.com,
	"Bruce Richardson" <bruce.richardson@intel.com>,
	"Morten Brørup" <mb@smartsharesystems.com>,
	"Stephen Hemminger" <stephen@networkplumber.org>,
	"Hemant Agrawal" <hemant.agrawal@nxp.com>
Subject: [PATCH v4 3/4] lib: replace zero-length arrays with undimensioned ones
Date: Fri,  3 Jun 2022 12:16:24 +0100	[thread overview]
Message-ID: <20220603111625.562070-4-bruce.richardson@intel.com> (raw)
In-Reply-To: <20220603111625.562070-1-bruce.richardson@intel.com>

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@intel.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
---
 lib/cryptodev/cryptodev_pmd.h          | 2 +-
 lib/cryptodev/rte_cryptodev.h          | 2 +-
 lib/eventdev/rte_event_timer_adapter.h | 2 +-
 lib/ip_frag/ip_reassembly.h            | 2 +-
 lib/ipsec/sa.h                         | 2 +-
 lib/rib/rte_rib.c                      | 2 +-
 lib/rib/rte_rib6.c                     | 2 +-
 lib/table/rte_swx_table_learner.c      | 4 ++--
 lib/table/rte_table_hash_key16.c       | 4 ++--
 lib/table/rte_table_hash_key32.c       | 4 ++--
 lib/table/rte_table_hash_key8.c        | 4 ++--
 lib/vhost/rte_vhost.h                  | 4 ++--
 12 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/lib/cryptodev/cryptodev_pmd.h b/lib/cryptodev/cryptodev_pmd.h
index 7a7d3ee3f1..3dcc3cb7ed 100644
--- a/lib/cryptodev/cryptodev_pmd.h
+++ b/lib/cryptodev/cryptodev_pmd.h
@@ -673,7 +673,7 @@ RTE_STD_C11 struct rte_cryptodev_asym_session {
 	uint8_t padding[3];
 	void *event_mdata;
 	/**< Event metadata (aka *union rte_event_crypto_metadata*) */
-	uint8_t sess_private_data[0];
+	uint8_t sess_private_data[];
 };
 
 #ifdef __cplusplus
diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h
index 585cee2727..56f459c6a0 100644
--- a/lib/cryptodev/rte_cryptodev.h
+++ b/lib/cryptodev/rte_cryptodev.h
@@ -918,7 +918,7 @@ struct rte_cryptodev_sym_session {
 	__extension__ struct {
 		void *data;
 		uint16_t refcnt;
-	} sess_data[0];
+	} sess_data[];
 	/**< Driver specific session material, variable size */
 };
 
diff --git a/lib/eventdev/rte_event_timer_adapter.h b/lib/eventdev/rte_event_timer_adapter.h
index 4c91e5516a..eab8e59a57 100644
--- a/lib/eventdev/rte_event_timer_adapter.h
+++ b/lib/eventdev/rte_event_timer_adapter.h
@@ -486,7 +486,7 @@ struct rte_event_timer {
 	 */
 	enum rte_event_timer_state state;
 	/**< State of the event timer. */
-	uint8_t user_meta[0];
+	uint8_t user_meta[];
 	/**< Memory to store user specific metadata.
 	 * The event timer adapter implementation should not modify this area.
 	 */
diff --git a/lib/ip_frag/ip_reassembly.h b/lib/ip_frag/ip_reassembly.h
index 416fb66dd4..ef9d8c0d75 100644
--- a/lib/ip_frag/ip_reassembly.h
+++ b/lib/ip_frag/ip_reassembly.h
@@ -83,7 +83,7 @@ struct rte_ip_frag_tbl {
 	struct ip_frag_pkt *last;     /* last used entry. */
 	struct ip_pkt_list lru;       /* LRU list for table entries. */
 	struct ip_frag_tbl_stat stat; /* statistics counters. */
-	__extension__ struct ip_frag_pkt pkt[0]; /* hash table. */
+	__extension__ struct ip_frag_pkt pkt[]; /* hash table. */
 };
 
 #endif /* _IP_REASSEMBLY_H_ */
diff --git a/lib/ipsec/sa.h b/lib/ipsec/sa.h
index 46f9a4df5b..ce4af8ceb2 100644
--- a/lib/ipsec/sa.h
+++ b/lib/ipsec/sa.h
@@ -59,7 +59,7 @@ union sym_op_data {
 struct replay_sqn {
 	rte_rwlock_t rwl;
 	uint64_t sqn;
-	__extension__ uint64_t window[0];
+	__extension__ uint64_t window[];
 };
 
 /*IPSEC SA supported algorithms */
diff --git a/lib/rib/rte_rib.c b/lib/rib/rte_rib.c
index f1fdddbbb4..b0794edf66 100644
--- a/lib/rib/rte_rib.c
+++ b/lib/rib/rte_rib.c
@@ -35,7 +35,7 @@ struct rte_rib_node {
 	uint8_t		depth;
 	uint8_t		flag;
 	uint64_t	nh;
-	__extension__ uint64_t	ext[0];
+	__extension__ uint64_t ext[];
 };
 
 struct rte_rib {
diff --git a/lib/rib/rte_rib6.c b/lib/rib/rte_rib6.c
index 650bf1b8f6..19e4ff97c4 100644
--- a/lib/rib/rte_rib6.c
+++ b/lib/rib/rte_rib6.c
@@ -34,7 +34,7 @@ struct rte_rib6_node {
 	uint8_t			ip[RTE_RIB6_IPV6_ADDR_SIZE];
 	uint8_t			depth;
 	uint8_t			flag;
-	__extension__ uint64_t		ext[0];
+	__extension__ uint64_t ext[];
 };
 
 struct rte_rib6 {
diff --git a/lib/table/rte_swx_table_learner.c b/lib/table/rte_swx_table_learner.c
index 222acfc962..f7f8e8aea9 100644
--- a/lib/table/rte_swx_table_learner.c
+++ b/lib/table/rte_swx_table_learner.c
@@ -252,7 +252,7 @@ struct table_bucket {
 	uint32_t sig[TABLE_KEYS_PER_BUCKET];
 	uint8_t key_timeout_id[TABLE_KEYS_PER_BUCKET];
 	uint8_t pad[TABLE_BUCKET_PAD_SIZE];
-	uint8_t key[0];
+	uint8_t key[];
 };
 
 struct table_params {
@@ -317,7 +317,7 @@ struct table {
 	uint8_t key_mask0[RTE_CACHE_LINE_SIZE];
 
 	/* Table buckets. */
-	uint8_t buckets[0];
+	uint8_t buckets[];
 } __rte_cache_aligned;
 
 /* The timeout (in cycles) is stored in the table as a 32-bit value by truncating its least
diff --git a/lib/table/rte_table_hash_key16.c b/lib/table/rte_table_hash_key16.c
index ea8195dc17..04d7fd64bd 100644
--- a/lib/table/rte_table_hash_key16.c
+++ b/lib/table/rte_table_hash_key16.c
@@ -43,7 +43,7 @@ struct rte_bucket_4_16 {
 	uint64_t key[4][2];
 
 	/* Cache line 2 */
-	uint8_t data[0];
+	uint8_t data[];
 };
 #else
 struct rte_bucket_4_16 {
@@ -58,7 +58,7 @@ struct rte_bucket_4_16 {
 	uint64_t key[4][2];
 
 	/* Cache line 2 */
-	uint8_t data[0];
+	uint8_t data[];
 };
 #endif
 
diff --git a/lib/table/rte_table_hash_key32.c b/lib/table/rte_table_hash_key32.c
index 87f83ce6f5..88d8f69c72 100644
--- a/lib/table/rte_table_hash_key32.c
+++ b/lib/table/rte_table_hash_key32.c
@@ -43,7 +43,7 @@ struct rte_bucket_4_32 {
 	uint64_t key[4][4];
 
 	/* Cache line 3 */
-	uint8_t data[0];
+	uint8_t data[];
 };
 #else
 struct rte_bucket_4_32 {
@@ -58,7 +58,7 @@ struct rte_bucket_4_32 {
 	uint64_t key[4][4];
 
 	/* Cache line 3 */
-	uint8_t data[0];
+	uint8_t data[];
 };
 #endif
 
diff --git a/lib/table/rte_table_hash_key8.c b/lib/table/rte_table_hash_key8.c
index 7779a9d1a3..035d242769 100644
--- a/lib/table/rte_table_hash_key8.c
+++ b/lib/table/rte_table_hash_key8.c
@@ -40,7 +40,7 @@ struct rte_bucket_4_8 {
 	uint64_t key[4];
 
 	/* Cache line 1 */
-	uint8_t data[0];
+	uint8_t data[];
 };
 #else
 struct rte_bucket_4_8 {
@@ -54,7 +54,7 @@ struct rte_bucket_4_8 {
 	uint64_t key[4];
 
 	/* Cache line 1 */
-	uint8_t data[0];
+	uint8_t data[];
 };
 #endif
 
diff --git a/lib/vhost/rte_vhost.h b/lib/vhost/rte_vhost.h
index c733f857c6..99be18ceef 100644
--- a/lib/vhost/rte_vhost.h
+++ b/lib/vhost/rte_vhost.h
@@ -154,7 +154,7 @@ struct rte_vhost_inflight_info_split {
 	uint16_t desc_num;
 	uint16_t last_inflight_io;
 	uint16_t used_idx;
-	struct rte_vhost_inflight_desc_split desc[0];
+	struct rte_vhost_inflight_desc_split desc[];
 };
 
 struct rte_vhost_inflight_desc_packed {
@@ -181,7 +181,7 @@ struct rte_vhost_inflight_info_packed {
 	uint8_t used_wrap_counter;
 	uint8_t old_used_wrap_counter;
 	uint8_t padding[7];
-	struct rte_vhost_inflight_desc_packed desc[0];
+	struct rte_vhost_inflight_desc_packed desc[];
 };
 
 struct rte_vhost_resubmit_desc {
-- 
2.34.1


  parent reply	other threads:[~2022-06-03 11:16 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-02 15:08 [PATCH 0/4] clean up zero-length arrays Bruce Richardson
2022-06-02 15:08 ` [PATCH 1/4] cocci: add script for zero-length arrays in structs Bruce Richardson
2022-06-02 15:08 ` [PATCH 2/4] drivers: replace zero-length arrays with undimensioned ones Bruce Richardson
2022-06-02 15:08 ` [PATCH 3/4] lib: " Bruce Richardson
2022-06-02 15:08 ` [PATCH 4/4] app: examples: " Bruce Richardson
2022-06-02 15:20 ` [PATCH 0/4] clean up zero-length arrays Morten Brørup
2022-06-02 15:35 ` Stephen Hemminger
2022-06-02 16:13 ` [PATCH v2 " Bruce Richardson
2022-06-02 16:13   ` [PATCH v2 1/4] cocci: add script for zero-length arrays in structs Bruce Richardson
2022-06-02 16:13   ` [PATCH v2 2/4] drivers: replace zero-length arrays with undimensioned ones Bruce Richardson
2022-06-03  7:19     ` David Marchand
2022-06-03  7:36       ` Bruce Richardson
2022-06-03  9:18       ` Bruce Richardson
2022-06-02 16:13   ` [PATCH v2 3/4] lib: " Bruce Richardson
2022-06-02 16:13   ` [PATCH v2 4/4] app: examples: " Bruce Richardson
2022-06-03  6:56   ` [PATCH v2 0/4] clean up zero-length arrays Hemant Agrawal
2022-06-03 10:13 ` [PATCH v3 " Bruce Richardson
2022-06-03 10:13   ` [PATCH v3 1/4] cocci: add script for zero-length arrays in structs Bruce Richardson
2022-06-03 10:30     ` Morten Brørup
2022-06-03 10:38       ` Bruce Richardson
2022-06-03 10:13   ` [PATCH v3 2/4] drivers: replace zero-length arrays with undimensioned ones Bruce Richardson
2022-06-03 10:13   ` [PATCH v3 3/4] lib: " Bruce Richardson
2022-06-03 10:13   ` [PATCH v3 4/4] app: examples: " Bruce Richardson
2022-06-03 11:13   ` [PATCH v3 0/4] clean up zero-length arrays Bruce Richardson
2022-06-03 11:16 ` [PATCH v4 " Bruce Richardson
2022-06-03 11:16   ` [PATCH v4 1/4] cocci: add script for zero-length arrays in structs Bruce Richardson
2022-06-03 11:16   ` [PATCH v4 2/4] drivers: replace zero-length arrays with undimensioned ones Bruce Richardson
2022-06-03 11:16   ` Bruce Richardson [this message]
2022-06-03 11:16   ` [PATCH v4 4/4] app: examples: " Bruce Richardson
2022-06-07 14:16   ` [PATCH v4 0/4] clean up zero-length arrays David Marchand
2022-06-09 15:19   ` Tyler Retzlaff
2022-06-08 15:23 ` [PATCH " Stephen Hemminger
2022-06-14  9:40   ` Bruce Richardson
2022-06-14  9:45     ` Bruce Richardson

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=20220603111625.562070-4-bruce.richardson@intel.com \
    --to=bruce.richardson@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=mb@smartsharesystems.com \
    --cc=stephen@networkplumber.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.