[Mesa-dev] Compile error in nir/nir_builder.h in current head

Emil Velikov emil.l.velikov at gmail.com
Thu Sep 17 08:21:43 PDT 2015


On 17 September 2015 at 14:34, Rob Clark <robdclark at gmail.com> wrote:
> On Thu, Sep 17, 2015 at 9:27 AM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>> Hi Gottfried,
>>
>> On 17 September 2015 at 13:42, Gottfried Haider
>> <gottfried.haider at gmail.com> wrote:
>>> I am getting this error on 7e286506 - comping mesa used to work fine
>>> on this system a couple of weeks ago
>>>
>>>   CXX    nir/nir_lower_samplers.lo
>>>   CC     nir/nir_lower_system_values.lo
>>> In file included from nir/nir_lower_samplers.cpp:27:0:
>>> nir/nir_builder.h: In function 'nir_ssa_def*
>>> nir_imm_float(nir_builder*, float)':
>>> nir/nir_builder.h:79:28: error: expected primary-expression before '.' token
>>> nir/nir_builder.h:79:44: warning: extended initializer lists only
>>> available with -std=c++0x or -std=gnu++0x [enabled by default]
>>> nir/nir_builder.h: In function 'nir_ssa_def*
>>> nir_imm_vec4(nir_builder*, float, float, float, float)':
>>> nir/nir_builder.h:86:28: error: expected primary-expression before '.' token
>>> nir/nir_builder.h:86:44: warning: extended initializer lists only
>>> available with -std=c++0x or -std=gnu++0x [enabled by default]
>>> nir/nir_builder.h: In function 'nir_ssa_def* nir_imm_int(nir_builder*, int)':
>>> nir/nir_builder.h:93:28: error: expected primary-expression before '.' token
>>> nir/nir_builder.h:93:44: warning: extended initializer lists only
>>> available with -std=c++0x or -std=gnu++0x [enabled by default]
>>> Makefile:1525: recipe for target 'nir/nir_lower_samplers.lo' failed
>>>
>> This is caused with the introduction of
>>
>> commit ef8eebc6ad5d86e524426f0755c0f7d0b4c0cd3e
>> Author: Timothy Arceri <t_arceri at yahoo.com.au>
>> Date:   Wed Aug 26 22:18:36 2015 +1000
>>
>>    nir: support indirect indexing samplers in struct arrays
>>
>> The commit adds nir_builder.h to nir_lower_samplers.cpp, with the
>> former containing designated initializer(s). As this is not allowed by
>> the the standard (albeit some compilers allow it) you see the error.
>> From a very quick look I cannot see any specific reason why we cannot
>> rename the file to nir_lower_samplers.c, although someone more
>> familiar with the code will be the judge :-)
>
> looks like it is calling c++ stuff, so would at least need some
> wrapper code to be converted to .c..  probably better to just fix
> nir_builder.h
>
Considering the amount of

extern "C" {
#include <foo.h>
}

'hacks' I've went ahead and 'converted' nir_lower_samplers but using a
trivial one-line C wrapper.
This doesn't mean that we cannot remove/rework the c99 initializer
from the header though :-)

Cheers,
Emil


More information about the mesa-dev mailing list