[Xcb] xproto test failed

Peter Harris git at peter.is-a-geek.org
Mon Feb 16 18:46:12 PST 2009


On Mon, Feb 16, 2009 at 6:39 PM, Barton C Massey wrote:
> In message <eaa105840902161131m76156a01y60e10cd5ff719638 at mail.gmail.com> you wrote:
>> On Mon, Feb 16, 2009 at 12:56 PM, Barton C Massey wrote:
>> >
>> > I'm not quite seeing where the codegen has been fixed to use
>> > the new XML, though?  Am I missing something?
>>
>> The enum annotations are entirely for the benefit of languages (unlike
>> C) that have typesafe enums. The C codegen should silently ignore the
>> new annotations.
>
> So, yes. :-) It seems like it might be nice to modify the C
> codegen to use the new annotations also, though?  Can't the
> new annotations be used to do things like automatically
> generate union types for altenums?  Or am I still confused?

I think you're still confused. "altenum" is for types like "WINDOW,
but may also contain the magic values None or CopyFromParent", or
"ATOM, but may also contain the magic value Any". So on the C side, it
needs to be an XID.

If you make a union out of that, the compiler is free to turn the XID
part into garbage, and then your on-wire will be broken (unless you
start adding flags to indicate which part of the union you used, which
would break the current API and ABI, and just generally make libxcb
harder to use).

Honestly, altenum wasn't my idea. But it's not a terrible idea, and I
figured I could get more discussion out of implementing it than by
trying to attract more people to this thread (linked to the message
that prompted me to cook up 'altenum'):
http://lists.freedesktop.org/archives/xcb/2009-January/004226.html
That thread just died as soon as I proposed altenum.

It's not too late to decide that 'altenum' sucks, and we should just
use 'enum'. I kinda like the idea of altenum, but I'm not married to
it.

It's also not too late to change the name of altenum. 'partenum'?
'xidenum'? 'enumref'? 'bikeshed'? :-)


Once I finish this pass of annotations (both to xproto and the
extensions), my Grand Plan is to start adding type annotations to
enums themselves, and attach those enums to <valueparam>s. This would
allow us to auto-generate xcb/util/aux's xcb_aux_create_window (and
xcb_params_cw_t) and friends if we wanted to. But that's in the rather
distant future (unless someone else steps in, of course).

> Thanks huge for working on this.

Thanks huge for reviewing all of this.

Peter Harris


More information about the Xcb mailing list