From 081d7d9bac97964bc3f99d7494103b4dce9a734d Mon Sep 17 00:00:00 2001 From: Stefan Krah Date: Fri, 25 Aug 2017 14:07:50 +0200 Subject: [PATCH 1/2] bpo-30923: Silence fall-through warnings in libexpat build. (#3205) (cherry picked from commit 9e1e6f528f3fec16b9bd99f5ee38048ffec04a81) --- setup.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/setup.py b/setup.py index da4fcc31651c85..0d644db8573e51 100644 --- a/setup.py +++ b/setup.py @@ -1526,6 +1526,7 @@ class db_found(Exception): pass if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"): expat_inc = [] define_macros = [] + extra_compile_args = [] expat_lib = ['expat'] expat_sources = [] expat_depends = [] @@ -1537,6 +1538,7 @@ class db_found(Exception): pass # call XML_SetHashSalt(), expat entropy sources are not needed ('XML_POOR_ENTROPY', '1'), ] + extra_compile_args = [] expat_lib = [] expat_sources = ['expat/xmlparse.c', 'expat/xmlrole.c', @@ -1554,8 +1556,15 @@ class db_found(Exception): pass 'expat/xmltok_impl.h' ] + cc = sysconfig.get_config_var('CC').split()[0] + ret = os.system( + '"%s" -Werror -Wimplicit-fallthrough -E -xc /dev/null >/dev/null 2>&1' % cc) + if ret >> 8 == 0: + extra_compile_args.append('-Wno-implicit-fallthrough') + exts.append(Extension('pyexpat', define_macros = define_macros, + extra_compile_args = extra_compile_args, include_dirs = expat_inc, libraries = expat_lib, sources = ['pyexpat.c'] + expat_sources, From 5f1edc6344dab661ce69152c293219d46d16188a Mon Sep 17 00:00:00 2001 From: Stefan Krah Date: Fri, 25 Aug 2017 20:12:05 +0200 Subject: [PATCH 2/2] bpo-31279: Silence -Wstringop-overflow warning. (#3207) (cherry picked from commit dce6502059f46a04f90938b9d832394c8215397b) --- Objects/bytearrayobject.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Objects/bytearrayobject.c b/Objects/bytearrayobject.c index 7653322b829903..15524572929c6a 100644 --- a/Objects/bytearrayobject.c +++ b/Objects/bytearrayobject.c @@ -244,7 +244,7 @@ PyByteArray_Resize(PyObject *self, Py_ssize_t requested_size) return -1; } memcpy(sval, PyByteArray_AS_STRING(self), - Py_MIN(requested_size, Py_SIZE(self))); + Py_MIN((size_t)requested_size, (size_t)Py_SIZE(self))); PyObject_Free(obj->ob_bytes); } else {