[Xcb] [PATCH libxcb] no typename for nested structs
Ran Benita
ran234 at gmail.com
Tue Sep 9 10:14:45 PDT 2014
On Wed, Sep 03, 2014 at 10:10:49AM +0200, Christian Linhart wrote:
> 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.
I can safely say that this one is definitely not used.
> So, my conclusion is that we can safely omit named types for nested structs.
> No need for an attribute.
Nice that this has a clean and easy solution for a change :)
Reviewed-by: Ran Benita <ran234 at gmail.com>
> ---
> 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
>
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb
More information about the Xcb
mailing list