[issue16588] gcc 4.7 ilegitimate unused-but-set warnings on Python/thread_pthread.h

Jesús Cea Avión report at bugs.python.org
Sat Dec 1 06:08:33 CET 2012


Jesús Cea Avión added the comment:

The warning is legitimate. "error" is set to 0 at the beginning and it will be set to 1 if an error occurred (via CHECK_STATUS macro). But the variable "error" is never used in the function. So it is set, but never actually used in the function.

The obvious thing to do is to use the variable. For instance, with an "if (error) {}" do nothing construction.

Please, review the patch. I will commit it if another core developer thinks it is ok.

Python 2.7, 3.2, 3.3 and 3.4 affected.

It you think there is a better way of handling this, let me know.

PS: With the default compilation parameters (-O3), that empty "if" is optimized out, as it should.

----------
assignee:  -> jcea
keywords: +easy
nosy: +jcea
stage:  -> patch review
versions: +Python 2.7, Python 3.2, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16588>
_______________________________________


More information about the Python-bugs-list mailing list