classification
Title: [2.7] Fix -Wnonnull and -Wint-in-bool-context warnings
Type: compile error Stage: resolved
Components: Build Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: christian.heimes Nosy List: christian.heimes, zach.ware
Priority: normal Keywords: patch

Created on 2017-09-14 17:37 by christian.heimes, last changed 2020-04-27 03:27 by zach.ware. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 3581 merged christian.heimes, 2017-09-14 17:43
Messages (3)
msg302188 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2017-09-14 17:37
GCC 7.1 shows a bunch onf warnings related to -Wnonnull and -Wint-in-bool-context when compiling Python 2.7:

In file included from Include/Python.h:78:0,
                 from Objects/listobject.c:3:
Objects/listobject.c: In function ‘list_resize’:
Include/pymem.h:110:34: warning: ‘*’ in boolean context, suggest ‘&&’ instead [-Wint-in-bool-context]
  (type *) PyMem_REALLOC((p), (n) * sizeof(type)) )
                                  ^
Include/pymem.h:77:21: note: in definition of macro ‘PyMem_REALLOC’
     : realloc((p), (n) ? (n) : 1))
                     ^
Objects/listobject.c:62:9: note: in expansion of macro ‘PyMem_RESIZE’
         PyMem_RESIZE(items, PyObject *, new_allocated);
         ^~~~~~~~~~~~


In file included from Python/formatter_string.c:17:0:
Python/../Objects/stringlib/formatter.h: In function ‘format_float_internal’:
Python/../Objects/stringlib/formatter.h:576:9: warning: argument 2 null where non-null expected [-Wnonnull]
         memmove(buf,
         ^~~~~~~~~~~~
                 prefix,
                 ~~~~~~~
                 spec->n_prefix * sizeof(STRINGLIB_CHAR));
                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from Include/Python.h:38:0,
                 from Python/formatter_string.c:6:
/usr/include/string.h:47:14: note: in a call to function ‘memmove’ declared here
 extern void *memmove (void *__dest, const void *__src, size_t __n)
msg302286 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2017-09-15 18:27
New changeset fd39e2a6845f33a74fbb0671c434c0d84a5ec2f3 by Christian Heimes in branch '2.7':
bpo-31474: Fix -Wint-in-bool-context warnings (#3581)
https://github.com/python/cpython/commit/fd39e2a6845f33a74fbb0671c434c0d84a5ec2f3
msg367367 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2020-04-27 03:27
This seems to have been fixed but never closed?  Closing it now anyway due to EOL :)
History
Date User Action Args
2020-04-27 03:27:58zach.waresetstatus: open -> closed

nosy: + zach.ware
messages: + msg367367

resolution: fixed
stage: patch review -> resolved
2018-02-28 17:55:45ned.deilylinkissue31013 superseder
2017-09-15 18:27:25christian.heimessetmessages: + msg302286
2017-09-14 17:45:45christian.heimessetversions: + Python 2.7, - Python 3.3
2017-09-14 17:43:04christian.heimessetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request3571
2017-09-14 17:37:30christian.heimescreate