[Xcb] [PATCH libxcb] no typename for nested structs

Christian Linhart chris at demorecorder.com
Wed Sep 3 01:10:49 PDT 2014


Nested structs which are generated for named case and bitcase
do not get a typename anymore, i.e., they are anonymous structs.

Reasons for this change:
* Prior typenames have caused nameclashes
* Prior typenames introduced names in the global namespace which
  did not start with the xcb prefix.

This change is safe with respect to API compatibility because:
I have searched for instances of named bitcases and there's only one place
where they are used, and that's in xkb.xml: reply GetKbdByName.
( no need to search for <case> because it was introduced after the last release )

The reply GetKbdByName is broken in its current form in the xkb.xml anyways, 
so it is most probably not used anywhere.

So, my conclusion is that we can safely omit named types for nested structs.
No need for an attribute.
---
 src/c_client.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/c_client.py b/src/c_client.py
index 883a77c..9216c7f 100644
--- a/src/c_client.py
+++ b/src/c_client.py
@@ -1797,15 +1797,15 @@ def _c_complex(self, force_packed = False):
     if not self.is_switch:
         for field in struct_fields:
             _c_complex_field(self, field)
     else:
         for b in self.bitcases:
             space = ''
             if b.type.has_name:
-                _h('    struct _%s {', b.c_field_name)
+                _h('    struct {')
                 space = '    '
             for field in b.type.fields:
                 _c_complex_field(self, field, space)
             if b.type.has_name:
                 _h('    } %s;', b.c_field_name)
 
     _h('} %s%s;', 'XCB_PACKED ' if force_packed else '', self.c_type)
-- 
2.0.1



More information about the Xcb mailing list