summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Harris <pharris@opentext.com>2010-12-23 13:32:17 -0500
committerPeter Harris <pharris@opentext.com>2011-01-27 15:38:36 -0500
commitc2e023646298da05e212056fbc6b329e4dd9a100 (patch)
tree562e3ee35257e4d9b3402b2a35a5df650ed839a3
parent9efced72a3cb8072fa60fbed4f04d61cde412494 (diff)
Don't try to sizeof(void)
sizeof(void) is a gcc extension, and not portable. Xorg Bugzilla 31959 http://bugs.freedesktop.org/show_bug.cgi?id=31959 http://lists.freedesktop.org/archives/xcb/2010-May/006039.html Signed-off-by: Peter Harris <pharris@opentext.com> Tested-by: Cyril Brulebois <kibi@debian.org>
-rw-r--r--src/c_client.py13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/c_client.py b/src/c_client.py
index 91719b7..a10b3f1 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -1423,6 +1423,11 @@ def _c_accessor_get_expr(expr, field_mapping):
else:
return lenexp
+def type_pad_type(type):
+ if type == 'void':
+ return 'char'
+ return type
+
def _c_accessors_field(self, field):
'''
Declares the accessor functions for a non-list field that follows a variable-length field.
@@ -1457,7 +1462,7 @@ def _c_accessors_field(self, field):
else:
_c(' xcb_generic_iterator_t prev = %s;', _c_iterator_get_end(field.prev_varsized_field, 'R'))
_c(' return * (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);',
- field.c_field_type, field.first_field_after_varsized.type.c_type, field.prev_varsized_offset)
+ field.c_field_type, type_pad_type(field.first_field_after_varsized.type.c_type), field.prev_varsized_offset)
_c('}')
else:
_hc('')
@@ -1488,7 +1493,7 @@ def _c_accessors_field(self, field):
else:
_c(' xcb_generic_iterator_t prev = %s;', _c_iterator_get_end(field.prev_varsized_field, 'R'))
_c(' return (%s) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);',
- return_type, field.first_field_after_varsized.type.c_type, field.prev_varsized_offset)
+ return_type, type_pad_type(field.first_field_after_varsized.type.c_type), field.prev_varsized_offset)
_c('}')
@@ -1575,7 +1580,7 @@ def _c_accessors_list(self, field):
else:
_c(' xcb_generic_iterator_t prev = %s;', _c_iterator_get_end(field.prev_varsized_field, 'R'))
_c(' return (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index) + %d);',
- field.c_field_type, field.first_field_after_varsized.type.c_type, field.prev_varsized_offset)
+ field.c_field_type, type_pad_type(field.first_field_after_varsized.type.c_type), field.prev_varsized_offset)
_c('}')
_hc('')
@@ -1679,7 +1684,7 @@ def _c_accessors_list(self, field):
else:
_c(' xcb_generic_iterator_t prev = %s;', _c_iterator_get_end(field.prev_varsized_field, 'R'))
_c(' i.data = (%s *) ((char *) prev.data + XCB_TYPE_PAD(%s, prev.index));',
- field.c_field_type, field.c_field_type)
+ field.c_field_type, type_pad_type(field.c_field_type))
if switch_obj is None:
_c(' i.rem = %s;', _c_accessor_get_expr(field.type.expr, fields))
_c(' i.index = (char *) i.data - (char *) %s;', 'R' if switch_obj is None else 'S' )