[3.6] bpo-30923, bpo-31279: Fix GCC warnings (#4620) · python/cpython@dedcbee (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Commit dedcbee
File tree
2 files changed
lines changed
2 files changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -244,7 +244,7 @@ PyByteArray_Resize(PyObject *self, Py_ssize_t requested_size) | ||
244 | 244 | return -1; |
245 | 245 | } |
246 | 246 | memcpy(sval, PyByteArray_AS_STRING(self), |
247 | -Py_MIN(requested_size, Py_SIZE(self))); | |
247 | +Py_MIN((size_t)requested_size, (size_t)Py_SIZE(self))); | |
248 | 248 | PyObject_Free(obj->ob_bytes); |
249 | 249 | } |
250 | 250 | else { |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1526,6 +1526,7 @@ class db_found(Exception): pass | ||
1526 | 1526 | if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"): |
1527 | 1527 | expat_inc = [] |
1528 | 1528 | define_macros = [] |
1529 | +extra_compile_args = [] | |
1529 | 1530 | expat_lib = ['expat'] |
1530 | 1531 | expat_sources = [] |
1531 | 1532 | expat_depends = [] |
@@ -1537,6 +1538,7 @@ class db_found(Exception): pass | ||
1537 | 1538 | # call XML_SetHashSalt(), expat entropy sources are not needed |
1538 | 1539 | ('XML_POOR_ENTROPY', '1'), |
1539 | 1540 | ] |
1541 | +extra_compile_args = [] | |
1540 | 1542 | expat_lib = [] |
1541 | 1543 | expat_sources = ['expat/xmlparse.c', |
1542 | 1544 | 'expat/xmlrole.c', |
@@ -1554,8 +1556,15 @@ class db_found(Exception): pass | ||
1554 | 1556 | 'expat/xmltok_impl.h' |
1555 | 1557 | ] |
1556 | 1558 | |
1559 | +cc = sysconfig.get_config_var('CC').split()[0] | |
1560 | +ret = os.system( | |
1561 | +'"%s" -Werror -Wimplicit-fallthrough -E -xc /dev/null >/dev/null 2>&1' % cc) | |
1562 | +if ret >> 8 == 0: | |
1563 | +extra_compile_args.append('-Wno-implicit-fallthrough') | |
1564 | + | |
1557 | 1565 | exts.append(Extension('pyexpat', |
1558 | 1566 | define_macros = define_macros, |
1567 | +extra_compile_args = extra_compile_args, | |
1559 | 1568 | include_dirs = expat_inc, |
1560 | 1569 | libraries = expat_lib, |
1561 | 1570 | sources = ['pyexpat.c'] + expat_sources, |