[Xcb] xcb-proto commit f91186b9f3 (dri2 padding) breaks build
Vincent Torri
vtorri at univ-evry.fr
Mon May 17 20:36:28 PDT 2010
On Mon, 17 May 2010, Alan Coopersmith wrote:
> I cannot build libxcb when commit f91186b9f3e55e1d478476749c929b86e2865cc8
> is present, but going back to the previous commit allows it to build fine.
>
> With that commit in place, building gives the error:
>
> "dri2.c", line 332: cannot take sizeof void
>
> The code from the generated dri2.c here is:
>
> 328 void *
> 329 xcb_dri2_connect_alignment_pad (const xcb_dri2_connect_reply_t *R /**< */)
> 330 {
> 331 xcb_generic_iterator_t prev = xcb_dri2_connect_driver_name_end(R);
> 332 return (void *) ((char *) prev.data + XCB_TYPE_PAD(void, prev.index)
> + 0);
> 333 }
>
> After cpp expansion the last line has become:
>
> return (void *) ((char *) prev.data + ( - ( prev . index ) & ( sizeof ( void )
>> 4 ? 3 : sizeof ( void ) - 1 ) ) + 0);
>
> and like the compiler, I have no idea what size a "void" is.
>
> Is something wrong in the code generator that's generating different code here
> for me, or does gcc allow taking the size of sizeless types like void?
it's a gcc extension: sizeof(void) == 1 and arithmetic on void pointers is
like on unsigned char pointers. suncc does not support that (and i hope
that it will never support such weirdness).
See:
http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Pointer-Arith.html#Pointer-Arith
Alan: fwiw, I've already asked that in the tools-compilers ML (subject :
'about the warning "pointer to void or function used in arithmetic"')
regards
Vincent
>
> (I'm building on OpenSolaris with the Sun compilers.)
>
> --
> -Alan Coopersmith- alan.coopersmith at oracle.com
> Oracle Solaris Platform Engineering: X Window System
>
> _______________________________________________
> Xcb mailing list
> Xcb at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/xcb
>
>
More information about the Xcb
mailing list