← Back to team overview

dolfin team mailing list archive

Re: Removing a compiler warning

 

Which version of swig do you have?

I think what's required is that we allow different compiler flags for compiling the swig-generated code (e.g, no -Wall). g++ 4.3.1 won't compile the swig 1.3.35 generated code without warnings.

Garth

Harish Narayanan wrote:
(Resending this e-mail as a I'm uncertain if my earlier attempt made it across.)

When trying to compile the (huge, swig-generated) file
dolfin/swig/dolfin_wrap.cc, my compiler (Apple-tainted g++ 4.0.x)
tends to complain:

dolfin/swig/dolfin_wrap.cc: In member function
'swig::PySequence_Ref<T>::operator T() const [with T = dolfin::uint]':
dolfin/swig/dolfin_wrap.cc:4039: warning: 'v' may be used
uninitialized in this function

And, since warnings are being treated as errors, the build fails. The
relevant section of the file reads as follows:

static Type as(PyObject *obj, bool throw_error) {
     Type v;
     int res = asval(obj, &v);
     ...

v is being set by passing it via reference elsewhere, but the compiler
doesn't seem to realise this. So far, I've gotten around this by just
editing one line to read:

Type v = 0;

I was wondering if someone with greater swig-fu skills than I could
take a look at the appropriate swig interface file and have it generate
this line instead, if it's a reasonable thing to do.

Harish
_______________________________________________
DOLFIN-dev mailing list
DOLFIN-dev@xxxxxxxxxx
http://www.fenics.org/mailman/listinfo/dolfin-dev



References