[Python-Dev] gcc barfs on recent stringobject changes...
Tim Peters
tim.one@home.com
Wed, 9 May 2001 03:42:00 -0400
[Mark Favas]
> Changes in the last few hours (hi Tim!)
Hi Mark! Sorry about that!
> to stringobject compile (I'd guess) on MS
You guess right -- and under two flavors of Windows <wink>.
> (and on Compaq's Tru64 compiler),
Figures.
> but produce the following with gcc on Solaris and FreeBSD:
>
> gcc -c -g -O2 -Wall -Wstrict-prototypes -I. -I./Include
> -DHAVE_CONFIG_H -o Objects/stringobject.o Objects/stringobject.c
> Objects/stringobject.c: In function `PyString_FromStringAndSize':
> Objects/stringobject.c:76: invalid lvalue in unary `&'
> Objects/stringobject.c:80: invalid lvalue in unary `&'
> Objects/stringobject.c: In function `PyString_FromString':
> Objects/stringobject.c:130: invalid lvalue in unary `&'
> Objects/stringobject.c:134: invalid lvalue in unary `&'
> *** Error code 1
Fair enough: I tried to use a cast as an lvalue in those 4 places, all of
the form:
PyString_InternInPlace(&(PyObject *)op);
where op is declared PyStringObject*. Strictly speaking, that ain't legal,
but changing it to:
PyObject *t = (PyObject *)op;
PyString_InternInPlace(&t);
is. You may wonder WTF the difference is. That's easy: the rewrite doesn't
use a cast expression as an lvalue <wink>.
sensible-or-not-it's-checked-in-so-please-try-again-ly y'rs - tim