summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Krah <skrah@bytereef.org>2017-08-25 12:07:50 (GMT)
committerGitHub <noreply@github.com>2017-08-25 12:07:50 (GMT)
commit9e1e6f528f3fec16b9bd99f5ee38048ffec04a81 (patch)
tree50198597241f55dfc0a9af1392058e8f55225dc4
parenta3a6df36b6e0d1d560f8fb2a4873d5b97329c454 (diff)
downloadcpython-9e1e6f528f3fec16b9bd99f5ee38048ffec04a81.zip
cpython-9e1e6f528f3fec16b9bd99f5ee38048ffec04a81.tar.gz
cpython-9e1e6f528f3fec16b9bd99f5ee38048ffec04a81.tar.bz2
bpo-30923: Silence fall-through warnings in libexpat build. (#3205)
-rw-r--r--setup.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/setup.py b/setup.py
index f3c2538..36a52bc 100644
--- a/setup.py
+++ b/setup.py
@@ -1518,6 +1518,7 @@ class PyBuildExt(build_ext):
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 = []
@@ -1529,6 +1530,7 @@ class PyBuildExt(build_ext):
# 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',
@@ -1546,8 +1548,15 @@ class PyBuildExt(build_ext):
'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,