[Xcb] [PATCH proto 2/3] sync: Use packed attribute for SYSTEMCOUNTER

Daniel Martin consume.noise at gmail.com
Sun Dec 23 04:51:49 PST 2012


SYSTEMCOUNTER mustn't be aligned. Its size is 14bytes (COUNTER +
INT64 + CARD16).

See sz_xSyncSystemCounter:
  http://cgit.freedesktop.org/xorg/proto/xextproto/tree/syncproto.h#n140
and Bug #23403:
  https://bugs.freedesktop.org/show_bug.cgi?id=23403

Signed-off-by: Daniel Martin <consume.noise at gmail.com>
---
 src/sync.xml | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/sync.xml b/src/sync.xml
index 516d149..56ef48e 100644
--- a/src/sync.xml
+++ b/src/sync.xml
@@ -46,7 +46,10 @@ for licensing information.
     <field type="CARD32" name="lo" />
   </struct>
 
-  <struct name="SYSTEMCOUNTER">
+  <struct name="SYSTEMCOUNTER" packed="true">
+    <!-- The size of SYSTEMCOUNTER (without the name) is 14bytes. gcc would
+         align it to 16bytes. To prevent this, we need to add the packed
+         attribute. -->
     <field type="COUNTER" name="counter" />
     <field type="INT64" name="resolution" />
     <field type="CARD16" name="name_len" />
-- 
1.8.0.2



More information about the Xcb mailing list