All of lore.kernel.org
 help / color / mirror / Atom feed
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:00:57 -0300	[thread overview]
Message-ID: <ZINMuV+XhTCnnlK+@ziepe.ca> (raw)
In-Reply-To: <20230609153147.667674-1-neelx@redhat.com>

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

  reply	other threads:[~2023-06-09 16:01 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 [this message]
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

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=ZINMuV+XhTCnnlK+@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.