summaryrefslogtreecommitdiff
path: root/numpy/distutils/ccompiler_opt.py
diff options
context:
space:
mode:
authorDeveloper-Ecosystem-Engineering <65677710+Developer-Ecosystem-Engineering@users.noreply.github.com>2021-11-18 14:31:58 -0800
committerGitHub <noreply@github.com>2021-11-18 14:31:58 -0800
commit5e9ce0c0529e3085498ac892941a020a65c7369a (patch)
treea70d9e941549b4a51b493f1b170ef33ce0d5a217 /numpy/distutils/ccompiler_opt.py
parent2ff7ab64d4e7d5928e96ca95b85350aa9caa2b63 (diff)
parent056abda14dab7fa8daf7a1ab44144aeb2250c216 (diff)
downloadnumpy-5e9ce0c0529e3085498ac892941a020a65c7369a.tar.gz
Merge branch 'numpy:main' into as_min_max
Diffstat (limited to 'numpy/distutils/ccompiler_opt.py')
-rw-r--r--numpy/distutils/ccompiler_opt.py32
1 files changed, 20 insertions, 12 deletions
diff --git a/numpy/distutils/ccompiler_opt.py b/numpy/distutils/ccompiler_opt.py
index e7fd494d3..39847c20f 100644
--- a/numpy/distutils/ccompiler_opt.py
+++ b/numpy/distutils/ccompiler_opt.py
@@ -8,7 +8,14 @@ the sources with proper compiler's flags.
instead only focuses on the compiler side, but it creates abstract C headers
that can be used later for the final runtime dispatching process."""
-import sys, io, os, re, textwrap, pprint, inspect, atexit, subprocess
+import atexit
+import inspect
+import os
+import pprint
+import re
+import subprocess
+import textwrap
+
class _Config:
"""An abstract class holds all configurable attributes of `CCompilerOpt`,
@@ -188,7 +195,7 @@ class _Config:
# native usually works only with x86
native = '-march=native',
opt = '-O3',
- werror = '-Werror'
+ werror = '-Werror',
),
clang = dict(
native = '-march=native',
@@ -198,22 +205,22 @@ class _Config:
# cases `-Werror` gets skipped during the availability test due to
# "unused arguments" warnings.
# see https://github.com/numpy/numpy/issues/19624
- werror = '-Werror-implicit-function-declaration -Werror'
+ werror = '-Werror=switch -Werror',
),
icc = dict(
native = '-xHost',
opt = '-O3',
- werror = '-Werror'
+ werror = '-Werror',
),
iccw = dict(
native = '/QxHost',
opt = '/O3',
- werror = '/Werror'
+ werror = '/Werror',
),
msvc = dict(
native = None,
opt = '/O2',
- werror = '/WX'
+ werror = '/WX',
)
)
conf_min_features = dict(
@@ -406,8 +413,8 @@ class _Config:
AVX512_ICL = dict(flags="/Qx:ICELAKE-CLIENT")
)
if on_x86 and self.cc_is_msvc: return dict(
- SSE = dict(flags="/arch:SSE"),
- SSE2 = dict(flags="/arch:SSE2"),
+ SSE = dict(flags="/arch:SSE") if self.cc_on_x86 else {},
+ SSE2 = dict(flags="/arch:SSE2") if self.cc_on_x86 else {},
SSE3 = {},
SSSE3 = {},
SSE41 = {},
@@ -516,7 +523,8 @@ class _Config:
def __init__(self):
if self.conf_tmp_path is None:
- import tempfile, shutil
+ import shutil
+ import tempfile
tmp = tempfile.mkdtemp()
def rm_temp():
try:
@@ -555,6 +563,7 @@ class _Distutils:
flags = kwargs.pop("extra_postargs", []) + flags
if not ccompiler:
ccompiler = self._ccompiler
+
return ccompiler.compile(sources, extra_postargs=flags, **kwargs)
def dist_test(self, source, flags, macros=[]):
@@ -696,7 +705,6 @@ class _Distutils:
)
@staticmethod
def _dist_test_spawn(cmd, display=None):
- from distutils.errors import CompileError
try:
o = subprocess.check_output(cmd, stderr=subprocess.STDOUT,
universal_newlines=True)
@@ -708,8 +716,8 @@ class _Distutils:
except subprocess.CalledProcessError as exc:
o = exc.output
s = exc.returncode
- except OSError:
- o = b''
+ except OSError as e:
+ o = e
s = 127
else:
return None