replace zero-length arrays with flexible ones

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 revert and
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>
This commit is contained in:
Bruce Richardson 2022-06-03 12:16:23 +01:00 committed by David Marchand
parent beeed9d92a
commit 013b4c52c7
36 changed files with 52 additions and 52 deletions

View File

@ -53,7 +53,7 @@ struct rte_bucket_4_8 {
uint64_t next_valid; uint64_t next_valid;
uint64_t key[4]; uint64_t key[4];
/* Cache line 1 */ /* Cache line 1 */
uint8_t data[0]; uint8_t data[];
}; };
#if RTE_TABLE_HASH_LRU_STRATEGY == 3 #if RTE_TABLE_HASH_LRU_STRATEGY == 3

View File

@ -23,7 +23,7 @@ struct fm_eth_port_cfg {
struct netcfg_info { struct netcfg_info {
uint8_t num_ethports; uint8_t num_ethports;
/**< Number of ports */ /**< Number of ports */
struct fm_eth_port_cfg port_cfg[0]; struct fm_eth_port_cfg port_cfg[];
/**< Variable structure array of size num_ethports */ /**< Variable structure array of size num_ethports */
}; };
@ -38,7 +38,7 @@ struct interface_info {
struct netcfg_interface { struct netcfg_interface {
uint8_t numof_netcfg_interface; uint8_t numof_netcfg_interface;
uint8_t numof_fman_enabled_macless; uint8_t numof_fman_enabled_macless;
struct interface_info interface_info[0]; struct interface_info interface_info[];
}; };
/* pcd_file: FMC netpcd XML ("policy") file, that contains PCD information. /* pcd_file: FMC netpcd XML ("policy") file, that contains PCD information.

View File

@ -107,7 +107,7 @@ struct vmbus_bufring {
* Ring data starts here + RingDataStartOffset * Ring data starts here + RingDataStartOffset
* !!! DO NOT place any fields below this !!! * !!! DO NOT place any fields below this !!!
*/ */
uint8_t data[0]; uint8_t data[];
} __rte_packed; } __rte_packed;
/* /*
@ -140,7 +140,7 @@ vmbus_chanpkt_getlen(uint16_t pktlen)
struct vmbus_gpa_range { struct vmbus_gpa_range {
uint32_t len; uint32_t len;
uint32_t ofs; uint32_t ofs;
uint64_t page[0]; uint64_t page[];
} __rte_packed; } __rte_packed;
/* This is actually vmbus_gpa_range.gpa_page[1] */ /* This is actually vmbus_gpa_range.gpa_page[1] */

View File

@ -246,7 +246,7 @@ struct roc_se_buf_ptr {
/* IOV Pointer */ /* IOV Pointer */
struct roc_se_iov_ptr { struct roc_se_iov_ptr {
int buf_cnt; int buf_cnt;
struct roc_se_buf_ptr bufs[0]; struct roc_se_buf_ptr bufs[];
}; };
struct roc_se_fc_params { struct roc_se_fc_params {

View File

@ -32,7 +32,7 @@ struct dpaax_iovat_element {
struct dpaax_iova_table { struct dpaax_iova_table {
unsigned int count; /**< No. of blocks of contiguous physical pages */ unsigned int count; /**< No. of blocks of contiguous physical pages */
struct dpaax_iovat_element entries[0]; struct dpaax_iovat_element entries[];
}; };
/* Pointer to the table, which is common for DPAA/DPAA2 and only a single /* Pointer to the table, which is common for DPAA/DPAA2 and only a single

View File

@ -560,7 +560,7 @@ struct mlx5_umr_wqe {
struct mlx5_rdma_write_wqe { struct mlx5_rdma_write_wqe {
struct mlx5_wqe_cseg ctr; struct mlx5_wqe_cseg ctr;
struct mlx5_wqe_rseg rseg; struct mlx5_wqe_rseg rseg;
struct mlx5_wqe_dseg dseg[0]; struct mlx5_wqe_dseg dseg[];
} __rte_packed; } __rte_packed;
#ifdef PEDANTIC #ifdef PEDANTIC
@ -3479,7 +3479,7 @@ struct mlx5_ifc_qpc_pas_list_bits {
#endif #endif
struct mlx5_ifc_qpc_extension_and_pas_list_bits { struct mlx5_ifc_qpc_extension_and_pas_list_bits {
struct mlx5_ifc_qpc_extension_bits qpc_data_extension; struct mlx5_ifc_qpc_extension_bits qpc_data_extension;
u8 pas[0][0x40]; u8 pas[][0x40];
}; };
@ -3703,7 +3703,7 @@ struct mlx5_ifc_query_qp_out_bits {
u8 reserved_at_a0[0x20]; u8 reserved_at_a0[0x20];
struct mlx5_ifc_qpc_bits qpc; struct mlx5_ifc_qpc_bits qpc;
u8 reserved_at_800[0x80]; u8 reserved_at_800[0x80];
u8 pas[0][0x40]; u8 pas[][0x40];
}; };
#ifdef PEDANTIC #ifdef PEDANTIC
#pragma GCC diagnostic error "-Wpedantic" #pragma GCC diagnostic error "-Wpedantic"
@ -3743,7 +3743,7 @@ struct mlx5_ifc_access_register_out_bits {
u8 reserved_at_8[0x18]; u8 reserved_at_8[0x18];
u8 syndrome[0x20]; u8 syndrome[0x20];
u8 reserved_at_40[0x40]; u8 reserved_at_40[0x40];
u8 register_data[0][0x20]; u8 register_data[][0x20];
}; };
struct mlx5_ifc_access_register_in_bits { struct mlx5_ifc_access_register_in_bits {
@ -3754,7 +3754,7 @@ struct mlx5_ifc_access_register_in_bits {
u8 reserved_at_40[0x10]; u8 reserved_at_40[0x10];
u8 register_id[0x10]; u8 register_id[0x10];
u8 argument[0x20]; u8 argument[0x20];
u8 register_data[0][0x20]; u8 register_data[][0x20];
}; };
#ifdef PEDANTIC #ifdef PEDANTIC
#pragma GCC diagnostic error "-Wpedantic" #pragma GCC diagnostic error "-Wpedantic"

View File

@ -120,7 +120,7 @@ struct ipsec_mb_dev_private {
/**< PMD type */ /**< PMD type */
uint32_t max_nb_queue_pairs; uint32_t max_nb_queue_pairs;
/**< Max number of queue pairs supported by device */ /**< Max number of queue pairs supported by device */
__extension__ uint8_t priv[0]; __extension__ uint8_t priv[];
}; };
/** IPSEC Multi buffer queue pair common queue pair data for all PMDs */ /** IPSEC Multi buffer queue pair common queue pair data for all PMDs */
@ -147,7 +147,7 @@ struct ipsec_mb_qp {
/* Multi buffer manager */ /* Multi buffer manager */
const struct rte_memzone *mb_mgr_mz; const struct rte_memzone *mb_mgr_mz;
/* Shared memzone for storing mb_mgr */ /* Shared memzone for storing mb_mgr */
__extension__ uint8_t additional_data[0]; __extension__ uint8_t additional_data[];
/**< Storing PMD specific additional data */ /**< Storing PMD specific additional data */
}; };

View File

@ -40,7 +40,7 @@ struct vring_desc {
struct vring_avail { struct vring_avail {
uint16_t flags; uint16_t flags;
uint16_t idx; uint16_t idx;
uint16_t ring[0]; uint16_t ring[];
}; };
/* id is a 16bit index. uint32_t is used here for ids for padding reasons. */ /* id is a 16bit index. uint32_t is used here for ids for padding reasons. */
@ -54,7 +54,7 @@ struct vring_used_elem {
struct vring_used { struct vring_used {
uint16_t flags; uint16_t flags;
volatile uint16_t idx; volatile uint16_t idx;
struct vring_used_elem ring[0]; struct vring_used_elem ring[];
}; };
struct vring { struct vring {

View File

@ -88,7 +88,7 @@ struct virtqueue {
uint16_t *notify_addr; uint16_t *notify_addr;
struct vq_desc_extra vq_descx[0]; struct vq_desc_extra vq_descx[];
}; };
/** /**

View File

@ -334,7 +334,7 @@ struct offload_info {
struct offload_port_info ports; struct offload_port_info ports;
struct offload_ka_info kas; struct offload_ka_info kas;
struct offload_rr_info rrs; struct offload_rr_info rrs;
u8 buf[0]; u8 buf[];
} __rte_packed; } __rte_packed;
struct smbus_request { struct smbus_request {

View File

@ -20,7 +20,7 @@ struct clip_tbl {
unsigned int clipt_start; /* start index of CLIP table */ unsigned int clipt_start; /* start index of CLIP table */
unsigned int clipt_size; /* size of CLIP table */ unsigned int clipt_size; /* size of CLIP table */
rte_rwlock_t lock; /* table rw lock */ rte_rwlock_t lock; /* table rw lock */
struct clip_entry cl_list[0]; /* MUST BE LAST */ struct clip_entry cl_list[]; /* MUST BE LAST */
}; };
struct clip_tbl *t4_init_clip_tbl(unsigned int clipt_start, struct clip_tbl *t4_init_clip_tbl(unsigned int clipt_start,

View File

@ -37,7 +37,7 @@ struct l2t_data {
unsigned int l2t_start; /* start index of our piece of the L2T */ unsigned int l2t_start; /* start index of our piece of the L2T */
unsigned int l2t_size; /* number of entries in l2tab */ unsigned int l2t_size; /* number of entries in l2tab */
rte_rwlock_t lock; /* table rw lock */ rte_rwlock_t lock; /* table rw lock */
struct l2t_entry l2tab[0]; /* MUST BE LAST */ struct l2t_entry l2tab[]; /* MUST BE LAST */
}; };
#define L2T_LPBK true #define L2T_LPBK true

View File

@ -41,7 +41,7 @@ struct mpstcam_table {
* free_idx cannot alone determine * free_idx cannot alone determine
* if the table is full * if the table is full
*/ */
struct mps_tcam_entry entry[0]; struct mps_tcam_entry entry[];
}; };
struct mpstcam_table *t4_init_mpstcam(struct adapter *adap); struct mpstcam_table *t4_init_mpstcam(struct adapter *adap);

View File

@ -31,7 +31,7 @@ struct smt_data {
unsigned int smt_size; unsigned int smt_size;
unsigned int smt_start; unsigned int smt_start;
rte_rwlock_t lock; rte_rwlock_t lock;
struct smt_entry smtab[0]; struct smt_entry smtab[];
}; };
struct smt_data *t4_init_smt(u32 smt_start_idx, u32 smt_size); struct smt_data *t4_init_smt(u32 smt_start_idx, u32 smt_size);

View File

@ -997,7 +997,7 @@ enum {
struct filter_tlv { struct filter_tlv {
uint32_t type; uint32_t type;
uint32_t length; uint32_t length;
uint32_t val[0]; uint32_t val[];
}; };
/* Data for CMD_ADD_FILTER is 2 TLV and filter + action structs */ /* Data for CMD_ADD_FILTER is 2 TLV and filter + action structs */

View File

@ -81,7 +81,7 @@ struct hinic_sq_wqe {
struct hinic_sq_task task; struct hinic_sq_task task;
/* sq sge section start address, 1~127 sges */ /* sq sge section start address, 1~127 sges */
struct hinic_sq_bufdesc buf_descs[0]; struct hinic_sq_bufdesc buf_descs[];
}; };
struct hinic_txq_stats { struct hinic_txq_stats {

View File

@ -224,7 +224,7 @@ struct nfp_eth_table {
int is_split; int is_split;
unsigned int fec_modes_supported; unsigned int fec_modes_supported;
} ports[0]; } ports[];
}; };
struct nfp_eth_table *nfp_eth_read_ports(struct nfp_cpp *cpp); struct nfp_eth_table *nfp_eth_read_ports(struct nfp_cpp *cpp);

View File

@ -46,7 +46,7 @@ struct vring_desc {
struct vring_avail { struct vring_avail {
uint16_t flags; uint16_t flags;
uint16_t idx; uint16_t idx;
uint16_t ring[0]; uint16_t ring[];
}; };
/* id is a 16bit index. uint32_t is used here for ids for padding reasons. */ /* id is a 16bit index. uint32_t is used here for ids for padding reasons. */
@ -60,7 +60,7 @@ struct vring_used_elem {
struct vring_used { struct vring_used {
uint16_t flags; uint16_t flags;
uint16_t idx; uint16_t idx;
struct vring_used_elem ring[0]; struct vring_used_elem ring[];
}; };
/* For support of packed virtqueues in Virtio 1.1 the format of descriptors /* For support of packed virtqueues in Virtio 1.1 the format of descriptors

View File

@ -22,7 +22,7 @@ struct vhost_kernel_data {
struct vhost_memory_kernel { struct vhost_memory_kernel {
uint32_t nregions; uint32_t nregions;
uint32_t padding; uint32_t padding;
struct vhost_memory_region regions[0]; struct vhost_memory_region regions[];
}; };
/* vhost kernel ioctls */ /* vhost kernel ioctls */

View File

@ -70,7 +70,7 @@ struct vhost_iotlb_msg {
struct vhost_vdpa_config { struct vhost_vdpa_config {
uint32_t off; uint32_t off;
uint32_t len; uint32_t len;
uint8_t buf[0]; uint8_t buf[];
}; };
struct vhost_msg { struct vhost_msg {

View File

@ -309,7 +309,7 @@ struct virtqueue {
uint16_t *notify_addr; uint16_t *notify_addr;
struct rte_mbuf **sw_ring; /**< RX software ring. */ struct rte_mbuf **sw_ring; /**< RX software ring. */
struct vq_desc_extra vq_descx[0]; struct vq_desc_extra vq_descx[];
}; };
/* If multiqueue is provided by host, then we support it. */ /* If multiqueue is provided by host, then we support it. */

View File

@ -64,7 +64,7 @@ struct mlx5_rxp_match_tuple {
struct mlx5_rxp_response { struct mlx5_rxp_response {
struct mlx5_rxp_response_desc header; struct mlx5_rxp_response_desc header;
struct mlx5_rxp_match_tuple matches[0]; struct mlx5_rxp_match_tuple matches[];
}; };
#define MLX5_RXP_MAX_MATCHES 254 #define MLX5_RXP_MAX_MATCHES 254
@ -114,7 +114,7 @@ struct mlx5_rxp_rof {
struct mlx5_rxp_ctl_rules_pgm { struct mlx5_rxp_ctl_rules_pgm {
struct mlx5_rxp_ctl_hdr hdr; struct mlx5_rxp_ctl_hdr hdr;
uint32_t count; uint32_t count;
struct mlx5_rxp_rof_entry rules[0]; struct mlx5_rxp_rof_entry rules[];
} __rte_packed; } __rte_packed;
/* RXP programming mode setting. */ /* RXP programming mode setting. */

View File

@ -126,7 +126,7 @@ struct mbuf_table {
uint32_t len; uint32_t len;
uint32_t head; uint32_t head;
uint32_t tail; uint32_t tail;
struct rte_mbuf *m_table[0]; struct rte_mbuf *m_table[];
}; };
struct rx_queue { struct rx_queue {

View File

@ -90,7 +90,7 @@ struct sync_msg {
struct follow_up_msg { struct follow_up_msg {
struct ptp_header hdr; struct ptp_header hdr;
struct tstamp precise_origin_tstamp; struct tstamp precise_origin_tstamp;
uint8_t suffix[0]; uint8_t suffix[];
} __rte_packed; } __rte_packed;
struct delay_req_msg { struct delay_req_msg {
@ -102,7 +102,7 @@ struct delay_resp_msg {
struct ptp_header hdr; struct ptp_header hdr;
struct tstamp rx_tstamp; struct tstamp rx_tstamp;
struct port_id req_port_id; struct port_id req_port_id;
uint8_t suffix[0]; uint8_t suffix[];
} __rte_packed; } __rte_packed;
struct ptp_message { struct ptp_message {

View File

@ -673,7 +673,7 @@ RTE_STD_C11 struct rte_cryptodev_asym_session {
uint8_t padding[3]; uint8_t padding[3];
void *event_mdata; void *event_mdata;
/**< Event metadata (aka *union rte_event_crypto_metadata*) */ /**< Event metadata (aka *union rte_event_crypto_metadata*) */
uint8_t sess_private_data[0]; uint8_t sess_private_data[];
}; };
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -918,7 +918,7 @@ struct rte_cryptodev_sym_session {
__extension__ struct { __extension__ struct {
void *data; void *data;
uint16_t refcnt; uint16_t refcnt;
} sess_data[0]; } sess_data[];
/**< Driver specific session material, variable size */ /**< Driver specific session material, variable size */
}; };

View File

@ -486,7 +486,7 @@ struct rte_event_timer {
*/ */
enum rte_event_timer_state state; enum rte_event_timer_state state;
/**< State of the event timer. */ /**< State of the event timer. */
uint8_t user_meta[0]; uint8_t user_meta[];
/**< Memory to store user specific metadata. /**< Memory to store user specific metadata.
* The event timer adapter implementation should not modify this area. * The event timer adapter implementation should not modify this area.
*/ */

View File

@ -83,7 +83,7 @@ struct rte_ip_frag_tbl {
struct ip_frag_pkt *last; /* last used entry. */ struct ip_frag_pkt *last; /* last used entry. */
struct ip_pkt_list lru; /* LRU list for table entries. */ struct ip_pkt_list lru; /* LRU list for table entries. */
struct ip_frag_tbl_stat stat; /* statistics counters. */ 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_ */ #endif /* _IP_REASSEMBLY_H_ */

View File

@ -59,7 +59,7 @@ union sym_op_data {
struct replay_sqn { struct replay_sqn {
rte_rwlock_t rwl; rte_rwlock_t rwl;
uint64_t sqn; uint64_t sqn;
__extension__ uint64_t window[0]; __extension__ uint64_t window[];
}; };
/*IPSEC SA supported algorithms */ /*IPSEC SA supported algorithms */

View File

@ -35,7 +35,7 @@ struct rte_rib_node {
uint8_t depth; uint8_t depth;
uint8_t flag; uint8_t flag;
uint64_t nh; uint64_t nh;
__extension__ uint64_t ext[0]; __extension__ uint64_t ext[];
}; };
struct rte_rib { struct rte_rib {

View File

@ -34,7 +34,7 @@ struct rte_rib6_node {
uint8_t ip[RTE_RIB6_IPV6_ADDR_SIZE]; uint8_t ip[RTE_RIB6_IPV6_ADDR_SIZE];
uint8_t depth; uint8_t depth;
uint8_t flag; uint8_t flag;
__extension__ uint64_t ext[0]; __extension__ uint64_t ext[];
}; };
struct rte_rib6 { struct rte_rib6 {

View File

@ -252,7 +252,7 @@ struct table_bucket {
uint32_t sig[TABLE_KEYS_PER_BUCKET]; uint32_t sig[TABLE_KEYS_PER_BUCKET];
uint8_t key_timeout_id[TABLE_KEYS_PER_BUCKET]; uint8_t key_timeout_id[TABLE_KEYS_PER_BUCKET];
uint8_t pad[TABLE_BUCKET_PAD_SIZE]; uint8_t pad[TABLE_BUCKET_PAD_SIZE];
uint8_t key[0]; uint8_t key[];
}; };
struct table_params { struct table_params {
@ -317,7 +317,7 @@ struct table {
uint8_t key_mask0[RTE_CACHE_LINE_SIZE]; uint8_t key_mask0[RTE_CACHE_LINE_SIZE];
/* Table buckets. */ /* Table buckets. */
uint8_t buckets[0]; uint8_t buckets[];
} __rte_cache_aligned; } __rte_cache_aligned;
/* The timeout (in cycles) is stored in the table as a 32-bit value by truncating its least /* The timeout (in cycles) is stored in the table as a 32-bit value by truncating its least

View File

@ -43,7 +43,7 @@ struct rte_bucket_4_16 {
uint64_t key[4][2]; uint64_t key[4][2];
/* Cache line 2 */ /* Cache line 2 */
uint8_t data[0]; uint8_t data[];
}; };
#else #else
struct rte_bucket_4_16 { struct rte_bucket_4_16 {
@ -58,7 +58,7 @@ struct rte_bucket_4_16 {
uint64_t key[4][2]; uint64_t key[4][2];
/* Cache line 2 */ /* Cache line 2 */
uint8_t data[0]; uint8_t data[];
}; };
#endif #endif

View File

@ -43,7 +43,7 @@ struct rte_bucket_4_32 {
uint64_t key[4][4]; uint64_t key[4][4];
/* Cache line 3 */ /* Cache line 3 */
uint8_t data[0]; uint8_t data[];
}; };
#else #else
struct rte_bucket_4_32 { struct rte_bucket_4_32 {
@ -58,7 +58,7 @@ struct rte_bucket_4_32 {
uint64_t key[4][4]; uint64_t key[4][4];
/* Cache line 3 */ /* Cache line 3 */
uint8_t data[0]; uint8_t data[];
}; };
#endif #endif

View File

@ -40,7 +40,7 @@ struct rte_bucket_4_8 {
uint64_t key[4]; uint64_t key[4];
/* Cache line 1 */ /* Cache line 1 */
uint8_t data[0]; uint8_t data[];
}; };
#else #else
struct rte_bucket_4_8 { struct rte_bucket_4_8 {
@ -54,7 +54,7 @@ struct rte_bucket_4_8 {
uint64_t key[4]; uint64_t key[4];
/* Cache line 1 */ /* Cache line 1 */
uint8_t data[0]; uint8_t data[];
}; };
#endif #endif

View File

@ -158,7 +158,7 @@ struct rte_vhost_inflight_info_split {
uint16_t desc_num; uint16_t desc_num;
uint16_t last_inflight_io; uint16_t last_inflight_io;
uint16_t used_idx; 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 { struct rte_vhost_inflight_desc_packed {
@ -185,7 +185,7 @@ struct rte_vhost_inflight_info_packed {
uint8_t used_wrap_counter; uint8_t used_wrap_counter;
uint8_t old_used_wrap_counter; uint8_t old_used_wrap_counter;
uint8_t padding[7]; uint8_t padding[7];
struct rte_vhost_inflight_desc_packed desc[0]; struct rte_vhost_inflight_desc_packed desc[];
}; };
struct rte_vhost_resubmit_desc { struct rte_vhost_resubmit_desc {