[issue10951] gcc 4.6 warnings
Martin v. Löwis added the comment: I don't mind them being backported, in the spirit of supporting newer tools well in 2.7. OTOH, I don't see it as necessary, either. 2.7 will eventually be phased out, and then it doesn't matter how much warnings it produces. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10951 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10951] gcc 4.6 warnings
Serhiy Storchaka added the comment: What about backporting this fixes to 2.7? -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10951 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10951] gcc 4.6 warnings
STINNER Victor added the comment: fix_2warnings.diff: I don't like statement like (void)err; to kill a compiler warning. I prefer GCC __attribute__((unused)) using a macro instead. About the change on unicode_fromascii, the code changed a lot since the patch was written. The patch is outdated and not really interesting. Please open a new issue with a new patch if there are remaining warnings. I'm closing the issue because I agree with Martin von Loewis, it's better to open new issues for each warning (warning class?). -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10951 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10951] gcc 4.6 warnings
Changes by STINNER Victor victor.stin...@gmail.com: -- resolution: - fixed status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10951 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10951] gcc 4.6 warnings
Martin Pool added the comment: Hi, Martin, On 20 August 2012 05:25, Martin v. Löwis rep...@bugs.python.org wrote: Martin v. Löwis added the comment: (As usual), I'm quite skeptical about this bulk bug report; it violates the one bug at a time principle, where one bug can roughly be defined as cannot be split into smaller independent issues. I heartily agree with you in general: as well as being non-atomic, it's also hard to have a clear test whether such bugs are fixed. But, I hope this patch has some value even if the bug is not a great example. For the cases at hand, I think it would be best if somebody with gcc 4.6 available just fixed the easy ones, i.e. where the code clearly improves when silenciing the warning. In these cases, I wouldn't mind if they get checked in without code review; I know some favor review for all changes, in which case a separate issue should be opened for a patch fixing a bunch of these. I've fixed what I believe to be all the safe/easy warnings in my patch above. I would appreciate if someone would review it and if possible commit it. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10951 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10951] gcc 4.6 warnings
Martin v. Löwis added the comment: (As usual), I'm quite skeptical about this bulk bug report; it violates the one bug at a time principle, where one bug can roughly be defined as cannot be split into smaller independent issues. For the cases at hand, I think it would be best if somebody with gcc 4.6 available just fixed the easy ones, i.e. where the code clearly improves when silenciing the warning. In these cases, I wouldn't mind if they get checked in without code review; I know some favor review for all changes, in which case a separate issue should be opened for a patch fixing a bunch of these. The more difficult ones may deserve their own issues (e.g. when it is debatable whether gcc is right to warn about the code) -- nosy: +loewis ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10951 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10951] gcc 4.6 warnings
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 2f10c1ad4b21 by Ross Lagerwall in branch 'default': Issue #10951: Fix warnings in the socket module. http://hg.python.org/cpython/rev/2f10c1ad4b21 New changeset 1dd43e939c07 by Ross Lagerwall in branch 'default': Issue #10951: Fix compiler warnings in _sre.c http://hg.python.org/cpython/rev/1dd43e939c07 -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10951 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10951] gcc 4.6 warnings
Jérémy Anger kidan...@gmail.com added the comment: I've fixed two more warnings, see my patch. (gcc 4.6.2) -- nosy: +kidanger Added file: http://bugs.python.org/file24004/fix_2warnings.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10951 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10951] gcc 4.6 warnings
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset d7862e855274 by Victor Stinner in branch '3.2': Issue #10951: Fix a compiler warning in timemodule.c http://hg.python.org/cpython/rev/d7862e855274 New changeset 49b85dba251d by Victor Stinner in branch 'default': Issue #10951: Fix compiler warnings in timemodule.c and unicodeobject.c http://hg.python.org/cpython/rev/49b85dba251d -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10951 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10951] gcc 4.6 warnings
Martin Pool m...@sourcefrog.net added the comment: My patch above fixes all the messages so that you get a clean build with the current makefile. -Wuninitialized and 'offset outside constant string' would be worth fixing but I can't reproduce them in Python. I'm personally not so keen on fixing all the signed/unsigned comparisons unless they're checked by the default build, because in my experience that has a pretty low payoff and some chance of introducing errors. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10951 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10951] gcc 4.6 warnings
Martin Pool m...@sourcefrog.net added the comment: this fixes the pickle warnings, and cleans up some (I'm pretty sure) dead code in there. the pickle tests all pass. -- keywords: +patch nosy: +poolie Added file: http://bugs.python.org/file22980/20110822-1150-python-warnings.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10951 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10951] gcc 4.6 warnings
Martin Pool m...@sourcefrog.net added the comment: This fixes every compiler warning so that Python build with -Werror on Ubuntu Oneiric alpha (gcc 4.6.1-7ubuntu1). * PyMem_Resize is a macro that mutates its first argument; the return value shouldn't be used. * Some variables in sre are (apparently harmlessly) not used when validating the opcodes. * gethostbyname_r return codes weren't used and should be; it is not guaranteed to set h_errno correctly (though it does seem to do so here) * a few vairables in pthread and tkappintr are not used in some preprocessor productions. * setup.py should detect linux kernel 3.0 as linux, and therefore able to build ossaudiodev I don't get all the errors mentioned by haypo. At least some seem already fixed. -- Added file: http://bugs.python.org/file22985/20110822-1352-gcc-warnings.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10951 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10951] gcc 4.6 warnings
Terry J. Reedy tjre...@udel.edu added the comment: I can see how a comment like /* spam = eggs + ham */ could be useful, but and isolated /* foo = 0 */ where 'foo' appears nowhere else in the file seems more like confusing noise. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10951 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10951] gcc 4.6 warnings
Brett Cannon br...@python.org added the comment: You're right, Terry. It's a judgment call as to what should be simply deleted compared to commented out. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10951 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10951] gcc 4.6 warnings
STINNER Victor victor.stin...@haypocalc.com added the comment: gcc 4.6 bug has been fixed (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47271). So setup.py can compile extensions using gcc 4.6, and here are new warnings: --- building dbm using bdb /home/haypo/prog/GIT/py3k/Modules/_pickle.c: In function 'load': /home/haypo/prog/GIT/py3k/Modules/_pickle.c:5267:9: warning: case value '0' not in enumerated type 'enum opcode' [-Wswitch] /home/haypo/prog/GIT/py3k/Modules/_csv.c: In function 'parse_grow_buff': /home/haypo/prog/GIT/py3k/Modules/_csv.c:537:21: warning: operation on 'self-field' may be undefined [-Wsequence-point] /home/haypo/prog/GIT/py3k/Modules/_csv.c: In function 'join_check_rec_size': /home/haypo/prog/GIT/py3k/Modules/_csv.c:1058:23: warning: operation on 'self-rec' may be undefined [-Wsequence-point] /home/haypo/prog/GIT/py3k/Modules/_posixsubprocess.c:4:0: warning: _GNU_SOURCE redefined [enabled by default] ./pyconfig.h:1151:0: note: this is the location of the previous definition /home/haypo/prog/GIT/py3k/Modules/socketmodule.c: In function 'socket_gethostbyname_ex': /home/haypo/prog/GIT/py3k/Modules/socketmodule.c:3318:9: warning: variable 'result' set but not used [-Wunused-but-set-variable] /home/haypo/prog/GIT/py3k/Modules/socketmodule.c: In function 'socket_gethostbyaddr': /home/haypo/prog/GIT/py3k/Modules/socketmodule.c:3396:9: warning: variable 'result' set but not used [-Wunused-but-set-variable] /home/haypo/prog/GIT/py3k/Modules/_sqlite/connection.c: In function '_pysqlite_final_callback': /home/haypo/prog/GIT/py3k/Modules/_sqlite/connection.c:676:15: warning: variable 'aggregate_class' set but not used [-Wunused-but-set-variable] /home/haypo/prog/GIT/py3k/Modules/_sqlite/cursor.c: In function 'pysqlite_cursor_dealloc': /home/haypo/prog/GIT/py3k/Modules/_sqlite/cursor.c:129:9: warning: variable 'rc' set but not used [-Wunused-but-set-variable] /home/haypo/prog/GIT/py3k/Modules/_sqlite/statement.c: In function 'pysqlite_statement_dealloc': /home/haypo/prog/GIT/py3k/Modules/_sqlite/statement.c:372:9: warning: variable 'rc' set but not used [-Wunused-but-set-variable] /home/haypo/prog/GIT/py3k/Modules/_tkinter.c: In function 'PythonCmd': /home/haypo/prog/GIT/py3k/Modules/_tkinter.c:2008:15: warning: variable 'self' set but not used [-Wunused-but-set-variable] /home/haypo/prog/GIT/py3k/Modules/tkappinit.c: In function 'Tcl_AppInit': /home/haypo/prog/GIT/py3k/Modules/tkappinit.c:29:15: warning: variable 'main_window' set but not used [-Wunused-but-set-variable] (...) /home/haypo/prog/GIT/py3k/Modules/_ctypes/cfield.c: In function 'PyCField_FromDesc': /home/haypo/prog/GIT/py3k/Modules/_ctypes/cfield.c:55:29: warning: variable 'length' set but not used [-Wunused-but-set-variable] /home/haypo/prog/GIT/py3k/Modules/_ctypes/libffi/src/dlmalloc.c: In function 'mmap_resize': /home/haypo/prog/GIT/py3k/Modules/_ctypes/libffi/src/dlmalloc.c:3193:5: warning: implicit declaration of function 'mremap' [-Wimplicit-function-declaration] /home/haypo/prog/GIT/py3k/Modules/_ctypes/libffi/src/dlmalloc.c:3193:16: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] /home/haypo/prog/GIT/py3k/Modules/_ctypes/libffi/src/dlmalloc.c: In function 'sys_trim': /home/haypo/prog/GIT/py3k/Modules/_ctypes/libffi/src/dlmalloc.c:3612:62: warning: comparison between pointer and integer [enabled by default] --- -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10951 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10951] gcc 4.6 warnings
Brett Cannon br...@python.org added the comment: Just a comment on those warnings about unused assignments; think about commenting them out instead of flat-out deleting them. When I ran clang over Python 2.7 I got some blow-back from deleting some assignments as some found them to be like documentation. In instances where the assignment helps explain what is going on it is best to just comment the code out. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10951 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10951] gcc 4.6 warnings
New submission from STINNER Victor victor.stin...@haypocalc.com: To analyze #9880, I installed gcc-4.6. It looks like this new gcc version emits new warnings. Here is a report of py3k warnings generated with gcc-4.6 -O3 -Wall -Wextra -Wstrict-prototypes -Wno-missing-field-initializers -Wno-unused-parameter on AMD64. I grouped manually the warnings. sign-compare: Parser/node.c: In function 'PyNode_AddChild': Parser/node.c:94:31: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Objects/bytesobject.c: In function 'PyBytes_FromStringAndSize': Objects/bytesobject.c:95:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Objects/floatobject.c: In function 'PyFloat_ClearFreeList': Objects/floatobject.c:1960:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Objects/floatobject.c:1970:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Objects/floatobject.c: In function 'PyFloat_Fini': Objects/floatobject.c:2014:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Objects/memoryobject.c: In function '_indirect_copy_nd': Objects/memoryobject.c:199:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Objects/tupleobject.c: In function 'PyTuple_New': Objects/tupleobject.c:85:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Objects/typeobject.c: In function 'PyType_FromSpec': Objects/typeobject.c:2339:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Objects/unicodeobject.c: In function '_PyUnicode_New': Objects/unicodeobject.c:326:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Objects/unicodeobject.c: In function 'PyUnicodeUCS2_AsWideCharString': Objects/unicodeobject.c:1288:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Objects/unicodeobject.c: In function 'PyUnicodeUCS2_DecodeFSDefaultAndSize': Objects/unicodeobject.c:1804:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Objects/unicodeobject.c: In function 'PyUnicodeUCS2_FSConverter': Objects/unicodeobject.c:1851:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Objects/unicodeobject.c: In function 'PyUnicodeUCS2_FSDecoder': Objects/unicodeobject.c:1892:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Objects/unicodeobject.c: In function 'PyUnicode_AsUnicodeCopy': Objects/unicodeobject.c:10336:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Python/asdl.c: In function 'asdl_seq_new': Python/asdl.c:12:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Python/asdl.c: In function 'asdl_int_seq_new': Python/asdl.c:43:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Parser/printgrammar.c: In function 'printdfas': Parser/printgrammar.c:96:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Parser/pgenmain.c: In function 'getgrammar': Parser/pgenmain.c:102:27: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Python/bltinmodule.c: In function 'source_as_string': Python/bltinmodule.c:528:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Python/getargs.c: In function 'convertsimple': Python/getargs.c:876:28: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Python/getargs.c:993:43: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Python/pythonrun.c: In function 'print_error_text': Python/pythonrun.c:1352:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] ./Python/sysmodule.c: In function 'svnversion_init': ./Python/sysmodule.c:1367:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Python/traceback.c: In function '_Py_FindSourceFile': Python/traceback.c:191:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Python/dtoa.c: In function 'Balloc': Python/dtoa.c:349:56: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Python/thread_pthread.h: In function 'PyThread_create_key': Python/thread_pthread.h:592:22: warning: signed and unsigned type in conditional expression [-Wsign-compare] Python/compile.c: In function 'compiler_import_as': Python/compile.c:2076:49: warning: signed and unsigned type in conditional expression [-Wsign-compare] Python/compile.c: In function 'assemble_init': Python/compile.c:3619:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
[issue10951] gcc 4.6 warnings
Changes by STINNER Victor victor.stin...@haypocalc.com: -- components: +Build versions: +Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10951 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10951] gcc 4.6 warnings
Changes by Brett Cannon br...@python.org: -- nosy: +brett.cannon ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10951 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10951] gcc 4.6 warnings
Terry J. Reedy tjre...@udel.edu added the comment: I took a look at an example of each type. Sign-compare, Parser/node.c, 94 if (required_capacity PY_SIZE_MAX / sizeof(node)) I presume PY_SIZE_MAX and sizeof(node) are both unsigned. So is, conceptually, required_capacity, but it is defined as an int because it is defined with XXXROUNDUP() and hence fancy_roundup(), which returns -1 if n1-n_nchildren is so large that the smallest power of 2 larger is too big for an int. The comparison is 'OK' in context in that it is preceded by and guarded by if (current_capacity 0 || required_capacity 0) return E_OVERFLOW; If I had written this, I might have thought about replacing all the comparisons with one check of n1-n_nchildren against some reasonable limit calculated from PY_SIZE_MAX / sizeof(node), and making both capacities unsigned. --- Unused, Parser/parsetok.c, 130: local vars handling_with and handling_import are both set to 0 both here and again on line 157 and not seen elsewhere in the file. I presume both could just be deleted both places. --- Empty body, pgen, multiple places: those I checked are appearances of the REQN() macro. The REQ() macro did not generate a warning. #ifdef Py_DEBUG #define REQN(i, count) \ if (i count) { \ fprintf(stderr, REQNFMT, count); \ Py_FatalError(REQN); \ } else #else #define REQN(i, count) /* empty */ #endif Since all invocations of REQN look like REQN(i, 1);, I presume the 'else' is there to swallow up the ';' which is added to make macro calls look like statements with a function call. I guess this is a style issue. As I remember, the suggestion to simply add '{}' to the macro would make syntax errors. --- Uninitialized, Objects/setobject.c, 2445, in test_c_api: while (_PySet_NextEntry((PyObject *)dup, i, x, hash)) { s = _PyUnicode_AsString(x); I presume x is set by _PySet... . (If i and hash are also, they are not used). So 'may be' but not actually. --- Conclusion: the 'fix' is some real cleanup, some warning suppression. -- nosy: +terry.reedy ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10951 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue10951] gcc 4.6 warnings
Changes by Jesús Cea Avión j...@jcea.es: -- nosy: +jcea ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10951 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com