Message ID | 20230613131931.738436-1-neelx@redhat.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [v2] verbs: fix compilation warning with C++20 | expand |
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 >
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 >
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 >
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
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,
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>
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
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(-)