DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx: update C compliance standard
@ 2017-06-30 17:19 Adrien Mazarguil
  2017-06-30 17:47 ` Ferruh Yigit
  2017-07-03  8:27 ` [dpdk-dev] [PATCH] net/mlx5: fix compilation issue in debug mode Adrien Mazarguil
  0 siblings, 2 replies; 8+ messages in thread
From: Adrien Mazarguil @ 2017-06-30 17:19 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Nelio Laranjeiro, dev

This commit addresses a compilation issue against Glibc >= 2.25, which
implements assert() through a nonstandard ({ }) construct. Such constructs
can normally not be used without __extension__ keyword when -pedantic is
enabled, as is the case when compiling mlx4 and mlx5 PMDs in debug mode.

While assert.h checks for the compiler ability to support GNU extensions,
Clang, unlike GCC, does not allow the above syntax when combining
-std=gnu99 with -pedantic.

Work around missing keyword by moving these PMDs to a stricter compliance
standard without GNU extensions but properly checked by Glibc. Doing so is
supported on the DPDK side since includes have been cleaned up.

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
 drivers/net/mlx4/Makefile | 2 +-
 drivers/net/mlx5/Makefile | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/mlx4/Makefile b/drivers/net/mlx4/Makefile
index e873fb4..755c8a4 100644
--- a/drivers/net/mlx4/Makefile
+++ b/drivers/net/mlx4/Makefile
@@ -40,7 +40,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4_flow.c
 
 # Basic CFLAGS.
 CFLAGS += -O3
-CFLAGS += -std=gnu99 -Wall -Wextra
+CFLAGS += -std=c11 -Wall -Wextra
 CFLAGS += -g
 CFLAGS += -I.
 CFLAGS += -D_BSD_SOURCE
diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile
index daf8013..8b8f6ea 100644
--- a/drivers/net/mlx5/Makefile
+++ b/drivers/net/mlx5/Makefile
@@ -52,7 +52,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_flow.c
 
 # Basic CFLAGS.
 CFLAGS += -O3
-CFLAGS += -std=gnu99 -Wall -Wextra
+CFLAGS += -std=c11 -Wall -Wextra
 CFLAGS += -g
 CFLAGS += -I.
 CFLAGS += -D_BSD_SOURCE
-- 
2.1.4

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

* Re: [dpdk-dev] [PATCH] net/mlx: update C compliance standard
  2017-06-30 17:19 [dpdk-dev] [PATCH] net/mlx: update C compliance standard Adrien Mazarguil
@ 2017-06-30 17:47 ` Ferruh Yigit
  2017-06-30 18:14   ` Yongseok Koh
  2017-07-03  8:27 ` [dpdk-dev] [PATCH] net/mlx5: fix compilation issue in debug mode Adrien Mazarguil
  1 sibling, 1 reply; 8+ messages in thread
From: Ferruh Yigit @ 2017-06-30 17:47 UTC (permalink / raw)
  To: Adrien Mazarguil; +Cc: Nelio Laranjeiro, dev

On 6/30/2017 6:19 PM, Adrien Mazarguil wrote:
> This commit addresses a compilation issue against Glibc >= 2.25, which
> implements assert() through a nonstandard ({ }) construct. Such constructs
> can normally not be used without __extension__ keyword when -pedantic is
> enabled, as is the case when compiling mlx4 and mlx5 PMDs in debug mode.
> 
> While assert.h checks for the compiler ability to support GNU extensions,
> Clang, unlike GCC, does not allow the above syntax when combining
> -std=gnu99 with -pedantic.
> 
> Work around missing keyword by moving these PMDs to a stricter compliance
> standard without GNU extensions but properly checked by Glibc. Doing so is
> supported on the DPDK side since includes have been cleaned up.
> 
> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>

Applied to dpdk-next-net/master, thanks.

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

* Re: [dpdk-dev] [PATCH] net/mlx: update C compliance standard
  2017-06-30 17:47 ` Ferruh Yigit
@ 2017-06-30 18:14   ` Yongseok Koh
  2017-06-30 18:25     ` Yongseok Koh
  0 siblings, 1 reply; 8+ messages in thread
From: Yongseok Koh @ 2017-06-30 18:14 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Adrien Mazarguil, Nélio Laranjeiro, dev


> On Jun 30, 2017, at 10:47 AM, Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> 
> On 6/30/2017 6:19 PM, Adrien Mazarguil wrote:
>> This commit addresses a compilation issue against Glibc >= 2.25, which
>> implements assert() through a nonstandard ({ }) construct. Such constructs
>> can normally not be used without __extension__ keyword when -pedantic is
>> enabled, as is the case when compiling mlx4 and mlx5 PMDs in debug mode.
>> 
>> While assert.h checks for the compiler ability to support GNU extensions,
>> Clang, unlike GCC, does not allow the above syntax when combining
>> -std=gnu99 with -pedantic.
>> 
>> Work around missing keyword by moving these PMDs to a stricter compliance
>> standard without GNU extensions but properly checked by Glibc. Doing so is
>> supported on the DPDK side since includes have been cleaned up.
>> 
>> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> 
> Applied to dpdk-next-net/master, thanks.
This breaks debug-enabled build of mlx5 as mlx5 isn't ready yet!

Thanks,
Yongseok

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

* Re: [dpdk-dev] [PATCH] net/mlx: update C compliance standard
  2017-06-30 18:14   ` Yongseok Koh
@ 2017-06-30 18:25     ` Yongseok Koh
  2017-07-01 15:58       ` Ferruh Yigit
  0 siblings, 1 reply; 8+ messages in thread
From: Yongseok Koh @ 2017-06-30 18:25 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Adrien Mazarguil, Nélio Laranjeiro, dev


Hi,



Thanks,
Yongseok

> On Jun 30, 2017, at 11:14 AM, Yongseok Koh <yskoh@mellanox.com> wrote:
> 
> 
>> On Jun 30, 2017, at 10:47 AM, Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>> 
>> On 6/30/2017 6:19 PM, Adrien Mazarguil wrote:
>>> This commit addresses a compilation issue against Glibc >= 2.25, which
>>> implements assert() through a nonstandard ({ }) construct. Such constructs
>>> can normally not be used without __extension__ keyword when -pedantic is
>>> enabled, as is the case when compiling mlx4 and mlx5 PMDs in debug mode.
>>> 
>>> While assert.h checks for the compiler ability to support GNU extensions,
>>> Clang, unlike GCC, does not allow the above syntax when combining
>>> -std=gnu99 with -pedantic.
>>> 
>>> Work around missing keyword by moving these PMDs to a stricter compliance
>>> standard without GNU extensions but properly checked by Glibc. Doing so is
>>> supported on the DPDK side since includes have been cleaned up.
>>> 
>>> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
>> 
>> Applied to dpdk-next-net/master, thanks.
> This breaks debug-enabled build of mlx5 as mlx5 isn't ready yet!
Specifically, the following errors happen. It might be better to later make the
change for mlx5 with further cleanup.

  CC mlx5_flow.o
In file included from /.autodirect/swgwork/yskoh/git/mellanox/dpdk.org/drivers/net/mlx5/mlx5.h:68:0,
                 from /.autodirect/swgwork/yskoh/git/mellanox/dpdk.org/drivers/net/mlx5/mlx5_rxtx_vec_sse.c:62:
/.autodirect/swgwork/yskoh/git/mellanox/dpdk.org/drivers/net/mlx5/mlx5_rxtx.h:258:2: error: type of bit-field ‘elts_n’ is a GCC extension [-Werror=pedantic]
  uint16_t elts_n:4; /* (*elts)[] length (in log2). */
  ^
In file included from /.autodirect/swgwork/yskoh/git/mellanox/dpdk.org/drivers/net/mlx5/mlx5.h:68:0,
                 from /.autodirect/swgwork/yskoh/git/mellanox/dpdk.org/drivers/net/mlx5/mlx5_rxtx.c:65:
/.autodirect/swgwork/yskoh/git/mellanox/dpdk.org/drivers/net/mlx5/mlx5_rxtx.h:258:2: error: type of bit-field ‘elts_n’ is a GCC extension [-Werror=pedantic]
  uint16_t elts_n:4; /* (*elts)[] length (in log2). */
  ^
In file included from /.autodirect/swgwork/yskoh/git/mellanox/dpdk.org/drivers/net/mlx5/mlx5.h:68:0,
                 from /.autodirect/swgwork/yskoh/git/mellanox/dpdk.org/drivers/net/mlx5/mlx5_rxq.c:67:
/.autodirect/swgwork/yskoh/git/mellanox/dpdk.org/drivers/net/mlx5/mlx5_rxtx.h:258:2: error: type of bit-field ‘elts_n’ is a GCC extension [-Werror=pedantic]
  uint16_t elts_n:4; /* (*elts)[] length (in log2). */

Thanks,
Yongseok

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

* Re: [dpdk-dev] [PATCH] net/mlx: update C compliance standard
  2017-06-30 18:25     ` Yongseok Koh
@ 2017-07-01 15:58       ` Ferruh Yigit
  2017-07-02  0:12         ` Yongseok Koh
  0 siblings, 1 reply; 8+ messages in thread
From: Ferruh Yigit @ 2017-07-01 15:58 UTC (permalink / raw)
  To: Yongseok Koh; +Cc: Adrien Mazarguil, Nélio Laranjeiro, dev

On 6/30/2017 7:25 PM, Yongseok Koh wrote:
> 
> Hi,
> 
> 
> 
> Thanks,
> Yongseok
> 
>> On Jun 30, 2017, at 11:14 AM, Yongseok Koh <yskoh@mellanox.com> wrote:
>>
>>
>>> On Jun 30, 2017, at 10:47 AM, Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>>
>>> On 6/30/2017 6:19 PM, Adrien Mazarguil wrote:
>>>> This commit addresses a compilation issue against Glibc >= 2.25, which
>>>> implements assert() through a nonstandard ({ }) construct. Such constructs
>>>> can normally not be used without __extension__ keyword when -pedantic is
>>>> enabled, as is the case when compiling mlx4 and mlx5 PMDs in debug mode.
>>>>
>>>> While assert.h checks for the compiler ability to support GNU extensions,
>>>> Clang, unlike GCC, does not allow the above syntax when combining
>>>> -std=gnu99 with -pedantic.
>>>>
>>>> Work around missing keyword by moving these PMDs to a stricter compliance
>>>> standard without GNU extensions but properly checked by Glibc. Doing so is
>>>> supported on the DPDK side since includes have been cleaned up.
>>>>
>>>> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
>>>
>>> Applied to dpdk-next-net/master, thanks.
>> This breaks debug-enabled build of mlx5 as mlx5 isn't ready yet!
> Specifically, the following errors happen. It might be better to later make the
> change for mlx5 with further cleanup.

I don't see build errors.
Patch is requested to fix mlx DEBUG builds [1]. Can you please give more
details how to reproduce build error?

[1]
http://dpdk.org/ml/archives/dev/2017-June/067866.html

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

* Re: [dpdk-dev] [PATCH] net/mlx: update C compliance standard
  2017-07-01 15:58       ` Ferruh Yigit
@ 2017-07-02  0:12         ` Yongseok Koh
  0 siblings, 0 replies; 8+ messages in thread
From: Yongseok Koh @ 2017-07-02  0:12 UTC (permalink / raw)
  To: Ferruh Yigit; +Cc: Adrien Mazarguil, Nélio Laranjeiro, dev


> On Jul 1, 2017, at 8:58 AM, Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> 
> On 6/30/2017 7:25 PM, Yongseok Koh wrote:
>> 
>>> On Jun 30, 2017, at 11:14 AM, Yongseok Koh <yskoh@mellanox.com> wrote:
>>> 
>>> 
>>>> On Jun 30, 2017, at 10:47 AM, Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>>> 
>>>> On 6/30/2017 6:19 PM, Adrien Mazarguil wrote:
>>>>> This commit addresses a compilation issue against Glibc >= 2.25, which
>>>>> implements assert() through a nonstandard ({ }) construct. Such constructs
>>>>> can normally not be used without __extension__ keyword when -pedantic is
>>>>> enabled, as is the case when compiling mlx4 and mlx5 PMDs in debug mode.
>>>>> 
>>>>> While assert.h checks for the compiler ability to support GNU extensions,
>>>>> Clang, unlike GCC, does not allow the above syntax when combining
>>>>> -std=gnu99 with -pedantic.
>>>>> 
>>>>> Work around missing keyword by moving these PMDs to a stricter compliance
>>>>> standard without GNU extensions but properly checked by Glibc. Doing so is
>>>>> supported on the DPDK side since includes have been cleaned up.
>>>>> 
>>>>> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
>>>> 
>>>> Applied to dpdk-next-net/master, thanks.
>>> This breaks debug-enabled build of mlx5 as mlx5 isn't ready yet!
>> Specifically, the following errors happen. It might be better to later make the
>> change for mlx5 with further cleanup.
> 
> I don't see build errors.
> Patch is requested to fix mlx DEBUG builds [1]. Can you please give more
> details how to reproduce build error?

Mine is on CentOS 7.3 and gcc is "version 4.8.5 20150623 (Red Hat 4.8.5-11) (GCC)"
Adrien chatted with me and he is already preparing a simple patch. I've also
verified his patch fixed the issue.

Thanks,
Yongseok

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

* [dpdk-dev] [PATCH] net/mlx5: fix compilation issue in debug mode
  2017-06-30 17:19 [dpdk-dev] [PATCH] net/mlx: update C compliance standard Adrien Mazarguil
  2017-06-30 17:47 ` Ferruh Yigit
@ 2017-07-03  8:27 ` Adrien Mazarguil
  2017-07-03  9:18   ` Ferruh Yigit
  1 sibling, 1 reply; 8+ messages in thread
From: Adrien Mazarguil @ 2017-07-03  8:27 UTC (permalink / raw)
  To: dev, Ferruh Yigit; +Cc: Yongseok Koh

Even in C11, using types other than _Bool or signed/unsigned int for
bit-fields is an extension. Some GCC versions complain about that when
-pedantic checks are enabled.

The RTE_STD_C11 macro correctly prevented this issue with C99 but not with
C11 as it becomes a no-op. Forcing the extension keyword addresses it.

Fixes: 143c03925695 ("net/mlx: update C compliance standard")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Tested-by: Yongseok Koh <yskoh@mellanox.com>
---
Ferruh, squashing this commit with the previous one and discarding its
log is fine if you want. Thanks.
---
 drivers/net/mlx5/mlx5_rxtx.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/mlx5/mlx5_rxtx.h b/drivers/net/mlx5/mlx5_rxtx.h
index 450a569..4195665 100644
--- a/drivers/net/mlx5/mlx5_rxtx.h
+++ b/drivers/net/mlx5/mlx5_rxtx.h
@@ -240,7 +240,7 @@ struct hash_rxq {
 };
 
 /* TX queue descriptor. */
-RTE_STD_C11
+__extension__
 struct txq {
 	uint16_t elts_head; /* Current index in (*elts)[]. */
 	uint16_t elts_tail; /* First element awaiting completion. */
-- 
2.1.4

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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix compilation issue in debug mode
  2017-07-03  8:27 ` [dpdk-dev] [PATCH] net/mlx5: fix compilation issue in debug mode Adrien Mazarguil
@ 2017-07-03  9:18   ` Ferruh Yigit
  0 siblings, 0 replies; 8+ messages in thread
From: Ferruh Yigit @ 2017-07-03  9:18 UTC (permalink / raw)
  To: Adrien Mazarguil, dev; +Cc: Yongseok Koh

On 7/3/2017 9:27 AM, Adrien Mazarguil wrote:
> Even in C11, using types other than _Bool or signed/unsigned int for
> bit-fields is an extension. Some GCC versions complain about that when
> -pedantic checks are enabled.
> 
> The RTE_STD_C11 macro correctly prevented this issue with C99 but not with
> C11 as it becomes a no-op. Forcing the extension keyword addresses it.
> 
> Fixes: 143c03925695 ("net/mlx: update C compliance standard")
> 
> Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
> Tested-by: Yongseok Koh <yskoh@mellanox.com>
> ---
> Ferruh, squashing this commit with the previous one and discarding its
> log is fine if you want. Thanks.

Squashed into relevant commit in next-net, thanks.

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

end of thread, other threads:[~2017-07-03  9:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-30 17:19 [dpdk-dev] [PATCH] net/mlx: update C compliance standard Adrien Mazarguil
2017-06-30 17:47 ` Ferruh Yigit
2017-06-30 18:14   ` Yongseok Koh
2017-06-30 18:25     ` Yongseok Koh
2017-07-01 15:58       ` Ferruh Yigit
2017-07-02  0:12         ` Yongseok Koh
2017-07-03  8:27 ` [dpdk-dev] [PATCH] net/mlx5: fix compilation issue in debug mode Adrien Mazarguil
2017-07-03  9:18   ` Ferruh Yigit

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