* [dpdk-stable] [PATCH] mlx5: fix __mlx5_bit_off macro warning for Windows
@ 2021-01-06 13:42 Tal Shnaiderman
2021-01-06 14:22 ` [dpdk-stable] [dpdk-dev] " Dmitry Kozlyuk
2021-01-07 11:45 ` [dpdk-stable] [PATCH v2] " Tal Shnaiderman
0 siblings, 2 replies; 6+ messages in thread
From: Tal Shnaiderman @ 2021-01-06 13:42 UTC (permalink / raw)
To: dev; +Cc: thomas, matan, rasland, ophirmu, stable
While compiling with clang 11 the callers of the
__mlx5_bit_off macro warns on the cast of pointers to
unsigned long which is a smaller int type in Windows.
warning: cast to smaller integer type 'unsigned long'
from 'u8 (*)[16]' [-Wpointer-to-int-cast]
To resolve it the type is changed to size_t to be
compatible for both Linux and Windows.
Fixes: 865a0c15672c ("net/mlx5: add Direct Verbs prepare function")
Cc: stable@dpdk.org
Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
drivers/common/mlx5/mlx5_prm.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index 8c9b53ce10..2cb3bf6005 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -601,7 +601,7 @@ typedef uint8_t u8;
#define __mlx5_nullp(typ) ((struct mlx5_ifc_##typ##_bits *)0)
#define __mlx5_bit_sz(typ, fld) sizeof(__mlx5_nullp(typ)->fld)
-#define __mlx5_bit_off(typ, fld) ((unsigned int)(unsigned long) \
+#define __mlx5_bit_off(typ, fld) ((unsigned int)(size_t) \
(&(__mlx5_nullp(typ)->fld)))
#define __mlx5_dw_bit_off(typ, fld) (32 - __mlx5_bit_sz(typ, fld) - \
(__mlx5_bit_off(typ, fld) & 0x1f))
--
2.16.1.windows.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] mlx5: fix __mlx5_bit_off macro warning for Windows
2021-01-06 13:42 [dpdk-stable] [PATCH] mlx5: fix __mlx5_bit_off macro warning for Windows Tal Shnaiderman
@ 2021-01-06 14:22 ` Dmitry Kozlyuk
2021-01-07 11:40 ` Tal Shnaiderman
2021-01-07 11:45 ` [dpdk-stable] [PATCH v2] " Tal Shnaiderman
1 sibling, 1 reply; 6+ messages in thread
From: Dmitry Kozlyuk @ 2021-01-06 14:22 UTC (permalink / raw)
To: Tal Shnaiderman; +Cc: dev, thomas, matan, rasland, ophirmu, stable
On Wed, 6 Jan 2021 15:42:21 +0200, Tal Shnaiderman wrote:
> While compiling with clang 11 the callers of the
> __mlx5_bit_off macro warns on the cast of pointers to
> unsigned long which is a smaller int type in Windows.
>
> warning: cast to smaller integer type 'unsigned long'
> from 'u8 (*)[16]' [-Wpointer-to-int-cast]
>
> To resolve it the type is changed to size_t to be
> compatible for both Linux and Windows.
uintptr_t is the type for integers storing pointer values, not size_t.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH] mlx5: fix __mlx5_bit_off macro warning for Windows
2021-01-06 14:22 ` [dpdk-stable] [dpdk-dev] " Dmitry Kozlyuk
@ 2021-01-07 11:40 ` Tal Shnaiderman
0 siblings, 0 replies; 6+ messages in thread
From: Tal Shnaiderman @ 2021-01-07 11:40 UTC (permalink / raw)
To: Dmitry Kozlyuk
Cc: dev, NBU-Contact-Thomas Monjalon, Matan Azrad, Raslan Darawsheh,
Ophir Munk, stable
> Subject: Re: [dpdk-dev] [PATCH] mlx5: fix __mlx5_bit_off macro warning for
> Windows
>
> External email: Use caution opening links or attachments
>
>
> On Wed, 6 Jan 2021 15:42:21 +0200, Tal Shnaiderman wrote:
> > While compiling with clang 11 the callers of the __mlx5_bit_off macro
> > warns on the cast of pointers to unsigned long which is a smaller int
> > type in Windows.
> >
> > warning: cast to smaller integer type 'unsigned long'
> > from 'u8 (*)[16]' [-Wpointer-to-int-cast]
> >
> > To resolve it the type is changed to size_t to be compatible for both
> > Linux and Windows.
>
> uintptr_t is the type for integers storing pointer values, not size_t.
Correct, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-stable] [PATCH v2] mlx5: fix __mlx5_bit_off macro warning for Windows
2021-01-06 13:42 [dpdk-stable] [PATCH] mlx5: fix __mlx5_bit_off macro warning for Windows Tal Shnaiderman
2021-01-06 14:22 ` [dpdk-stable] [dpdk-dev] " Dmitry Kozlyuk
@ 2021-01-07 11:45 ` Tal Shnaiderman
2021-01-07 12:59 ` Matan Azrad
1 sibling, 1 reply; 6+ messages in thread
From: Tal Shnaiderman @ 2021-01-07 11:45 UTC (permalink / raw)
To: dev; +Cc: thomas, matan, rasland, ophirmu, stable
While compiling with clang 11 the callers of the
__mlx5_bit_off macro warns on the cast of pointers to
unsigned long which is a smaller int type in Windows.
warning: cast to smaller integer type 'unsigned long'
from 'u8 (*)[16]' [-Wpointer-to-int-cast]
To resolve it the type is changed to uintptr_t to be
compatible for both Linux and Windows.
Fixes: 865a0c15672c ("net/mlx5: add Direct Verbs prepare function")
Cc: stable@dpdk.org
Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
---
v2: change type to uintptr_t [DmitryK]
---
drivers/common/mlx5/mlx5_prm.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h
index 8c9b53ce10..b6a3a3cfcb 100644
--- a/drivers/common/mlx5/mlx5_prm.h
+++ b/drivers/common/mlx5/mlx5_prm.h
@@ -601,7 +601,7 @@ typedef uint8_t u8;
#define __mlx5_nullp(typ) ((struct mlx5_ifc_##typ##_bits *)0)
#define __mlx5_bit_sz(typ, fld) sizeof(__mlx5_nullp(typ)->fld)
-#define __mlx5_bit_off(typ, fld) ((unsigned int)(unsigned long) \
+#define __mlx5_bit_off(typ, fld) ((unsigned int)(uintptr_t) \
(&(__mlx5_nullp(typ)->fld)))
#define __mlx5_dw_bit_off(typ, fld) (32 - __mlx5_bit_sz(typ, fld) - \
(__mlx5_bit_off(typ, fld) & 0x1f))
--
2.16.1.windows.4
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-stable] [PATCH v2] mlx5: fix __mlx5_bit_off macro warning for Windows
2021-01-07 11:45 ` [dpdk-stable] [PATCH v2] " Tal Shnaiderman
@ 2021-01-07 12:59 ` Matan Azrad
2021-01-12 21:45 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
0 siblings, 1 reply; 6+ messages in thread
From: Matan Azrad @ 2021-01-07 12:59 UTC (permalink / raw)
To: Tal Shnaiderman, dev
Cc: NBU-Contact-Thomas Monjalon, Raslan Darawsheh, Ophir Munk, stable
From: Tal Shnaiderman
> While compiling with clang 11 the callers of the __mlx5_bit_off macro warns
> on the cast of pointers to unsigned long which is a smaller int type in Windows.
>
> warning: cast to smaller integer type 'unsigned long'
> from 'u8 (*)[16]' [-Wpointer-to-int-cast]
>
> To resolve it the type is changed to uintptr_t to be compatible for both Linux
> and Windows.
>
> Fixes: 865a0c15672c ("net/mlx5: add Direct Verbs prepare function")
> Cc: stable@dpdk.org
>
> Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH v2] mlx5: fix __mlx5_bit_off macro warning for Windows
2021-01-07 12:59 ` Matan Azrad
@ 2021-01-12 21:45 ` Thomas Monjalon
0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2021-01-12 21:45 UTC (permalink / raw)
To: Tal Shnaiderman; +Cc: dev, Raslan Darawsheh, Ophir Munk, stable, Matan Azrad
07/01/2021 13:59, Matan Azrad:
> From: Tal Shnaiderman
> > While compiling with clang 11 the callers of the __mlx5_bit_off macro warns
> > on the cast of pointers to unsigned long which is a smaller int type in Windows.
> >
> > warning: cast to smaller integer type 'unsigned long'
> > from 'u8 (*)[16]' [-Wpointer-to-int-cast]
> >
> > To resolve it the type is changed to uintptr_t to be compatible for both Linux
> > and Windows.
> >
> > Fixes: 865a0c15672c ("net/mlx5: add Direct Verbs prepare function")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
Applied to next-net-mlx, thanks.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-01-12 21:45 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-06 13:42 [dpdk-stable] [PATCH] mlx5: fix __mlx5_bit_off macro warning for Windows Tal Shnaiderman
2021-01-06 14:22 ` [dpdk-stable] [dpdk-dev] " Dmitry Kozlyuk
2021-01-07 11:40 ` Tal Shnaiderman
2021-01-07 11:45 ` [dpdk-stable] [PATCH v2] " Tal Shnaiderman
2021-01-07 12:59 ` Matan Azrad
2021-01-12 21:45 ` [dpdk-stable] [dpdk-dev] " Thomas Monjalon
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).