Re: [PATCH rdma-core 1/8] verbs: Annoate ibv_wc helpers with endian

Jason Gunthorpe
2017-07-19T16:53:51Z

On Thu, Jul 13, 2017 at 09:50:57AM +0300, Leon Romanovsky wrote:

> > +static inline uint32_t ibv_wc_read_invalidated_rkey(struct ibv_cq_ex *cq)
> > +{
> > +#ifdef __CHECKER__
> > + return (__attribute__((force)) uint32_t)cq->read_imm_data(cq);
> > +#else
> > + return cq->read_imm_data(cq);
> > +#endif
> > +}
>
> I don't think that those __CHECKER__ ifdefs should be part of the code.
> They are part of infrastructure to support development of library, but
> are not required for the user of that library.

I don't see a way to get rid of it here and keep the ABI the same.

__CHECKER__ is safe to use because we already rely on it being defined
sensibly when we include linux/types.h and use __be32 in the public
header.

If we try and drop it post-install or something then we are really
just blocking downstream projects from also using sparse, I don't see
the point in doing that...

Jason