From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f53.google.com (mail-wm0-f53.google.com [74.125.82.53]) by dpdk.org (Postfix) with ESMTP id 9274E2C6E for ; Tue, 5 Apr 2016 16:08:32 +0200 (CEST) Received: by mail-wm0-f53.google.com with SMTP id f198so33850117wme.0 for ; Tue, 05 Apr 2016 07:08:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3ybVAX2WMy7S7pGhhqlgWcKLZkdFQ+PffimV4Qmfe1s=; b=tHM+yXop/tmpCD+I59roNLI+6pwwKh9e46Mu+jyiyG6UqfUfPD7HtUcy1bmWN0JBs4 18KLjb7RADteUg43rWOLBpoE2HktCZGAKob7O0GuuHUET/FG4zbEFY2j4ZOf3u2aJk0T QiNQjw6bkuz/YjBLLlZjHhh4GYuLtVAy4OW5N1Rb1JzhTuQYeuOz219Vw7ZmIcUhq/+3 5MvObzk4L9Gx/W0LXrvifdIzaoCjbvImL1+meEyst/RYXYgisuB/l/22BMOcXeu/eUC0 8a1OY6U89pAoPMlwXCEbaqUiSyblZVsxdr+Yp8qk6I73NuHSE1cXBj503pIEQp/axtpB vTvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3ybVAX2WMy7S7pGhhqlgWcKLZkdFQ+PffimV4Qmfe1s=; b=iLI8bXYHmPCSShyz6vvvWhzqMhhg/DyoC7QTYpCA9G/Q/TFrBKsMkG35vGQj8zANoH 5JZMEzeD4QZI9RCA4OFqzX5KR0M5nhllRdWfLpGRCY9YSGDuEpBC33mDTjsUI77U5hqI 2UkWObMEVRu9pg8GDS6Ie07VRa2tS9eHdpa1De8+gC68vP4P9k8/wDHGAT3CPSXj0l7H Scs6yyDQ6ExyvmMmmfPSG1D6vVhcP2RQxuViYXyFmQdewrSbe0TPoNrr0XW8lAxPlfoQ t7o3gaQ2KvkwEwB1taep2LrI+cClLWjSzWthvWIwNhqltWHDnyp5QE4mTf+V8zxen/VM Z8RQ== X-Gm-Message-State: AD7BkJK8yhClvIWJQ/h8vhl7l6py9dityHAD7M9uiJUzi1UA9GkPF1adTK7fmtUqOC/2FXvc X-Received: by 10.194.2.225 with SMTP id 1mr9264347wjx.29.1459865312440; Tue, 05 Apr 2016 07:08:32 -0700 (PDT) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id c144sm19685991wmd.0.2016.04.05.07.08.31 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 05 Apr 2016 07:08:31 -0700 (PDT) From: Adrien Mazarguil To: dev@dpdk.org Cc: Bruce Richardson , Thomas Monjalon Date: Tue, 5 Apr 2016 16:08:03 +0200 Message-Id: <1459865290-10248-4-git-send-email-adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1459865290-10248-1-git-send-email-adrien.mazarguil@6wind.com> References: <1459865290-10248-1-git-send-email-adrien.mazarguil@6wind.com> Subject: [dpdk-dev] [PATCH 03/10] lib: use C99 syntax for zero-size arrays X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Apr 2016 14:08:33 -0000 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 --- 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 +- lib/librte_vhost/rte_virtio_net.h | 2 +- 12 files changed, 14 insertions(+), 11 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 b599c95..ba6042d 100644 --- a/lib/librte_cryptodev/rte_cryptodev.h +++ b/lib/librte_cryptodev/rte_cryptodev.h @@ -846,7 +846,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 7e5e598..994ec47 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..4397f5d 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 75a227d..bad349a 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -723,8 +723,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..7736945 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]; + uint8_t action_data[]; }; /** 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 diff --git a/lib/librte_vhost/rte_virtio_net.h b/lib/librte_vhost/rte_virtio_net.h index 600b20b..cf33100 100644 --- a/lib/librte_vhost/rte_virtio_net.h +++ b/lib/librte_vhost/rte_virtio_net.h @@ -167,7 +167,7 @@ struct virtio_memory { uint64_t mapped_address; /**< Mapped address of memory file base in our applications memory space. */ uint64_t mapped_size; /**< Total size of memory file. */ uint32_t nregions; /**< Number of memory regions. */ - struct virtio_memory_regions regions[0]; /**< Memory region information. */ + struct virtio_memory_regions regions[]; /**< Memory region information. */ }; /** -- 2.1.4