[Mesa-dev] Odd error while compiling Haiku softpipe wrapper code

Alexander von Gluck IV kallisti5 at unixzen.com
Sun Nov 25 07:14:57 PST 2012


On 2012-11-24 5:38 pm, Alexander von Gluck IV wrote:
> I'm working on some wrapper code for Haiku softpipe driver, and I
> stumbled across the following strange build error when including
> sp_context.h: (Mesa 9.0)
>
> In file included from
> 
> ../../../../generated/build_packages/mesa-9.0-x86-gcc4-2012-11-17/src/gallium/drivers/softpipe/sp_context.h:36:0,
>                  from HaikuSoftPipe.cpp:14:
> 
> ../../../../generated/build_packages/mesa-9.0-x86-gcc4-2012-11-17/src/gallium/auxiliary/draw/draw_vertex.h:
> In function 'size_t draw_vinfo_size(const vertex_info*)':
> 
> ../../../../generated/build_packages/mesa-9.0-x86-gcc4-2012-11-17/src/gallium/auxiliary/draw/draw_vertex.h:96:11:
> error: 'a' cannot appear in a constant-expression
> 
> ../../../../generated/build_packages/mesa-9.0-x86-gcc4-2012-11-17/src/gallium/auxiliary/draw/draw_vertex.h:96:11:
> error: '->' cannot appear in a constant-expression
>
>
> The error seems pretty cut and dry... not sure why Gallium compiles
> though.  The only thing I can think of is that maybe Mesa throws in
> some buildflag to ignore the error or there is a missing header
> dependency in auxiliary/draw/draw_vertex.h.

I figured this one out.. I saw that offsetof was redefined in 
x86/gen_matypes.c. I'm not seeing the code path
to that redefined offsetof making it to draw/draw_vertex.h... however 
redefining offsetof in my code before
loading the header that loads draw/draw_vertex.h seemed to fix the 
problem.

Anyone know why draw/draw_vertex.h depends on a redefine of a standard 
C11 function in a completely
different C file? Seems a little sketchy.

  -- Alex


More information about the mesa-dev mailing list