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

Christian Linhart chris at DemoRecorder.com
Thu Sep 4 02:06:19 PDT 2014


On 09/01/14 09:49, Ran Benita wrote:
> 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. 
Yes, that'd be good.
non-C users may not have something that adds the same implicit padding.

But also for C, it will also reduce our dependency on the padding strategy 
of a specific compiler or of specific compiler settings.

> For that, gcc
> -Wpadded can help. Here is the relevant output I get with current git
> (64 bit, replaced ALIGNOF with __alignof__):
That's very helpful.

In addition to that: A bit more than a week ago 
I have been starting to write a tool which can check alignment errors
and some other automatically detectable problems.

It can detect implict pads which will be inserted by the compiler,
but also mis-alignment in the var-sized parts,
and factor in the effects of lists, switches etc properly.

Misalignments in the var-sized parts are most probably
errors in the xml-protocol-def. 
And the otherwise NOOP implicit padding will cause padding
after misaligned fields...

The tool is written in python and can be incluced in xcb/proto,
so it can ultimately be included in "make check",
once we'll have fixed most of the stuff reported by that tool.

This is kind of a side-project, so it'll probably take a while
until it is ready for posting here.

Chris

> 
> 
> 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;
>  ^
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb
> 



More information about the Xcb mailing list