[Xcb] [PATCH proto 2/2] xinput: rep QueryDeviceState struct InputState: full support

Peter Harris pharris at opentext.com
Thu Aug 28 08:04:45 PDT 2014


On 2014-08-28 10:09, Christian Linhart wrote:
> On 08/26/14 10:16, Daniel Martin wrote:
> 
>>> -    <struct name="InputState">
>>> +    <struct name="InputState" implicit-padding="false">
>>
>> Adding an explicit attribute to trigger implicit stuff where we
>> could use an explicit <pad align> at the end of the struct or
>> better: in the 2 cases where it's necessary doesn't sound
>> right to me.
> 
> The problem is that the implicit stuff is enabled by default.
> 
> Here, we disable it. 
> So we cannot work around with adding <pad align>.
> 
> But I agree that it is not the ideal solution.
> 
> Alternatives are:
> * alternative A:
>   disable implicit padding in completely,
>   except of the padding of C-structs by the compiler.
> 
>   Peter Harris said in another messaage of this thread
>   that it can be completely disabled because it is a noop
>   if the previous field is already aligned.
>   And I agree with him.
> 
>   So it *should* be a noop everywhere.
> 
>   The problem is that testing and verification 
>   can be a huge effort.

I prefer explicit padding only.

If there is general consensus that we are going to remove implicitly
generated padding code, I'll spend the day or two necessary to review
the diff of the generated code.

There are many diff hunks, but review goes quickly because all (or at
least most; I haven't seen a counter-example yet) of them are obviously
noop.

>   solution 2:
>     derive the padding-offset from the pointer which is passed
>     to functions like serialize, unpack, sizeof.

This makes more sense to me than solution 1.

> ***
> 
> Which alternative of 
> * generally disabling implicit-padding
> * or fixing the switch-alignment
> should we choose?
> 
> Or should we choose both alternatives?

I suspect that we'll need both alternatives, since an accurate offset
will be needed for any <pad align> tokens that appear within a <case>.

Peter Harris
-- 
               Open Text Connectivity Solutions Group
Peter Harris                    http://connectivity.opentext.com/
Research and Development        Phone: +1 905 762 6001
pharris at opentext.com            Toll Free: 1 877 359 4866


More information about the Xcb mailing list