[Mesa-dev] Odd error while compiling Haiku softpipe wrapper code
Brian Paul
brianp at vmware.com
Mon Nov 26 09:43:24 PST 2012
On 11/25/2012 08:14 AM, Alexander von Gluck IV wrote:
> 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.
The "#define offsetof" in x86/gen_matypes.c should have no connection
to this. Another thing you might try is to put
#define offsetof(x,y) foo
in draw/draw_vertex.h before the first use of the macro. The compiler
should complain about a macro being redefined and tell you where the
first definition was found.
-Brian
More information about the mesa-dev
mailing list