[New-bugs-announce] [issue31474] [2.7] Fix -Wnonnull and -Wint-in-bool-context warnings

Christian Heimes report at bugs.python.org
Thu Sep 14 13:37:30 EDT 2017


New submission from Christian Heimes:

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)

----------
assignee: christian.heimes
components: Build
messages: 302188
nosy: christian.heimes
priority: normal
severity: normal
stage: needs patch
status: open
title: [2.7] Fix  -Wnonnull and -Wint-in-bool-context warnings
type: compile error
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue31474>
_______________________________________


More information about the New-bugs-announce mailing list