Skip to contentSkip to conversation

mlx4: fix unneeded function error with clang v3.6

PATCH In review Bruce Richardson 2 participants 3 messages Feb 8, 2016 – Feb 9, 2016 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mlx4: fix unneeded function error with clang v3.6

When compiling with clang 3.6, the mlx4 driver gives the following error message about an unneeded function.

CC mlx4.o
.../drivers/net/mlx4/mlx4.c:136:20: fatal error: function
'wr_id_t_check' is not needed and will not be emitted
[-Wunneeded-internal-declaration]
static inline void wr_id_t_check(void)

                   ^

1 error generated.

The function is to compile-time check the size of wr_id_t, so use the standard DPDK BUILD_BUG_ON macro to do so in the init function instead.

Fixes 7fae69eeff13 ("mlx4: new poll mode driver")
---
 drivers/net/mlx4/mlx4.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)
drivers/net/mlx4/mlx4.c +2 -9
index 207bfe2..ac162e9 100644
@@ -132,15 +132,6 @@ typedef union {
 
 #define WR_ID(o) (((wr_id_t *)&(o))->data)
 
-/* Compile-time check. */
-static inline void wr_id_t_check(void)
-{
-	wr_id_t check[1 + (2 * -!(sizeof(wr_id_t) == sizeof(uint64_t)))];
-
-	(void)check;
-	(void)wr_id_t_check;
-}
-
 /* Transpose flags. Useful to convert IBV to DPDK flags. */
 #define TRANSPOSE(val, from, to) \
 	(((from) >= (to)) ? \
@@ -5685,6 +5676,8 @@ rte_mlx4_pmd_init(const char *name, const char *args)
 {
 	(void)name;
 	(void)args;
+
+	RTE_BUILD_BUG_ON(sizeof(wr_id_t) != sizeof(uint64_t));
 	/*
 	 * RDMAV_HUGEPAGES_SAFE tells ibv_fork_init() we intend to use
 	 * huge pages. Calling ibv_fork_init() during init allows
Signature · 1 line
2.5.0
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · Bruce Richardson

When compiling with clang 3.6, the mlx4 driver gives the following error message about an unneeded function.

CC mlx4.o
.../drivers/net/mlx4/mlx4.c:136:20: fatal error: function
'wr_id_t_check' is not needed and will not be emitted
[-Wunneeded-internal-declaration]
static inline void wr_id_t_check(void)

                   ^

1 error generated.

Quoted 7 lines

The function is to compile-time check the size of wr_id_t, so use the standard DPDK BUILD_BUG_ON macro to do so in the init function instead.

Fixes 7fae69eeff13 ("mlx4: new poll mode driver")

Thanks.

Signature · 2 lines
Adrien Mazarguil
6WIND
author Applied
#2 lore raw
Quoted 16 lines · Adrien Mazarguil
Quoted 15 lines · Bruce Richardson

When compiling with clang 3.6, the mlx4 driver gives the following error message about an unneeded function.

CC mlx4.o
.../drivers/net/mlx4/mlx4.c:136:20: fatal error: function
'wr_id_t_check' is not needed and will not be emitted
[-Wunneeded-internal-declaration]
static inline void wr_id_t_check(void)

                   ^

1 error generated.

The function is to compile-time check the size of wr_id_t, so use the standard DPDK BUILD_BUG_ON macro to do so in the init function instead.

Quoted 9 lines
Quoted 3 lines
Fixes 7fae69eeff13 ("mlx4: new poll mode driver")

Thanks.

Applied to dpdk-next-net/rel_16_04

/Bruce