[Python-Dev] Re: [Python-checkins] CVS: python/dist/src/Modules pypcre.c,2.18,2.19

Thomas Wouters thomas@xs4all.net
Thu, 6 Jul 2000 14:27:32 +0200

On Wed, Jul 05, 2000 at 11:40:15PM -0400, Barry A. Warsaw wrote:

> >>>>> "TP" == Tim Peters <tim_one@users.sourceforge.net> writes:

>     TP> Add more "volatile" decls to stop gcc -Wall warnings.
>     TP> Somebody w/ gcc please check that the wngs are gone!

> The ones in pypcre.c are gone, but there are still a bunch of other
> -Wall warnings, none of which I have time to look at right now.

I actually looked at most of these a couple of weeks back, and most are
harmless. For instance:

> -------------------- snip snip --------------------
> [...]
> gcc -g -Wall -I./../Include -I.. -DHAVE_CONFIG_H   -c bufferobject.c -o bufferobject.o
> bufferobject.c: In function `PyBuffer_New':
> bufferobject.c:174: warning: value computed is not used

	PyObject_INIT((PyObject *)b, &PyBuffer_Type);

The 'value computed' is useless. The value computed is computed by the ','
operator, but the only things in there are sideffect operators. The last
operation in the string of ',''s is either a void-returning function or an
assignment, so I'd classify this one as a cosmetic bug in gcc ;) adding a
'(void)' cast to the PyObject_INIT() macro or the calls to it would fix the

> gcc -g -Wall -I./../Include -I.. -DHAVE_CONFIG_H   -c classobject.c -o classobject.o
> classobject.c: In function `instance_dealloc':
> classobject.c:526: warning: unused variable `_Py_RefTotal'

Can be fixed by a surrounding #ifdef Py_TRACE_REFS.

> gcc -g -Wall -I./../Include -I.. -DHAVE_CONFIG_H   -c object.c -o object.o
> object.c: In function `_PyTrash_deposit_object':
> object.c:1172: warning: unused variable `hold'

Can be removed, seems to be left over from before Christians' trash hauling.

> gcc -g -Wall -I./../Include -I.. -DHAVE_CONFIG_H   -c pystate.c -o pystate.o
> pystate.c: In function `PyInterpreterState_New':
> pystate.c:45: warning: value computed is not used

Similar to PyObject_INIT(), but even sillier ;) Can be fixed in the same

> gcc  -g -Wall -I./../Include -I.. -DHAVE_CONFIG_H -c ./posixmodule.c
> ./posixmodule.c:496: warning: `posix_strint' defined but not used

Looks like an obsoleted helper function, for calling string-int-functions.
(Like posix_strintint, which is called in exactly one place.) Unsure if
these are leftover or intended for future use ;) If they are just leftover,
shouldn't we just make chown do the work posix_strintint does, and remove
those two functions ?

I also get a few others, by the way (redhat-6.1 supplied egcs-1.1.2):

ceval.c: In function `eval_code2':
ceval.c:333: warning: `opcode' might be used uninitialized in this function
ceval.c:334: warning: `oparg' might be used uninitialized in this function

The second one is fairly obvious: oparg is only initialized if opcode has an
argument, but gcc doesn't know when that is. So as far as gcc is concerned
it is possible to enter a branch that uses oparg without initializing it.

The opcode one is because it's possible as far as gcc is concerned, to jump
to on_error on the first iteration of the large for(;;) loop, before opcode
is initialized. This might actually be possible, I think, if a signal
arrives before the first time through the loop.

./pypcre.c: In function `compile_branch':
./pypcre.c:1222: warning: `c' might be used uninitialized in this function

Just looking at this one gave me a headache. This code can definately use a
good indent run, or better yet, replacement! </fwink>
I can't figure out why gcc complains about this one.

./socketmodule.c: In function `newSSLObject':
./socketmodule.c:1963: warning: unused variable `str'
./socketmodule.c: At top level:
./socketmodule.c:358: warning: `SSL_setattr' declared `static' but never defined

As you can see, I compile the socket module with SSL ;) Both of these can
be just removed, but I'm not sure howmuch of the SSL part is still 'work in

And then there's some warnings in _cursesmodule.c, _tkinter.c, gcmodule.c,
linuxaudiodev.c and tkappinit.c that the module maintainers should look at.
(nudge nudge.)

Thomas Wouters <thomas@xs4all.net>

Hi! I'm a .signature virus! copy me into your .signature file to help me spread!