Re: [PATCH v3] IB/uverbs: Add UVERBS_ATTR_FLAGS_IN to the specs language

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 29, 2018 at 11:19:00AM +0300, Leon Romanovsky wrote:
> On Thu, Jul 26, 2018 at 04:37:14PM -0600, Jason Gunthorpe wrote:

> > +/*
> > + * An input value that is a bitwise combination of values of _enum_type.
> > + * This permits the flag value to be passed as either a u32 or u64, it must
> > + * be retrieved via uverbs_get_flag().
> > + */
> > +#define UVERBS_ATTR_FLAGS_IN(_attr_id, _enum_type, ...)                        \
> > +	UVERBS_ATTR_PTR_IN(                                                    \
> > +		_attr_id,                                                      \
> 
> Why did you put BUILD_BUG_ON_ZERO into UVERBS_ATTR_SIZE?
> Wasn't it be better to write it like this?
>  +		BUILD_BUG_ON_ZERO(!sizeof(_enum_type *)); \
>  +		UVERBS_ATTR_SIZE(sizeof(u32), sizeof(u64)),                 \
>  +		__VA_ARGS__)

That wouldn't compile, this macro expands within an expression
initializer context.

The whole point of _ZERO is to use it exactly this way, in an
expression.

Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux