On 16.04.2024 00:15, Stefano Stabellini wrote:
> On Mon, 15 Apr 2024, Andrew Cooper wrote:
>> RFC.  In theory this is a great way to avoid some of the spiketraps involved
>> with C being the official representation.
>>
>> However, this doesn't build.  gnttab_transfer has a layout that requires a
>> CONFIG_COMPAT if we want to satisfy -Wpadding for both forms of the 
>> structure.
>>
>> Thoughts on whether this cross-check is worthwhile-enough to warrant the
>> ifdefary?
> 
> I like this patch and I think we have no choice but going in this
> direction and adding all the padding explicitly with any related
> necessary ifdefary.
> 
> The only question for me is whether to:
> 
> 1) add -Wpadding
> 2) add __packed__
> 3) do both
> 
> I think it is important to add __packed__ to the headers to clear out
> any misconceptions about possible hidden paddings and get a
> correct-by-default behavior for anyone that would import the headers
> into their own projects.
> 
> The only issue is that __packed__ makes -Wpadding not useful. We could
> technically add both if we disable __packed__ for the -Wpadding build.
> For instance we could use __packed which is defined by Xen, and change
> the definition of __packed to nothing for the -Wpadding build.

The other issue is that __packed__ isn't standard C, yet we intend the
public header to be plain C89 compatible.

Jan

Reply via email to