DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/bnxt: fix CLANG compilation error
@ 2020-04-20  6:26 Ajit Khaparde
  2020-04-20  7:14 ` David Marchand
  0 siblings, 1 reply; 5+ messages in thread
From: Ajit Khaparde @ 2020-04-20  6:26 UTC (permalink / raw)
  To: dev; +Cc: Raslan Darawsheh, Lance Richardson, Somnath Kotur

Fix a compilation error seen with CLANG.
The current code causes a typedef redefinition error because
'p__LINE__' is a C11 feature. Fixing it by defining it to something
which is not already defined in the language.

Fixes: 3ca9012a81f9 ("net/bnxt: add initial TruFlow core session open")

Reported-by: Raslan Darawsheh <rasland@mellanox.com>
Suggested-by: Lance Richardson <lance.richardson@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
---
 drivers/net/bnxt/tf_core/hwrm_tf.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/bnxt/tf_core/hwrm_tf.h b/drivers/net/bnxt/tf_core/hwrm_tf.h
index 2598ca7ee..6299d588a 100644
--- a/drivers/net/bnxt/tf_core/hwrm_tf.h
+++ b/drivers/net/bnxt/tf_core/hwrm_tf.h
@@ -37,7 +37,11 @@ typedef enum tf_subtype {
 #define TF_MAX_REQ_SIZE 104
 /* u32_t	tlv_resp_value[170]; */
 #define TF_MAX_RESP_SIZE 680
-#define BUILD_BUG_ON(condition) typedef char p__LINE__[(condition) ? 1 : -1]
+
+#define __BUILD_BUG_ON(condition, line) \
+	char p##line[(condition) ? 1 : -1]
+#define _BUILD_BUG_ON(condition, line) __BUILD_BUG_ON(condition, line)
+#define BUILD_BUG_ON(condition) _BUILD_BUG_ON(condition, __LINE__)
 
 /* Use this to allocate/free any kind of
  * indexes over HWRM and fill the parms pointer
-- 
2.21.1 (Apple Git-122.3)


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

* Re: [dpdk-dev] [PATCH] net/bnxt: fix CLANG compilation error
  2020-04-20  6:26 [dpdk-dev] [PATCH] net/bnxt: fix CLANG compilation error Ajit Khaparde
@ 2020-04-20  7:14 ` David Marchand
  2020-04-20 12:22   ` Ferruh Yigit
  0 siblings, 1 reply; 5+ messages in thread
From: David Marchand @ 2020-04-20  7:14 UTC (permalink / raw)
  To: Ajit Khaparde; +Cc: dev, Raslan Darawsheh, Lance Richardson, Somnath Kotur

On Mon, Apr 20, 2020 at 8:28 AM Ajit Khaparde
<ajit.khaparde@broadcom.com> wrote:
>
> Fix a compilation error seen with CLANG.
> The current code causes a typedef redefinition error because
> 'p__LINE__' is a C11 feature. Fixing it by defining it to something
> which is not already defined in the language.

Can't you reuse the RTE_BUILD_BUG_ON macro instead of redefining this
in your driver?
If the EAL macro is not enough, I suppose we could improve it.


-- 
David Marchand


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

* Re: [dpdk-dev] [PATCH] net/bnxt: fix CLANG compilation error
  2020-04-20  7:14 ` David Marchand
@ 2020-04-20 12:22   ` Ferruh Yigit
  2020-04-20 12:23     ` David Marchand
  0 siblings, 1 reply; 5+ messages in thread
From: Ferruh Yigit @ 2020-04-20 12:22 UTC (permalink / raw)
  To: David Marchand, Ajit Khaparde
  Cc: dev, Raslan Darawsheh, Lance Richardson, Somnath Kotur

On 4/20/2020 8:14 AM, David Marchand wrote:
> On Mon, Apr 20, 2020 at 8:28 AM Ajit Khaparde
> <ajit.khaparde@broadcom.com> wrote:
>>
>> Fix a compilation error seen with CLANG.
>> The current code causes a typedef redefinition error because
>> 'p__LINE__' is a C11 feature. Fixing it by defining it to something
>> which is not already defined in the language.
> 
> Can't you reuse the RTE_BUILD_BUG_ON macro instead of redefining this
> in your driver?
> If the EAL macro is not enough, I suppose we could improve it.
> 

Will squash it on next-net to fix the build error. +1 to using
'RTE_BUILD_BUG_ON' comment if it possible but it can be done as incremental patch.

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

* Re: [dpdk-dev] [PATCH] net/bnxt: fix CLANG compilation error
  2020-04-20 12:22   ` Ferruh Yigit
@ 2020-04-20 12:23     ` David Marchand
  2020-04-20 12:49       ` Ferruh Yigit
  0 siblings, 1 reply; 5+ messages in thread
From: David Marchand @ 2020-04-20 12:23 UTC (permalink / raw)
  To: Ferruh Yigit
  Cc: Ajit Khaparde, dev, Raslan Darawsheh, Lance Richardson, Somnath Kotur

On Mon, Apr 20, 2020 at 2:22 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> On 4/20/2020 8:14 AM, David Marchand wrote:
> > On Mon, Apr 20, 2020 at 8:28 AM Ajit Khaparde
> > <ajit.khaparde@broadcom.com> wrote:
> >>
> >> Fix a compilation error seen with CLANG.
> >> The current code causes a typedef redefinition error because
> >> 'p__LINE__' is a C11 feature. Fixing it by defining it to something
> >> which is not already defined in the language.
> >
> > Can't you reuse the RTE_BUILD_BUG_ON macro instead of redefining this
> > in your driver?
> > If the EAL macro is not enough, I suppose we could improve it.
> >
>
> Will squash it on next-net to fix the build error. +1 to using
> 'RTE_BUILD_BUG_ON' comment if it possible but it can be done as incremental patch.

Ack.


-- 
David Marchand


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

* Re: [dpdk-dev] [PATCH] net/bnxt: fix CLANG compilation error
  2020-04-20 12:23     ` David Marchand
@ 2020-04-20 12:49       ` Ferruh Yigit
  0 siblings, 0 replies; 5+ messages in thread
From: Ferruh Yigit @ 2020-04-20 12:49 UTC (permalink / raw)
  To: David Marchand
  Cc: Ajit Khaparde, dev, Raslan Darawsheh, Lance Richardson, Somnath Kotur

On 4/20/2020 1:23 PM, David Marchand wrote:
> On Mon, Apr 20, 2020 at 2:22 PM Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>> On 4/20/2020 8:14 AM, David Marchand wrote:
>>> On Mon, Apr 20, 2020 at 8:28 AM Ajit Khaparde
>>> <ajit.khaparde@broadcom.com> wrote:
>>>>
>>>> Fix a compilation error seen with CLANG.
>>>> The current code causes a typedef redefinition error because
>>>> 'p__LINE__' is a C11 feature. Fixing it by defining it to something
>>>> which is not already defined in the language.
>>>
>>> Can't you reuse the RTE_BUILD_BUG_ON macro instead of redefining this
>>> in your driver?
>>> If the EAL macro is not enough, I suppose we could improve it.
>>>
>>
>> Will squash it on next-net to fix the build error. +1 to using
>> 'RTE_BUILD_BUG_ON' comment if it possible but it can be done as incremental patch.
> 
> Ack.
> 

Squashed into relevant commit in next-net, thanks.


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

end of thread, other threads:[~2020-04-20 12:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-20  6:26 [dpdk-dev] [PATCH] net/bnxt: fix CLANG compilation error Ajit Khaparde
2020-04-20  7:14 ` David Marchand
2020-04-20 12:22   ` Ferruh Yigit
2020-04-20 12:23     ` David Marchand
2020-04-20 12:49       ` 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).