[4/6] net/mlx: fix build with make and recent gcc

Message ID 20190812230358.988-5-thomas@monjalon.net (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers
Series build system improvements |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation fail Compilation issues

Commit Message

Thomas Monjalon Aug. 12, 2019, 11:03 p.m. UTC
  With VERBOSE=1, this error was seen in debug mode with gcc 9.1:

In file included from /tmp/dpdk.auto-config-h.sh.c.w0VWMi:1:
In file included from rdma-core/build/include/infiniband/mlx5dv.h:47:
In file included from rdma-core/build/include/infiniband/verbs.h:46:
In file included from rdma-core/build/include/infiniband/verbs_api.h:66:
In file included from rdma-core/build/include/infiniband/ib_user_ioctl_verbs.h:38:
include/rdma/ib_user_verbs.h:161:28: fatal error:
zero size arrays are an extension [-Wzero-length-array]
__aligned_u64 driver_data0;
^
1 error generated.

As a result, buildtools/auto-config-h.sh was not generating
a correct autoconf file, so the compilation was generating such error:

fatal error: redefinition of 'mlx5_ib_uapi_flow_action_packet_reformat_type'

It is fixed by disabling -pedantic option when calling auto-config-h.sh
from the makefile-based system.

Cc: adrien.mazarguil@6wind.com
Cc: stable@dpdk.org

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 drivers/net/mlx4/Makefile | 3 ++-
 drivers/net/mlx5/Makefile | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
  

Comments

Luca Boccassi Aug. 13, 2019, 9:39 a.m. UTC | #1
On Tue, 2019-08-13 at 01:03 +0200, Thomas Monjalon wrote:
> With VERBOSE=1, this error was seen in debug mode with gcc 9.1:
> 
> In file included from /tmp/dpdk.auto-config-h.sh.c.w0VWMi:1:
> In file included from rdma-core/build/include/infiniband/mlx5dv.h:47:
> In file included from rdma-core/build/include/infiniband/verbs.h:46:
> In file included from rdma-
> core/build/include/infiniband/verbs_api.h:66:
> In file included from rdma-
> core/build/include/infiniband/ib_user_ioctl_verbs.h:38:
> include/rdma/ib_user_verbs.h:161:28: fatal error:
> zero size arrays are an extension [-Wzero-length-array]
> __aligned_u64 driver_data0;
> ^
> 1 error generated.
> 
> As a result, buildtools/auto-config-h.sh was not generating
> a correct autoconf file, so the compilation was generating such
> error:
> 
> fatal error: redefinition of
> 'mlx5_ib_uapi_flow_action_packet_reformat_type'
> 
> It is fixed by disabling -pedantic option when calling auto-config-
> h.sh
> from the makefile-based system.
> 
> Cc: 
> adrien.mazarguil@6wind.com
> 
> Cc: 
> stable@dpdk.org
> 
> 
> Signed-off-by: Thomas Monjalon <
> thomas@monjalon.net
> >

Acked-by: Luca Boccassi <bluca@debian.org>
  
Matan Azrad Aug. 14, 2019, 10:19 a.m. UTC | #2
From: Thomas Monjalon <thomas@monjalon.net>
> With VERBOSE=1, this error was seen in debug mode with gcc 9.1:
> 
> In file included from /tmp/dpdk.auto-config-h.sh.c.w0VWMi:1:
> In file included from rdma-core/build/include/infiniband/mlx5dv.h:47:
> In file included from rdma-core/build/include/infiniband/verbs.h:46:
> In file included from rdma-core/build/include/infiniband/verbs_api.h:66:
> In file included from rdma-
> core/build/include/infiniband/ib_user_ioctl_verbs.h:38:
> include/rdma/ib_user_verbs.h:161:28: fatal error:
> zero size arrays are an extension [-Wzero-length-array]
> __aligned_u64 driver_data0;
> ^
> 1 error generated.
> 
> As a result, buildtools/auto-config-h.sh was not generating a correct
> autoconf file, so the compilation was generating such error:
> 
> fatal error: redefinition of
> 'mlx5_ib_uapi_flow_action_packet_reformat_type'
> 
> It is fixed by disabling -pedantic option when calling auto-config-h.sh from
> the makefile-based system.
> 
> Cc: adrien.mazarguil@6wind.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Matan Azrad <matan@mellanox.com>

Consider to create more patches to cleanup the compiler commands to ignore pedantic in the code.

Matan
  

Patch

diff --git a/drivers/net/mlx4/Makefile b/drivers/net/mlx4/Makefile
index 8126b0dfc..25d7c7555 100644
--- a/drivers/net/mlx4/Makefile
+++ b/drivers/net/mlx4/Makefile
@@ -68,6 +68,7 @@  endif
 # User-defined CFLAGS.
 ifeq ($(CONFIG_RTE_LIBRTE_MLX4_DEBUG),y)
 CFLAGS += -pedantic -UNDEBUG -DPEDANTIC
+AUTO_CONFIG_CFLAGS += -Wno-pedantic
 else
 CFLAGS += -DNDEBUG -UPEDANTIC
 endif
@@ -77,7 +78,7 @@  include $(RTE_SDK)/mk/rte.lib.mk
 # Generate and clean-up mlx4_autoconf.h.
 
 export CC CFLAGS CPPFLAGS EXTRA_CFLAGS EXTRA_CPPFLAGS
-export AUTO_CONFIG_CFLAGS = -Wno-error
+export AUTO_CONFIG_CFLAGS += -Wno-error
 
 ifndef V
 AUTOCONF_OUTPUT := >/dev/null
diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile
index dbb2a4e80..299cf3afe 100644
--- a/drivers/net/mlx5/Makefile
+++ b/drivers/net/mlx5/Makefile
@@ -83,6 +83,7 @@  endif
 # User-defined CFLAGS.
 ifeq ($(CONFIG_RTE_LIBRTE_MLX5_DEBUG),y)
 CFLAGS += -pedantic -UNDEBUG -DPEDANTIC
+AUTO_CONFIG_CFLAGS += -Wno-pedantic
 else
 CFLAGS += -DNDEBUG -UPEDANTIC
 endif
@@ -92,7 +93,7 @@  include $(RTE_SDK)/mk/rte.lib.mk
 # Generate and clean-up mlx5_autoconf.h.
 
 export CC CFLAGS CPPFLAGS EXTRA_CFLAGS EXTRA_CPPFLAGS
-export AUTO_CONFIG_CFLAGS = -Wno-error
+export AUTO_CONFIG_CFLAGS += -Wno-error
 
 ifndef V
 AUTOCONF_OUTPUT := >/dev/null