[Xcb] Question about XML spec, and QueryExtension

Peter Harris peter.harris at hummingbird.com
Tue Aug 26 08:52:44 PDT 2008


Antoine Latter wrote:
> On Mon, Aug 25, 2008 at 9:07 AM, Peter Harris
> <peter.harris at hummingbird.com> wrote:
>> There is a bug in the XML (missing padding), but the C compiler
>> fortuitously papers-over the bug by automatically aligning the
>> structure. Not all C compilers do this, so the bug needs to be fixed
>> regardless.
> 
> I don't know a lot about the C-code generator - does this mean that if
> the XML were correct the emitted C code would continue to be correct?

Better than that. If the XML were correct, the emitted C code would
become correct for compilers that don't add padding.

As it stands now, the emitted C code is strictly incorrect. In practise,
most C compilers add the right amount of padding by default for
performance reasons, so it hasn't been a problem. However, it is
currently possible to compile a non-functional libXCB by using, say,
"icc -Zp1" instead of gcc.

If the padding is made explicit in the XML, and by extension the
generated C, then libXCB will function correctly regardless of the
compiler pad setting.

> Or would we need to patch both the XML and the code-gen at the same
> time?

No need to patch the code-gen.

Peter Harris
-- 
     Hummingbird Connectivity - A Division of Open Text
Peter Harris                    http://connectivity.hummingbird.com
Research and Development        Phone: +1 905 762 6001
peter.harris at hummingbird.com    Toll Free: 1 877 359 4866


More information about the Xcb mailing list