File tree Expand file tree Collapse file tree 2 files changed +27
-20
lines changed Expand file tree Collapse file tree 2 files changed +27
-20
lines changed Original file line number Diff line number Diff line change @@ -39,19 +39,22 @@ def main():
39
39
if std :
40
40
if support .MS_WINDOWS :
41
41
cflags .append (f'/std:{ std } ' )
42
- std_prefix = '/std'
43
42
else :
44
43
cflags .append (f'-std={ std } ' )
45
- std_prefix = '-std'
46
44
47
- # Remove existing -std options to only test ours
48
- cmd = (sysconfig .get_config_var ('CC' ) or '' )
49
- if cmd is not None :
50
- cmd = shlex .split (cmd )
51
- cmd = [arg for arg in cmd if not arg .startswith (std_prefix )]
52
- cmd = shlex .join (cmd )
53
- # CC env var overrides sysconfig CC variable in setuptools
54
- os .environ ['CC' ] = cmd
45
+ # Remove existing -std or /std options from CC command line.
46
+ # Python adds -std=c11 option.
47
+ cmd = (sysconfig .get_config_var ('CC' ) or '' )
48
+ if cmd is not None :
49
+ if support .MS_WINDOWS :
50
+ std_prefix = '/std'
51
+ else :
52
+ std_prefix = '-std'
53
+ cmd = shlex .split (cmd )
54
+ cmd = [arg for arg in cmd if not arg .startswith (std_prefix )]
55
+ cmd = shlex .join (cmd )
56
+ # CC env var overrides sysconfig CC variable in setuptools
57
+ os .environ ['CC' ] = cmd
55
58
56
59
# Define Py_LIMITED_API macro
57
60
if limited :
Original file line number Diff line number Diff line change @@ -35,19 +35,23 @@ def main():
35
35
if std :
36
36
if support .MS_WINDOWS :
37
37
cppflags .append (f'/std:{ std } ' )
38
- std_prefix = '/std'
39
38
else :
40
39
cppflags .append (f'-std={ std } ' )
41
- std_prefix = '-std'
42
40
43
- # Remove existing -std options to only test ours
44
- cmd = (sysconfig .get_config_var ('CC' ) or '' )
45
- if cmd is not None :
46
- cmd = shlex .split (cmd )
47
- cmd = [arg for arg in cmd if not arg .startswith (std_prefix )]
48
- cmd = shlex .join (cmd )
49
- # CC env var overrides sysconfig CC variable in setuptools
50
- os .environ ['CC' ] = cmd
41
+ # gh-105776: When "gcc -std=11" is used as the C++ compiler, -std=c11
42
+ # option emits a C++ compiler warning. Remove "-std11" option from the
43
+ # CC command.
44
+ cmd = (sysconfig .get_config_var ('CC' ) or '' )
45
+ if cmd is not None :
46
+ if support .MS_WINDOWS :
47
+ std_prefix = '/std'
48
+ else :
49
+ std_prefix = '-std'
50
+ cmd = shlex .split (cmd )
51
+ cmd = [arg for arg in cmd if not arg .startswith (std_prefix )]
52
+ cmd = shlex .join (cmd )
53
+ # CC env var overrides sysconfig CC variable in setuptools
54
+ os .environ ['CC' ] = cmd
51
55
52
56
# On Windows, add PCbuild\amd64\ to include and library directories
53
57
include_dirs = []
You can’t perform that action at this time.
0 commit comments