DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix compiling issue of zero-size array
@ 2018-10-15  1:45 Jack Min
  2018-10-15  5:41 ` Shahaf Shuler
  0 siblings, 1 reply; 2+ messages in thread
From: Jack Min @ 2018-10-15  1:45 UTC (permalink / raw)
  To: Shahaf Shuler, Yongseok Koh; +Cc: dev

If the build environment hasn't 'linux/tc_act/tc_pedit.h',
compiler will use needed structs defined in mlx5_flow_tcf.c.

However, there is a zero-size array defined in one struct and
ISO C forbids this when -Wpedantic is set by debug mode.

Simply put __extension__ keyword before the struct in question.

Fixes: e696b2051c8c ("net/mlx5: rewrite IP address UDP/TCP port by E-Switch")

Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow_tcf.c | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/drivers/net/mlx5/mlx5_flow_tcf.c b/drivers/net/mlx5/mlx5_flow_tcf.c
index aaafaf52d..da4bc632d 100644
--- a/drivers/net/mlx5/mlx5_flow_tcf.c
+++ b/drivers/net/mlx5/mlx5_flow_tcf.c
@@ -93,19 +93,20 @@ enum pedit_cmd {
 };
 
 struct tc_pedit_key {
-	__u32           mask;  /* AND */
-	__u32           val;   /*XOR */
-	__u32           off;  /*offset */
-	__u32           at;
-	__u32           offmask;
-	__u32           shift;
+	__u32 mask; /* AND */
+	__u32 val; /*XOR */
+	__u32 off; /*offset */
+	__u32 at;
+	__u32 offmask;
+	__u32 shift;
 };
 
+__extension__
 struct tc_pedit_sel {
 	tc_gen;
-	unsigned char           nkeys;
-	unsigned char           flags;
-	struct tc_pedit_key     keys[0];
+	unsigned char nkeys;
+	unsigned char flags;
+	struct tc_pedit_key keys[0];
 };
 
 #endif /* HAVE_TC_ACT_VLAN */
-- 
2.17.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] net/mlx5: fix compiling issue of zero-size array
  2018-10-15  1:45 [dpdk-dev] [PATCH] net/mlx5: fix compiling issue of zero-size array Jack Min
@ 2018-10-15  5:41 ` Shahaf Shuler
  0 siblings, 0 replies; 2+ messages in thread
From: Shahaf Shuler @ 2018-10-15  5:41 UTC (permalink / raw)
  To: Jack Min, Yongseok Koh; +Cc: dev, Ferruh Yigit

Monday, October 15, 2018 4:45 AM, Jack Min:
> Subject: [PATCH] net/mlx5: fix compiling issue of zero-size array
> 
> If the build environment hasn't 'linux/tc_act/tc_pedit.h', compiler will use
> needed structs defined in mlx5_flow_tcf.c.
> 
> However, there is a zero-size array defined in one struct and ISO C forbids
> this when -Wpedantic is set by debug mode.
> 
> Simply put __extension__ keyword before the struct in question.
> 
> Fixes: e696b2051c8c ("net/mlx5: rewrite IP address UDP/TCP port by E-
> Switch")
> 
> Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>

Applied to next-net-mlx, thanks.

Ferruh, you will probably want to squash this to the relevant commit. 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-10-15  5:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-15  1:45 [dpdk-dev] [PATCH] net/mlx5: fix compiling issue of zero-size array Jack Min
2018-10-15  5:41 ` Shahaf Shuler

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).