* [PATCH] verbs: fix compilation warning with C++20
@ 2023-06-09 15:31 Daniel Vacek
2023-06-09 16:00 ` Jason Gunthorpe
2023-06-13 13:19 ` [PATCH v2] " Daniel Vacek
0 siblings, 2 replies; 13+ messages in thread
From: Daniel Vacek @ 2023-06-09 15:31 UTC (permalink / raw)
To: linux-rdma; +Cc: Leon Romanovsky, Daniel Vacek, Rogerio Moraes
Our customer reported the below warning whe using Clang v16.0.4 and C++20,
on a code that includes the header "/usr/include/infiniband/verbs.h":
error: bitwise operation between different enumeration types ('ibv_access_flags' and
'ib_uverbs_access_flags') is deprecated [-Werror,-Wdeprecated-enum-enum-conversion]
mem->mr = ibv_reg_mr(dev->pd, (void*)start, len, IBV_ACCESS_LOCAL_WRITE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/infiniband/verbs.h:2514:19: note: expanded from macro 'ibv_reg_mr'
((access) & IBV_ACCESS_OPTIONAL_RANGE) == 0))
~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
According to the article "Clang 11 warning: Bitwise operation between different
enumeration types is deprecated":
C++20's P1120R0 deprecated bitwise operations between different enums. Such code is
likely to become ill-formed in C++23. Clang 11 warns about such cases. It should be fixed.
Reported-by: Rogerio Moraes <rogerio@cadence.com>
Signed-off-by: Daniel Vacek <neelx@redhat.com>
---
libibverbs/verbs.h | 4 +++-
libibverbs/verbs_api.h | 1 -
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
index 03a7a2a7..85995abe 100644
--- a/libibverbs/verbs.h
+++ b/libibverbs/verbs.h
@@ -617,7 +617,9 @@ enum ibv_access_flags {
IBV_ACCESS_HUGETLB = (1<<7),
IBV_ACCESS_FLUSH_GLOBAL = (1 << 8),
IBV_ACCESS_FLUSH_PERSISTENT = (1 << 9),
- IBV_ACCESS_RELAXED_ORDERING = IBV_ACCESS_OPTIONAL_FIRST,
+
+ IBV_ACCESS_RELAXED_ORDERING = IBV_ACCESS_OPTIONAL_FIRST, // bit 20
+ IBV_ACCESS_OPTIONAL_RANGE = IB_UVERBS_ACCESS_OPTIONAL_RANGE // mask of bits 20-29
};
struct ibv_mw_bind_info {
diff --git a/libibverbs/verbs_api.h b/libibverbs/verbs_api.h
index 309f6fba..7a5f0cdf 100644
--- a/libibverbs/verbs_api.h
+++ b/libibverbs/verbs_api.h
@@ -94,7 +94,6 @@
#define IBV_QPF_GRH_REQUIRED IB_UVERBS_QPF_GRH_REQUIRED
-#define IBV_ACCESS_OPTIONAL_RANGE IB_UVERBS_ACCESS_OPTIONAL_RANGE
#define IBV_ACCESS_OPTIONAL_FIRST IB_UVERBS_ACCESS_OPTIONAL_FIRST
#endif
--
2.40.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH] verbs: fix compilation warning with C++20
2023-06-09 15:31 [PATCH] verbs: fix compilation warning with C++20 Daniel Vacek
@ 2023-06-09 16:00 ` Jason Gunthorpe
2023-06-09 16:15 ` Daniel Vacek
2023-06-13 13:19 ` [PATCH v2] " Daniel Vacek
1 sibling, 1 reply; 13+ messages in thread
From: Jason Gunthorpe @ 2023-06-09 16:00 UTC (permalink / raw)
To: Daniel Vacek; +Cc: linux-rdma, Leon Romanovsky, Rogerio Moraes
On Fri, Jun 09, 2023 at 05:31:47PM +0200, Daniel Vacek wrote:
> Our customer reported the below warning whe using Clang v16.0.4 and C++20,
> on a code that includes the header "/usr/include/infiniband/verbs.h":
>
> error: bitwise operation between different enumeration types ('ibv_access_flags' and
> 'ib_uverbs_access_flags') is deprecated [-Werror,-Wdeprecated-enum-enum-conversion]
> mem->mr = ibv_reg_mr(dev->pd, (void*)start, len, IBV_ACCESS_LOCAL_WRITE);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/include/infiniband/verbs.h:2514:19: note: expanded from macro 'ibv_reg_mr'
> ((access) & IBV_ACCESS_OPTIONAL_RANGE) == 0))
> ~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 error generated.
>
> According to the article "Clang 11 warning: Bitwise operation between different
> enumeration types is deprecated":
>
> C++20's P1120R0 deprecated bitwise operations between different enums. Such code is
> likely to become ill-formed in C++23. Clang 11 warns about such cases. It should be fixed.
There should be a cast to an integer in the macro, we can't know what
the user will pass in there and it may not be that enum.
Jason
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] verbs: fix compilation warning with C++20
2023-06-09 16:00 ` Jason Gunthorpe
@ 2023-06-09 16:15 ` Daniel Vacek
2023-06-09 16:18 ` Jason Gunthorpe
0 siblings, 1 reply; 13+ messages in thread
From: Daniel Vacek @ 2023-06-09 16:15 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: linux-rdma, Leon Romanovsky, Rogerio Moraes
On Fri, Jun 9, 2023 at 6:01 PM Jason Gunthorpe <jgg@ziepe.ca> wrote:
>
> On Fri, Jun 09, 2023 at 05:31:47PM +0200, Daniel Vacek wrote:
> > Our customer reported the below warning whe using Clang v16.0.4 and C++20,
> > on a code that includes the header "/usr/include/infiniband/verbs.h":
> >
> > error: bitwise operation between different enumeration types ('ibv_access_flags' and
> > 'ib_uverbs_access_flags') is deprecated [-Werror,-Wdeprecated-enum-enum-conversion]
> > mem->mr = ibv_reg_mr(dev->pd, (void*)start, len, IBV_ACCESS_LOCAL_WRITE);
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /usr/include/infiniband/verbs.h:2514:19: note: expanded from macro 'ibv_reg_mr'
> > ((access) & IBV_ACCESS_OPTIONAL_RANGE) == 0))
> > ~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
> > 1 error generated.
> >
> > According to the article "Clang 11 warning: Bitwise operation between different
> > enumeration types is deprecated":
> >
> > C++20's P1120R0 deprecated bitwise operations between different enums. Such code is
> > likely to become ill-formed in C++23. Clang 11 warns about such cases. It should be fixed.
>
> There should be a cast to an integer in the macro, we can't know what
> the user will pass in there and it may not be that enum.
Hmm, if the user passes a definition from the header files at least we
should be consistent I'd say, which is this case. No one was passing
any custom values here.
If you cast to an integer here you may start silently hiding possible
errors. If the user passes any custom value, IMO, it's his
responsibility to make it right.
I forgot to explicitly mention before that this change was tested and
it addresses the warning successfully.
--nX
> Jason
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] verbs: fix compilation warning with C++20
2023-06-09 16:15 ` Daniel Vacek
@ 2023-06-09 16:18 ` Jason Gunthorpe
2023-06-09 16:29 ` Daniel Vacek
0 siblings, 1 reply; 13+ messages in thread
From: Jason Gunthorpe @ 2023-06-09 16:18 UTC (permalink / raw)
To: Daniel Vacek; +Cc: linux-rdma, Leon Romanovsky, Rogerio Moraes
On Fri, Jun 09, 2023 at 06:15:44PM +0200, Daniel Vacek wrote:
> On Fri, Jun 9, 2023 at 6:01 PM Jason Gunthorpe <jgg@ziepe.ca> wrote:
> >
> > On Fri, Jun 09, 2023 at 05:31:47PM +0200, Daniel Vacek wrote:
> > > Our customer reported the below warning whe using Clang v16.0.4 and C++20,
> > > on a code that includes the header "/usr/include/infiniband/verbs.h":
> > >
> > > error: bitwise operation between different enumeration types ('ibv_access_flags' and
> > > 'ib_uverbs_access_flags') is deprecated [-Werror,-Wdeprecated-enum-enum-conversion]
> > > mem->mr = ibv_reg_mr(dev->pd, (void*)start, len, IBV_ACCESS_LOCAL_WRITE);
> > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > /usr/include/infiniband/verbs.h:2514:19: note: expanded from macro 'ibv_reg_mr'
> > > ((access) & IBV_ACCESS_OPTIONAL_RANGE) == 0))
> > > ~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
> > > 1 error generated.
> > >
> > > According to the article "Clang 11 warning: Bitwise operation between different
> > > enumeration types is deprecated":
> > >
> > > C++20's P1120R0 deprecated bitwise operations between different enums. Such code is
> > > likely to become ill-formed in C++23. Clang 11 warns about such cases. It should be fixed.
> >
> > There should be a cast to an integer in the macro, we can't know what
> > the user will pass in there and it may not be that enum.
>
> Hmm, if the user passes a definition from the header files at least we
> should be consistent I'd say, which is this case. No one was passing
> any custom values here.
> If you cast to an integer here you may start silently hiding possible
> errors. If the user passes any custom value, IMO, it's his
> responsibility to make it right.
The signature of the API is to accept an int, we cannot demand any
more of that from the user. The macro wiped out the type cast to an
int, it should put it back.
Jason
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] verbs: fix compilation warning with C++20
2023-06-09 16:18 ` Jason Gunthorpe
@ 2023-06-09 16:29 ` Daniel Vacek
2023-06-09 16:34 ` Jason Gunthorpe
0 siblings, 1 reply; 13+ messages in thread
From: Daniel Vacek @ 2023-06-09 16:29 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: linux-rdma, Leon Romanovsky, Rogerio Moraes
On Fri, Jun 9, 2023 at 6:18 PM Jason Gunthorpe <jgg@ziepe.ca> wrote:
> On Fri, Jun 09, 2023 at 06:15:44PM +0200, Daniel Vacek wrote:
> > On Fri, Jun 9, 2023 at 6:01 PM Jason Gunthorpe <jgg@ziepe.ca> wrote:
> > > On Fri, Jun 09, 2023 at 05:31:47PM +0200, Daniel Vacek wrote:
> > > > Our customer reported the below warning whe using Clang v16.0.4 and C++20,
> > > > on a code that includes the header "/usr/include/infiniband/verbs.h":
> > > >
> > > > error: bitwise operation between different enumeration types ('ibv_access_flags' and
> > > > 'ib_uverbs_access_flags') is deprecated [-Werror,-Wdeprecated-enum-enum-conversion]
> > > > mem->mr = ibv_reg_mr(dev->pd, (void*)start, len, IBV_ACCESS_LOCAL_WRITE);
> > > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > /usr/include/infiniband/verbs.h:2514:19: note: expanded from macro 'ibv_reg_mr'
> > > > ((access) & IBV_ACCESS_OPTIONAL_RANGE) == 0))
> > > > ~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > 1 error generated.
> > > >
> > > > According to the article "Clang 11 warning: Bitwise operation between different
> > > > enumeration types is deprecated":
> > > >
> > > > C++20's P1120R0 deprecated bitwise operations between different enums. Such code is
> > > > likely to become ill-formed in C++23. Clang 11 warns about such cases. It should be fixed.
> > >
> > > There should be a cast to an integer in the macro, we can't know what
> > > the user will pass in there and it may not be that enum.
> >
> > Hmm, if the user passes a definition from the header files at least we
> > should be consistent I'd say, which is this case. No one was passing
> > any custom values here.
> > If you cast to an integer here you may start silently hiding possible
> > errors. If the user passes any custom value, IMO, it's his
> > responsibility to make it right.
>
> The signature of the API is to accept an int, we cannot demand any
> more of that from the user. The macro wiped out the type cast to an
> int, it should put it back.
Oh, I see. In that case shall we still keep this patch or just do the cast?
--nX
> Jason
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] verbs: fix compilation warning with C++20
2023-06-09 16:29 ` Daniel Vacek
@ 2023-06-09 16:34 ` Jason Gunthorpe
0 siblings, 0 replies; 13+ messages in thread
From: Jason Gunthorpe @ 2023-06-09 16:34 UTC (permalink / raw)
To: Daniel Vacek; +Cc: linux-rdma, Leon Romanovsky, Rogerio Moraes
On Fri, Jun 09, 2023 at 06:29:55PM +0200, Daniel Vacek wrote:
> On Fri, Jun 9, 2023 at 6:18 PM Jason Gunthorpe <jgg@ziepe.ca> wrote:
> > On Fri, Jun 09, 2023 at 06:15:44PM +0200, Daniel Vacek wrote:
> > > On Fri, Jun 9, 2023 at 6:01 PM Jason Gunthorpe <jgg@ziepe.ca> wrote:
> > > > On Fri, Jun 09, 2023 at 05:31:47PM +0200, Daniel Vacek wrote:
> > > > > Our customer reported the below warning whe using Clang v16.0.4 and C++20,
> > > > > on a code that includes the header "/usr/include/infiniband/verbs.h":
> > > > >
> > > > > error: bitwise operation between different enumeration types ('ibv_access_flags' and
> > > > > 'ib_uverbs_access_flags') is deprecated [-Werror,-Wdeprecated-enum-enum-conversion]
> > > > > mem->mr = ibv_reg_mr(dev->pd, (void*)start, len, IBV_ACCESS_LOCAL_WRITE);
> > > > > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > /usr/include/infiniband/verbs.h:2514:19: note: expanded from macro 'ibv_reg_mr'
> > > > > ((access) & IBV_ACCESS_OPTIONAL_RANGE) == 0))
> > > > > ~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
> > > > > 1 error generated.
> > > > >
> > > > > According to the article "Clang 11 warning: Bitwise operation between different
> > > > > enumeration types is deprecated":
> > > > >
> > > > > C++20's P1120R0 deprecated bitwise operations between different enums. Such code is
> > > > > likely to become ill-formed in C++23. Clang 11 warns about such cases. It should be fixed.
> > > >
> > > > There should be a cast to an integer in the macro, we can't know what
> > > > the user will pass in there and it may not be that enum.
> > >
> > > Hmm, if the user passes a definition from the header files at least we
> > > should be consistent I'd say, which is this case. No one was passing
> > > any custom values here.
> > > If you cast to an integer here you may start silently hiding possible
> > > errors. If the user passes any custom value, IMO, it's his
> > > responsibility to make it right.
> >
> > The signature of the API is to accept an int, we cannot demand any
> > more of that from the user. The macro wiped out the type cast to an
> > int, it should put it back.
>
> Oh, I see. In that case shall we still keep this patch or just do
> the cast?
Just do the cast
Jason
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v2] verbs: fix compilation warning with C++20
2023-06-09 15:31 [PATCH] verbs: fix compilation warning with C++20 Daniel Vacek
2023-06-09 16:00 ` Jason Gunthorpe
@ 2023-06-13 13:19 ` Daniel Vacek
2023-06-20 9:19 ` Daniel Vacek
` (2 more replies)
1 sibling, 3 replies; 13+ messages in thread
From: Daniel Vacek @ 2023-06-13 13:19 UTC (permalink / raw)
To: linux-rdma; +Cc: Leon Romanovsky, Daniel Vacek, Rogerio Moraes
Our customer reported the below warning whe using Clang v16.0.4 and C++20,
on a code that includes the header "/usr/include/infiniband/verbs.h":
error: bitwise operation between different enumeration types ('ibv_access_flags' and
'ib_uverbs_access_flags') is deprecated [-Werror,-Wdeprecated-enum-enum-conversion]
mem->mr = ibv_reg_mr(dev->pd, (void*)start, len, IBV_ACCESS_LOCAL_WRITE);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/infiniband/verbs.h:2514:19: note: expanded from macro 'ibv_reg_mr'
((access) & IBV_ACCESS_OPTIONAL_RANGE) == 0))
~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
According to the article "Clang 11 warning: Bitwise operation between different
enumeration types is deprecated":
C++20's P1120R0 deprecated bitwise operations between different enums. Such code is
likely to become ill-formed in C++23. Clang 11 warns about such cases. It should be fixed.
Reported-by: Rogerio Moraes <rogerio@cadence.com>
Signed-off-by: Daniel Vacek <neelx@redhat.com>
---
libibverbs/verbs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
index 03a7a2a7..ed9aed21 100644
--- a/libibverbs/verbs.h
+++ b/libibverbs/verbs.h
@@ -2590,7 +2590,7 @@ __ibv_reg_mr(struct ibv_pd *pd, void *addr, size_t length, unsigned int access,
#define ibv_reg_mr(pd, addr, length, access) \
__ibv_reg_mr(pd, addr, length, access, \
__builtin_constant_p( \
- ((access) & IBV_ACCESS_OPTIONAL_RANGE) == 0))
+ ((int)(access) & IBV_ACCESS_OPTIONAL_RANGE) == 0))
/**
* ibv_reg_mr_iova - Register a memory region with a virtual offset
--
2.40.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH v2] verbs: fix compilation warning with C++20
2023-06-13 13:19 ` [PATCH v2] " Daniel Vacek
@ 2023-06-20 9:19 ` Daniel Vacek
2023-06-20 11:09 ` Rogerio de Souza Moraes
2023-06-29 12:41 ` Daniel Vacek
2023-07-05 7:30 ` Leon Romanovsky
2 siblings, 1 reply; 13+ messages in thread
From: Daniel Vacek @ 2023-06-20 9:19 UTC (permalink / raw)
To: linux-rdma, Jason Gunthorpe; +Cc: Leon Romanovsky, Rogerio Moraes
Adding CC: Jason
--nX
On Tue, Jun 13, 2023 at 3:20 PM Daniel Vacek <neelx@redhat.com> wrote:
>
> Our customer reported the below warning whe using Clang v16.0.4 and C++20,
> on a code that includes the header "/usr/include/infiniband/verbs.h":
>
> error: bitwise operation between different enumeration types ('ibv_access_flags' and
> 'ib_uverbs_access_flags') is deprecated [-Werror,-Wdeprecated-enum-enum-conversion]
> mem->mr = ibv_reg_mr(dev->pd, (void*)start, len, IBV_ACCESS_LOCAL_WRITE);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/include/infiniband/verbs.h:2514:19: note: expanded from macro 'ibv_reg_mr'
> ((access) & IBV_ACCESS_OPTIONAL_RANGE) == 0))
> ~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 error generated.
>
> According to the article "Clang 11 warning: Bitwise operation between different
> enumeration types is deprecated":
>
> C++20's P1120R0 deprecated bitwise operations between different enums. Such code is
> likely to become ill-formed in C++23. Clang 11 warns about such cases. It should be fixed.
>
> Reported-by: Rogerio Moraes <rogerio@cadence.com>
> Signed-off-by: Daniel Vacek <neelx@redhat.com>
> ---
> libibverbs/verbs.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
> index 03a7a2a7..ed9aed21 100644
> --- a/libibverbs/verbs.h
> +++ b/libibverbs/verbs.h
> @@ -2590,7 +2590,7 @@ __ibv_reg_mr(struct ibv_pd *pd, void *addr, size_t length, unsigned int access,
> #define ibv_reg_mr(pd, addr, length, access) \
> __ibv_reg_mr(pd, addr, length, access, \
> __builtin_constant_p( \
> - ((access) & IBV_ACCESS_OPTIONAL_RANGE) == 0))
> + ((int)(access) & IBV_ACCESS_OPTIONAL_RANGE) == 0))
>
> /**
> * ibv_reg_mr_iova - Register a memory region with a virtual offset
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* RE: [PATCH v2] verbs: fix compilation warning with C++20
2023-06-20 9:19 ` Daniel Vacek
@ 2023-06-20 11:09 ` Rogerio de Souza Moraes
0 siblings, 0 replies; 13+ messages in thread
From: Rogerio de Souza Moraes @ 2023-06-20 11:09 UTC (permalink / raw)
To: Daniel Vacek, linux-rdma@vger.kernel.org, Jason Gunthorpe; +Cc: Leon Romanovsky
Hi Eugene,
Red Hat provided another fix, could you try to reproduce the issue on my machine (sjcvl1-rogerio) and give me feedback?
Regards,
Rogerio
-----Original Message-----
From: Daniel Vacek <neelx@redhat.com>
Sent: Tuesday, June 20, 2023 6:20 AM
To: linux-rdma@vger.kernel.org; Jason Gunthorpe <jgg@ziepe.ca>
Cc: Leon Romanovsky <leon@kernel.org>; Rogerio de Souza Moraes <rogerio@cadence.com>
Subject: Re: [PATCH v2] verbs: fix compilation warning with C++20
EXTERNAL MAIL
Adding CC: Jason
--nX
On Tue, Jun 13, 2023 at 3:20 PM Daniel Vacek <neelx@redhat.com> wrote:
>
> Our customer reported the below warning whe using Clang v16.0.4 and
> C++20, on a code that includes the header "/usr/include/infiniband/verbs.h":
>
> error: bitwise operation between different enumeration types
> ('ibv_access_flags' and
> 'ib_uverbs_access_flags') is deprecated [-Werror,-Wdeprecated-enum-enum-conversion]
> mem->mr = ibv_reg_mr(dev->pd, (void*)start, len, IBV_ACCESS_LOCAL_WRITE);
>
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/include/infiniband/verbs.h:2514:19: note: expanded from macro 'ibv_reg_mr'
> ((access) & IBV_ACCESS_OPTIONAL_RANGE) == 0))
> ~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 error generated.
>
> According to the article "Clang 11 warning: Bitwise operation between
> different enumeration types is deprecated":
>
> C++20's P1120R0 deprecated bitwise operations between different enums.
> C++Such code is
> likely to become ill-formed in C++23. Clang 11 warns about such cases. It should be fixed.
>
> Reported-by: Rogerio Moraes <rogerio@cadence.com>
> Signed-off-by: Daniel Vacek <neelx@redhat.com>
> ---
> libibverbs/verbs.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index
> 03a7a2a7..ed9aed21 100644
> --- a/libibverbs/verbs.h
> +++ b/libibverbs/verbs.h
> @@ -2590,7 +2590,7 @@ __ibv_reg_mr(struct ibv_pd *pd, void *addr, size_t length, unsigned int access,
> #define ibv_reg_mr(pd, addr, length, access) \
> __ibv_reg_mr(pd, addr, length, access, \
> __builtin_constant_p( \
> - ((access) & IBV_ACCESS_OPTIONAL_RANGE) == 0))
> + ((int)(access) &
> + IBV_ACCESS_OPTIONAL_RANGE) == 0))
>
> /**
> * ibv_reg_mr_iova - Register a memory region with a virtual offset
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] verbs: fix compilation warning with C++20
2023-06-13 13:19 ` [PATCH v2] " Daniel Vacek
2023-06-20 9:19 ` Daniel Vacek
@ 2023-06-29 12:41 ` Daniel Vacek
2023-06-29 15:55 ` Jason Gunthorpe
2023-07-05 7:30 ` Leon Romanovsky
2 siblings, 1 reply; 13+ messages in thread
From: Daniel Vacek @ 2023-06-29 12:41 UTC (permalink / raw)
To: linux-rdma, Jason Gunthorpe; +Cc: Leon Romanovsky, Rogerio Moraes
Bump.
Was this forgotten or overlooked?
--nX
On Tue, Jun 13, 2023 at 3:20 PM Daniel Vacek <neelx@redhat.com> wrote:
>
> Our customer reported the below warning whe using Clang v16.0.4 and C++20,
> on a code that includes the header "/usr/include/infiniband/verbs.h":
>
> error: bitwise operation between different enumeration types ('ibv_access_flags' and
> 'ib_uverbs_access_flags') is deprecated [-Werror,-Wdeprecated-enum-enum-conversion]
> mem->mr = ibv_reg_mr(dev->pd, (void*)start, len, IBV_ACCESS_LOCAL_WRITE);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/include/infiniband/verbs.h:2514:19: note: expanded from macro 'ibv_reg_mr'
> ((access) & IBV_ACCESS_OPTIONAL_RANGE) == 0))
> ~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 error generated.
>
> According to the article "Clang 11 warning: Bitwise operation between different
> enumeration types is deprecated":
>
> C++20's P1120R0 deprecated bitwise operations between different enums. Such code is
> likely to become ill-formed in C++23. Clang 11 warns about such cases. It should be fixed.
>
> Reported-by: Rogerio Moraes <rogerio@cadence.com>
> Signed-off-by: Daniel Vacek <neelx@redhat.com>
> ---
> libibverbs/verbs.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h
> index 03a7a2a7..ed9aed21 100644
> --- a/libibverbs/verbs.h
> +++ b/libibverbs/verbs.h
> @@ -2590,7 +2590,7 @@ __ibv_reg_mr(struct ibv_pd *pd, void *addr, size_t length, unsigned int access,
> #define ibv_reg_mr(pd, addr, length, access) \
> __ibv_reg_mr(pd, addr, length, access, \
> __builtin_constant_p( \
> - ((access) & IBV_ACCESS_OPTIONAL_RANGE) == 0))
> + ((int)(access) & IBV_ACCESS_OPTIONAL_RANGE) == 0))
>
> /**
> * ibv_reg_mr_iova - Register a memory region with a virtual offset
> --
> 2.40.1
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] verbs: fix compilation warning with C++20
2023-06-29 12:41 ` Daniel Vacek
@ 2023-06-29 15:55 ` Jason Gunthorpe
0 siblings, 0 replies; 13+ messages in thread
From: Jason Gunthorpe @ 2023-06-29 15:55 UTC (permalink / raw)
To: Daniel Vacek; +Cc: linux-rdma, Leon Romanovsky, Rogerio Moraes
On Thu, Jun 29, 2023 at 02:41:16PM +0200, Daniel Vacek wrote:
> Bump.
>
> Was this forgotten or overlooked?
No, it just has to be processed manually if it is not a github PR..
Jason
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] verbs: fix compilation warning with C++20
2023-06-13 13:19 ` [PATCH v2] " Daniel Vacek
2023-06-20 9:19 ` Daniel Vacek
2023-06-29 12:41 ` Daniel Vacek
@ 2023-07-05 7:30 ` Leon Romanovsky
2023-07-05 8:40 ` Leon Romanovsky
2 siblings, 1 reply; 13+ messages in thread
From: Leon Romanovsky @ 2023-07-05 7:30 UTC (permalink / raw)
To: linux-rdma, Daniel Vacek; +Cc: Leon Romanovsky, Rogerio Moraes
On Tue, 13 Jun 2023 15:19:31 +0200, Daniel Vacek wrote:
> Our customer reported the below warning whe using Clang v16.0.4 and C++20,
> on a code that includes the header "/usr/include/infiniband/verbs.h":
>
> error: bitwise operation between different enumeration types ('ibv_access_flags' and
> 'ib_uverbs_access_flags') is deprecated [-Werror,-Wdeprecated-enum-enum-conversion]
> mem->mr = ibv_reg_mr(dev->pd, (void*)start, len, IBV_ACCESS_LOCAL_WRITE);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/include/infiniband/verbs.h:2514:19: note: expanded from macro 'ibv_reg_mr'
> ((access) & IBV_ACCESS_OPTIONAL_RANGE) == 0))
> ~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
> 1 error generated.
>
> [...]
Applied, thanks!
[1/1] verbs: fix compilation warning with C++20
https://git.kernel.org/rdma/rdma/c/9e5ccbfdd208a1
Best regards,
--
Leon Romanovsky <leonro@nvidia.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v2] verbs: fix compilation warning with C++20
2023-07-05 7:30 ` Leon Romanovsky
@ 2023-07-05 8:40 ` Leon Romanovsky
0 siblings, 0 replies; 13+ messages in thread
From: Leon Romanovsky @ 2023-07-05 8:40 UTC (permalink / raw)
To: linux-rdma, Daniel Vacek; +Cc: Rogerio Moraes
On Wed, Jul 05, 2023 at 10:30:12AM +0300, Leon Romanovsky wrote:
>
> On Tue, 13 Jun 2023 15:19:31 +0200, Daniel Vacek wrote:
> > Our customer reported the below warning whe using Clang v16.0.4 and C++20,
> > on a code that includes the header "/usr/include/infiniband/verbs.h":
> >
> > error: bitwise operation between different enumeration types ('ibv_access_flags' and
> > 'ib_uverbs_access_flags') is deprecated [-Werror,-Wdeprecated-enum-enum-conversion]
> > mem->mr = ibv_reg_mr(dev->pd, (void*)start, len, IBV_ACCESS_LOCAL_WRITE);
> > ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> > /usr/include/infiniband/verbs.h:2514:19: note: expanded from macro 'ibv_reg_mr'
> > ((access) & IBV_ACCESS_OPTIONAL_RANGE) == 0))
> > ~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
> > 1 error generated.
> >
> > [...]
>
> Applied, thanks!
>
> [1/1] verbs: fix compilation warning with C++20
> https://git.kernel.org/rdma/rdma/c/9e5ccbfdd208a1
The more accurate link is https://github.com/linux-rdma/rdma-core/pull/1367
Thanks
>
> Best regards,
> --
> Leon Romanovsky <leonro@nvidia.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2023-07-05 8:40 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-09 15:31 [PATCH] verbs: fix compilation warning with C++20 Daniel Vacek
2023-06-09 16:00 ` Jason Gunthorpe
2023-06-09 16:15 ` Daniel Vacek
2023-06-09 16:18 ` Jason Gunthorpe
2023-06-09 16:29 ` Daniel Vacek
2023-06-09 16:34 ` Jason Gunthorpe
2023-06-13 13:19 ` [PATCH v2] " Daniel Vacek
2023-06-20 9:19 ` Daniel Vacek
2023-06-20 11:09 ` Rogerio de Souza Moraes
2023-06-29 12:41 ` Daniel Vacek
2023-06-29 15:55 ` Jason Gunthorpe
2023-07-05 7:30 ` Leon Romanovsky
2023-07-05 8:40 ` Leon Romanovsky
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).