From: Jason Gunthorpe <jgg@ziepe.ca>
To: Daniel Vacek <neelx@redhat.com>
Cc: linux-rdma@vger.kernel.org, Leon Romanovsky <leon@kernel.org>,
Rogerio Moraes <rogerio@cadence.com>
Subject: Re: [PATCH] verbs: fix compilation warning with C++20
Date: Fri, 9 Jun 2023 13:34:03 -0300 [thread overview]
Message-ID: <ZINUe30DbtnUuLOZ@ziepe.ca> (raw)
In-Reply-To: <CACjP9X8pYqxTGQvqnqK6CWqTuy4BZBr_Ze0rfniJ8LOYUsLCog@mail.gmail.com>
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
next prev parent reply other threads:[~2023-06-09 16:34 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZINUe30DbtnUuLOZ@ziepe.ca \
--to=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=neelx@redhat.com \
--cc=rogerio@cadence.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.