[Pyrex] Compiling Pyrex generated code breaks with GCC4.0

John (J5) Palmieri johnp at redhat.com
Wed Mar 9 23:41:37 CET 2005


On Wed, 2005-03-09 at 10:33, John (J5) Palmieri wrote:
> Not sure if you guys are aware of this but Red Hat has just moved their
> development branch to compiling with GCC 4.0.  I ran into problem
> recompiling the D-Bus python bindings which are written in Pyrex. 
> Basically GCC 4.0 is very strict about using casts especially casting
> lvalues (which is the errors I get).  I'm going to look into it further
> to see if I can't provide a patch when I find time.  Just want to find
> out if it is a known problem and if anyone already made a fix.  Thanks.
> 
> --
> J5
> 

Looking through the code there are a number of places where casts are
added to the left hand side of an expression.  This is illegal in
gcc4.0.  The code needs to be re-factored so when casts are needed they
are applied to right hand side of the expression.  For instance take
this snippet of code from the dbus bindings:

(struct __pyx_vtabstruct_13dbus_bindings_Connection *)p->__pyx_vtab =
__pyx_vtabptr_13dbus_bindings_Connection;

It should be re-factored as:

p->__pyx_vtab = (struct __pyx_vtabstruct_13dbus_bindings_Connection
*)(__pyx_vtabptr_13dbus_bindings_Connection);

Looking at the code I couldn't figure out how to do this save passing
the output through a post processor afterwords which would be a hack. 
If someone could point me in the right direction or someone who knows
the code better could make this fix that would be great.

--
J5




More information about the Pyrex mailing list