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

Ran Benita ran234 at gmail.com
Mon Sep 1 00:49:53 PDT 2014


On Thu, Aug 28, 2014 at 11:04:45AM -0400, Peter Harris wrote:
> 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.

I haven't had time to read through this thread yet. But I think for the
sake of non-C users of the protocol files, it would be nice to eliminate
implicit padding inserted by the compiler as well. For that, gcc
-Wpadded can help. Here is the relevant output I get with current git
(64 bit, replaced ALIGNOF with __alignof__):


In file included from present.h:19:0,
                 from present.c:14:
sync.h:111:1: warning: padding struct size to alignment boundary [-Wpadded]
 } xcb_sync_systemcounter_t;
 ^
sync.h:171:1: warning: padding struct size to alignment boundary [-Wpadded]
 } xcb_sync_counter_error_t;
 ^
sync.h:186:1: warning: padding struct size to alignment boundary [-Wpadded]
 } xcb_sync_alarm_error_t;
 ^
sync.h:509:1: warning: padding struct size to alignment boundary [-Wpadded]
 } xcb_sync_create_fence_request_t;
 ^
In file included from glx.c:14:0:
glx.h:1262:1: warning: padding struct size to alignment boundary [-Wpadded]
 } xcb_glx_read_pixels_request_t;
 ^
glx.h:1833:1: warning: padding struct size to alignment boundary [-Wpadded]
 } xcb_glx_get_pixel_mapusv_reply_t;
 ^
glx.h:1854:1: warning: padding struct size to alignment boundary [-Wpadded]
 } xcb_glx_get_polygon_stipple_request_t;
 ^
glx.h:2104:1: warning: padding struct size to alignment boundary [-Wpadded]
 } xcb_glx_get_tex_image_request_t;
 ^
glx.h:2445:1: warning: padding struct size to alignment boundary [-Wpadded]
 } xcb_glx_get_color_table_request_t;
 ^
glx.h:2554:1: warning: padding struct size to alignment boundary [-Wpadded]
 } xcb_glx_get_convolution_filter_request_t;
 ^
glx.h:2664:1: warning: padding struct size to alignment boundary [-Wpadded]
 } xcb_glx_get_separable_filter_request_t;
 ^
glx.h:2703:1: warning: padding struct size to alignment boundary [-Wpadded]
 } xcb_glx_get_histogram_request_t;
 ^
glx.h:2813:1: warning: padding struct size to alignment boundary [-Wpadded]
 } xcb_glx_get_minmax_request_t;
 ^
In file included from sync.c:14:0:
sync.h:111:1: warning: padding struct size to alignment boundary [-Wpadded]
 } xcb_sync_systemcounter_t;
 ^
sync.h:171:1: warning: padding struct size to alignment boundary [-Wpadded]
 } xcb_sync_counter_error_t;
 ^
sync.h:186:1: warning: padding struct size to alignment boundary [-Wpadded]
 } xcb_sync_alarm_error_t;
 ^
sync.h:509:1: warning: padding struct size to alignment boundary [-Wpadded]
 } xcb_sync_create_fence_request_t;
 ^
In file included from xf86dri.c:14:0:
xf86dri.h:106:1: warning: padding struct size to alignment boundary [-Wpadded]
 } xcb_xf86dri_query_direct_rendering_capable_reply_t;
 ^
In file included from xinput.c:14:0:
xinput.h:722:1: warning: padding struct size to alignment boundary [-Wpadded]
 } xcb_input_ungrab_device_key_request_t;
 ^
In file included from xkb.c:14:0:
xkb.h:1686:1: warning: padding struct size to alignment boundary [-Wpadded]
 } xcb_xkb_select_events_details_t;
 ^
xkb.h:2700:1: warning: padding struct size to alignment boundary [-Wpadded]
 } xcb_xkb_get_device_info_reply_t;
 ^
In file included from xtest.c:14:0:
xtest.h:58:1: warning: padding struct size to alignment boundary [-Wpadded]
 } xcb_test_get_version_reply_t;
 ^


More information about the Xcb mailing list