DPDK patches and discussions
 help / color / mirror / Atom feed
From: Adrien Mazarguil <adrien.mazarguil@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v4 03/10] lib: use C99 syntax for zero-size arrays
Date: Wed, 13 Jul 2016 15:02:40 +0200	[thread overview]
Message-ID: <ee00454352cddb078e5f685e9aa843bef7914457.1468413397.git.adrien.mazarguil@6wind.com> (raw)
In-Reply-To: <cover.1468413396.git.adrien.mazarguil@6wind.com>

Exported header files used by applications should allow the strictest
compiler flags. Language extensions used in many places must be explicitly
marked or removed to avoid warnings and compilation failures.

The extension keyword is used whenever the C99 syntax cannot do it.

This commit prevents the following errors:

 error: ISO C forbids zero-size array `[...]'

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 lib/librte_acl/rte_acl.h                                      | 2 +-
 lib/librte_cryptodev/rte_cryptodev.h                          | 2 +-
 lib/librte_cryptodev/rte_cryptodev_pmd.h                      | 2 +-
 lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h | 2 +-
 lib/librte_hash/rte_fbk_hash.h                                | 2 +-
 lib/librte_ip_frag/rte_ip_frag.h                              | 2 +-
 lib/librte_lpm/rte_lpm.h                                      | 2 +-
 lib/librte_mbuf/rte_mbuf.h                                    | 3 +++
 lib/librte_pipeline/rte_pipeline.h                            | 2 +-
 lib/librte_ring/rte_ring.h                                    | 2 +-
 lib/librte_sched/rte_bitmap.h                                 | 2 +-
 11 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/lib/librte_acl/rte_acl.h b/lib/librte_acl/rte_acl.h
index 0979a09..c059dc3 100644
--- a/lib/librte_acl/rte_acl.h
+++ b/lib/librte_acl/rte_acl.h
@@ -144,7 +144,7 @@ struct rte_acl_rule_data {
 	struct rte_acl_field field[fld_num];         \
 }
 
-RTE_ACL_RULE_DEF(rte_acl_rule, 0);
+RTE_ACL_RULE_DEF(rte_acl_rule,);
 
 #define	RTE_ACL_RULE_SZ(fld_num)	\
 	(sizeof(struct rte_acl_rule) + sizeof(struct rte_acl_field) * (fld_num))
diff --git a/lib/librte_cryptodev/rte_cryptodev.h b/lib/librte_cryptodev/rte_cryptodev.h
index affbdec..1e30a19 100644
--- a/lib/librte_cryptodev/rte_cryptodev.h
+++ b/lib/librte_cryptodev/rte_cryptodev.h
@@ -759,7 +759,7 @@ struct rte_cryptodev_sym_session {
 	} __rte_aligned(8);
 	/**< Public symmetric session details */
 
-	char _private[0];
+	char _private[];
 	/**< Private session material */
 };
 
diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h
index 7d049ea..3a3845c 100644
--- a/lib/librte_cryptodev/rte_cryptodev_pmd.h
+++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h
@@ -71,7 +71,7 @@ struct rte_cryptodev_session {
 		struct rte_mempool *mp;
 	} __rte_aligned(8);
 
-	char _private[0];
+	char _private[];
 };
 
 struct rte_cryptodev_driver;
diff --git a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
index 2acdfd9..7f458a3 100644
--- a/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
+++ b/lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h
@@ -102,7 +102,7 @@ struct rte_kni_fifo {
 	volatile unsigned read;      /**< Next position to be read */
 	unsigned len;                /**< Circular buffer length */
 	unsigned elem_size;          /**< Pointer size - for 32/64 bit OS */
-	void * volatile buffer[0];   /**< The buffer contains mbuf pointers */
+	void *volatile buffer[];     /**< The buffer contains mbuf pointers */
 };
 
 /*
diff --git a/lib/librte_hash/rte_fbk_hash.h b/lib/librte_hash/rte_fbk_hash.h
index a430961..bd46048 100644
--- a/lib/librte_hash/rte_fbk_hash.h
+++ b/lib/librte_hash/rte_fbk_hash.h
@@ -115,7 +115,7 @@ struct rte_fbk_hash_table {
 	uint32_t init_val;		/**< For initialising hash function. */
 
 	/** A flat table of all buckets. */
-	union rte_fbk_hash_entry t[0];
+	union rte_fbk_hash_entry t[];
 };
 
 /**
diff --git a/lib/librte_ip_frag/rte_ip_frag.h b/lib/librte_ip_frag/rte_ip_frag.h
index 92cedf2..4c3faad 100644
--- a/lib/librte_ip_frag/rte_ip_frag.h
+++ b/lib/librte_ip_frag/rte_ip_frag.h
@@ -124,7 +124,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. */
-	struct ip_frag_pkt pkt[0];        /**< hash table. */
+	struct ip_frag_pkt pkt[];         /**< hash table. */
 };
 
 /** IPv6 fragment extension header */
diff --git a/lib/librte_lpm/rte_lpm.h b/lib/librte_lpm/rte_lpm.h
index 2df1d67..79a4593 100644
--- a/lib/librte_lpm/rte_lpm.h
+++ b/lib/librte_lpm/rte_lpm.h
@@ -193,7 +193,7 @@ struct rte_lpm_v20 {
 			__rte_cache_aligned; /**< LPM tbl24 table. */
 	struct rte_lpm_tbl_entry_v20 tbl8[RTE_LPM_TBL8_NUM_ENTRIES]
 			__rte_cache_aligned; /**< LPM tbl8 table. */
-	struct rte_lpm_rule_v20 rules_tbl[0] \
+	struct rte_lpm_rule_v20 rules_tbl[]
 			__rte_cache_aligned; /**< LPM rules. */
 };
 
diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h
index 101485f..434ec31 100644
--- a/lib/librte_mbuf/rte_mbuf.h
+++ b/lib/librte_mbuf/rte_mbuf.h
@@ -756,8 +756,11 @@ const char *rte_get_tx_ol_flag_name(uint64_t mask);
 
 /* define a set of marker types that can be used to refer to set points in the
  * mbuf */
+__extension__
 typedef void    *MARKER[0];   /**< generic marker for a point in a structure */
+__extension__
 typedef uint8_t  MARKER8[0];  /**< generic marker with 1B alignment */
+__extension__
 typedef uint64_t MARKER64[0]; /**< marker that allows us to overwrite 8 bytes
                                * with a single assignment */
 
diff --git a/lib/librte_pipeline/rte_pipeline.h b/lib/librte_pipeline/rte_pipeline.h
index 84d1802..b0b4615 100644
--- a/lib/librte_pipeline/rte_pipeline.h
+++ b/lib/librte_pipeline/rte_pipeline.h
@@ -252,7 +252,7 @@ struct rte_pipeline_table_entry {
 		uint32_t table_id;
 	};
 	/** Start of table entry area for user defined actions and meta-data */
-	uint8_t action_data[0];
+	__extension__ uint8_t action_data[0];
 };
 
 /**
diff --git a/lib/librte_ring/rte_ring.h b/lib/librte_ring/rte_ring.h
index eb45e41..12874f7 100644
--- a/lib/librte_ring/rte_ring.h
+++ b/lib/librte_ring/rte_ring.h
@@ -179,7 +179,7 @@ struct rte_ring {
 	struct rte_ring_debug_stats stats[RTE_MAX_LCORE];
 #endif
 
-	void * ring[0] __rte_cache_aligned; /**< Memory space of ring starts here.
+	void *ring[] __rte_cache_aligned;   /**< Memory space of ring starts here.
 	                                     * not volatile so need to be careful
 	                                     * about compiler re-ordering */
 };
diff --git a/lib/librte_sched/rte_bitmap.h b/lib/librte_sched/rte_bitmap.h
index ff675c5..1b5df02 100644
--- a/lib/librte_sched/rte_bitmap.h
+++ b/lib/librte_sched/rte_bitmap.h
@@ -103,7 +103,7 @@ struct rte_bitmap {
 	uint32_t go2;     /**< Bitmap scan: Go/stop condition for current array2 cache line */
 
 	/* Storage space for array1 and array2 */
-	uint8_t memory[0];
+	uint8_t memory[];
 };
 
 static inline void
-- 
2.1.4

  parent reply	other threads:[~2016-07-13 13:03 UTC|newest]

Thread overview: 79+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-05 14:08 [dpdk-dev] [PATCH 00/10] Fix build errors related to exported headers Adrien Mazarguil
2016-04-05 14:08 ` [dpdk-dev] [PATCH 01/10] lib: add extension keyword to braced-groups within expressions Adrien Mazarguil
2016-04-05 14:08 ` [dpdk-dev] [PATCH 02/10] lib: add extension keyword to large enum values Adrien Mazarguil
2016-04-05 14:08 ` [dpdk-dev] [PATCH 03/10] lib: use C99 syntax for zero-size arrays Adrien Mazarguil
2016-04-05 14:08 ` [dpdk-dev] [PATCH 04/10] lib: add extension keyword to nonstandard bit-fields Adrien Mazarguil
2016-04-05 14:08 ` [dpdk-dev] [PATCH 05/10] lib: add extension keyword to structs with no members Adrien Mazarguil
2016-04-05 14:08 ` [dpdk-dev] [PATCH 06/10] lib: add extension keyword to unnamed structs/unions Adrien Mazarguil
2016-04-05 14:08 ` [dpdk-dev] [PATCH 07/10] lib: fix missing include dependencies Adrien Mazarguil
2016-04-05 20:23   ` [dpdk-dev] [dpdk-dev, " Jan Viktorin
2016-04-06  8:54     ` Adrien Mazarguil
2016-04-06 12:10       ` Jan Viktorin
2016-04-05 14:08 ` [dpdk-dev] [PATCH 08/10] lib: add extension keyword to forward reference to enum types Adrien Mazarguil
2016-04-05 14:08 ` [dpdk-dev] [PATCH 09/10] lib: remove named variadic macros in exported headers Adrien Mazarguil
2016-04-05 14:08 ` [dpdk-dev] [PATCH 10/10] lib: hide static functions that are never defined Adrien Mazarguil
2016-07-05 10:44 ` [dpdk-dev] [PATCH v2 00/11] Fix build errors related to exported headers Adrien Mazarguil
2016-07-05 10:44   ` [dpdk-dev] [PATCH v2 01/11] lib: work around braced-groups within expressions Adrien Mazarguil
2016-07-05 10:44   ` [dpdk-dev] [PATCH v2 02/11] lib: work around large enum values Adrien Mazarguil
2016-07-05 10:44   ` [dpdk-dev] [PATCH v2 03/11] lib: use C99 syntax for zero-size arrays Adrien Mazarguil
2016-07-05 10:44   ` [dpdk-dev] [PATCH v2 04/11] lib: work around nonstandard bit-fields Adrien Mazarguil
2016-07-05 10:44   ` [dpdk-dev] [PATCH v2 05/11] lib: work around structs with no members Adrien Mazarguil
2016-07-05 10:44   ` [dpdk-dev] [PATCH v2 06/11] lib: work around unnamed structs/unions Adrien Mazarguil
2016-07-05 10:44   ` [dpdk-dev] [PATCH v2 07/11] lib: add missing include dependencies Adrien Mazarguil
2016-07-05 10:44   ` [dpdk-dev] [PATCH v2 08/11] lib: work around forward reference to enum types Adrien Mazarguil
2016-07-05 10:44   ` [dpdk-dev] [PATCH v2 09/11] lib: remove named variadic macros in exported headers Adrien Mazarguil
2016-07-05 10:44   ` [dpdk-dev] [PATCH v2 10/11] lib: hide static functions never defined Adrien Mazarguil
2016-07-05 10:44   ` [dpdk-dev] [PATCH v2 11/11] scripts: check compilation of exported header files Adrien Mazarguil
2016-07-05 11:15   ` [dpdk-dev] [PATCH v2 00/11] Fix build errors related to exported headers Jan Viktorin
2016-07-05 11:35     ` Adrien Mazarguil
2016-07-05 11:27   ` Ferruh Yigit
2016-07-05 12:33     ` Thomas Monjalon
2016-07-05 12:37     ` Adrien Mazarguil
2016-07-06 16:34   ` Thomas Monjalon
2016-07-07 15:49   ` [dpdk-dev] [PATCH v3 " Adrien Mazarguil
2016-07-07 15:49     ` [dpdk-dev] [PATCH v3 01/11] lib: work around braced-groups within expressions Adrien Mazarguil
2016-07-07 15:49     ` [dpdk-dev] [PATCH v3 02/11] lib: work around large enum values Adrien Mazarguil
2016-07-07 15:49     ` [dpdk-dev] [PATCH v3 03/11] lib: use C99 syntax for zero-size arrays Adrien Mazarguil
2016-07-07 15:49     ` [dpdk-dev] [PATCH v3 04/11] lib: work around nonstandard bit-fields Adrien Mazarguil
2016-07-07 15:49     ` [dpdk-dev] [PATCH v3 05/11] lib: work around structs with no members Adrien Mazarguil
2016-07-07 15:49     ` [dpdk-dev] [PATCH v3 06/11] lib: work around unnamed structs/unions Adrien Mazarguil
2016-07-07 15:49     ` [dpdk-dev] [PATCH v3 07/11] lib: add missing include dependencies Adrien Mazarguil
2016-07-07 15:49     ` [dpdk-dev] [PATCH v3 08/11] lib: work around forward reference to enum types Adrien Mazarguil
2016-07-07 15:49     ` [dpdk-dev] [PATCH v3 09/11] lib: remove named variadic macros in exported headers Adrien Mazarguil
2016-07-07 15:49     ` [dpdk-dev] [PATCH v3 10/11] lib: hide static functions never defined Adrien Mazarguil
2016-07-07 15:49     ` [dpdk-dev] [PATCH v3 11/11] scripts: check compilation of exported header files Adrien Mazarguil
2016-07-07 18:33     ` [dpdk-dev] [PATCH v3 00/11] Fix build errors related to exported headers Wiles, Keith
2016-07-08  8:05       ` Adrien Mazarguil
2016-07-08  9:56         ` Ferruh Yigit
2016-07-08 14:15           ` Wiles, Keith
2016-07-08 14:35             ` Adrien Mazarguil
2016-07-08 14:45               ` Ferruh Yigit
2016-07-08 15:23                 ` Adrien Mazarguil
2016-07-13 13:02     ` [dpdk-dev] [PATCH v4 00/10] " Adrien Mazarguil
2016-07-13 13:02       ` [dpdk-dev] [PATCH v4 01/10] lib: work around braced-groups within expressions Adrien Mazarguil
2016-07-13 13:02       ` [dpdk-dev] [PATCH v4 02/10] lib: work around large enum values Adrien Mazarguil
2016-07-13 13:02       ` Adrien Mazarguil [this message]
2016-07-13 13:02       ` [dpdk-dev] [PATCH v4 04/10] lib: work around nonstandard bit-fields Adrien Mazarguil
2016-07-13 13:02       ` [dpdk-dev] [PATCH v4 05/10] lib: work around unnamed structs/unions Adrien Mazarguil
2016-07-13 13:02       ` [dpdk-dev] [PATCH v4 06/10] lib: add missing include dependencies Adrien Mazarguil
2016-07-13 13:02       ` [dpdk-dev] [PATCH v4 07/10] lib: work around forward reference to enum types Adrien Mazarguil
2016-07-13 13:02       ` [dpdk-dev] [PATCH v4 08/10] lib: remove named variadic macros in exported headers Adrien Mazarguil
2016-07-13 13:02       ` [dpdk-dev] [PATCH v4 09/10] lib: hide static functions never defined Adrien Mazarguil
2016-07-13 13:02       ` [dpdk-dev] [PATCH v4 10/10] scripts: check compilation of exported header files Adrien Mazarguil
2016-07-15 21:03       ` [dpdk-dev] [PATCH v4 00/10] Fix build errors related to exported headers Bruce Richardson
2016-07-18 10:47         ` Adrien Mazarguil
2016-07-20  9:55         ` Thomas Monjalon
2016-08-23 16:36       ` Thomas Monjalon
2016-09-08 12:39         ` Adrien Mazarguil
2016-09-08 12:25       ` [dpdk-dev] [PATCH v5 " Adrien Mazarguil
2016-09-08 12:25         ` [dpdk-dev] [PATCH v5 01/10] lib: work around braced-groups within expressions Adrien Mazarguil
2016-09-08 12:25         ` [dpdk-dev] [PATCH v5 02/10] lib: work around large enum values Adrien Mazarguil
2016-09-08 12:25         ` [dpdk-dev] [PATCH v5 03/10] lib: use C99 syntax for zero-size arrays Adrien Mazarguil
2016-09-08 12:25         ` [dpdk-dev] [PATCH v5 04/10] lib: work around nonstandard bit-fields Adrien Mazarguil
2016-09-08 12:25         ` [dpdk-dev] [PATCH v5 05/10] lib: work around unnamed structs/unions Adrien Mazarguil
2016-09-08 12:25         ` [dpdk-dev] [PATCH v5 06/10] lib: add missing include dependencies Adrien Mazarguil
2016-09-08 12:25         ` [dpdk-dev] [PATCH v5 07/10] lib: work around forward reference to enum types Adrien Mazarguil
2016-09-08 12:25         ` [dpdk-dev] [PATCH v5 08/10] lib: remove named variadic macros in exported headers Adrien Mazarguil
2016-09-08 12:25         ` [dpdk-dev] [PATCH v5 09/10] lib: hide static functions never defined Adrien Mazarguil
2016-09-08 12:25         ` [dpdk-dev] [PATCH v5 10/10] scripts: check compilation of exported header files Adrien Mazarguil
2016-09-13 13:38         ` [dpdk-dev] [PATCH v5 00/10] Fix build errors related to exported headers Thomas Monjalon

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=ee00454352cddb078e5f685e9aa843bef7914457.1468413397.git.adrien.mazarguil@6wind.com \
    --to=adrien.mazarguil@6wind.com \
    --cc=dev@dpdk.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).