Skip to content

Commit 9e1e6f5

Browse files
author
Stefan Krah
authored
bpo-30923: Silence fall-through warnings in libexpat build. (#3205)
1 parent a3a6df3 commit 9e1e6f5

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

setup.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,6 +1518,7 @@ class db_found(Exception): pass
15181518
if '--with-system-expat' in sysconfig.get_config_var("CONFIG_ARGS"):
15191519
expat_inc = []
15201520
define_macros = []
1521+
extra_compile_args = []
15211522
expat_lib = ['expat']
15221523
expat_sources = []
15231524
expat_depends = []
@@ -1529,6 +1530,7 @@ class db_found(Exception): pass
15291530
# call XML_SetHashSalt(), expat entropy sources are not needed
15301531
('XML_POOR_ENTROPY', '1'),
15311532
]
1533+
extra_compile_args = []
15321534
expat_lib = []
15331535
expat_sources = ['expat/xmlparse.c',
15341536
'expat/xmlrole.c',
@@ -1546,8 +1548,15 @@ class db_found(Exception): pass
15461548
'expat/xmltok_impl.h'
15471549
]
15481550

1551+
cc = sysconfig.get_config_var('CC').split()[0]
1552+
ret = os.system(
1553+
'"%s" -Werror -Wimplicit-fallthrough -E -xc /dev/null >/dev/null 2>&1' % cc)
1554+
if ret >> 8 == 0:
1555+
extra_compile_args.append('-Wno-implicit-fallthrough')
1556+
15491557
exts.append(Extension('pyexpat',
15501558
define_macros = define_macros,
1559+
extra_compile_args = extra_compile_args,
15511560
include_dirs = expat_inc,
15521561
libraries = expat_lib,
15531562
sources = ['pyexpat.c'] + expat_sources,

0 commit comments

Comments
 (0)