summaryrefslogtreecommitdiff
path: root/numpy/core
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core')
-rw-r--r--numpy/core/setup.py4
-rw-r--r--numpy/core/setup_common.py21
2 files changed, 14 insertions, 11 deletions
diff --git a/numpy/core/setup.py b/numpy/core/setup.py
index 8190c7da2..d20449e2e 100644
--- a/numpy/core/setup.py
+++ b/numpy/core/setup.py
@@ -175,12 +175,12 @@ def check_math_capabilities(config, moredefs, mathlibs):
headers=headers):
moredefs.append((fname2def(f), 1))
- for dec, fn in OPTIONAL_GCC_ATTRIBUTES:
+ for dec, fn in OPTIONAL_FUNCTION_ATTRIBUTES:
if config.check_func(fn, decl='int %s %s(void *);' % (dec, fn),
call=False):
moredefs.append((fname2def(fn), 1))
- for fn in ("__thread", "__declspec(thread)"):
+ for fn in OPTIONAL_VARIABLE_ATTRIBUTES:
if config.check_func(fn, decl='int %s a;' % (fn), call=False):
m = fn.replace("(", "_").replace(")", "_")
moredefs.append((fname2def(m), 1))
diff --git a/numpy/core/setup_common.py b/numpy/core/setup_common.py
index 85e92d923..8a06b40fd 100644
--- a/numpy/core/setup_common.py
+++ b/numpy/core/setup_common.py
@@ -121,16 +121,19 @@ OPTIONAL_INTRINSICS = [("__builtin_isnan", '5.'),
("_mm_load_pd", '(double*)0', "emmintrin.h"), # SSE2
]
-# gcc function attributes
-# (attribute as understood by gcc, function name),
+# function attributes
+# tested via "int %s %s(void *);" % (attribute, name)
# function name will be converted to HAVE_<upper-case-name> preprocessor macro
-OPTIONAL_GCC_ATTRIBUTES = [('__attribute__((optimize("unroll-loops")))',
- 'attribute_optimize_unroll_loops'),
- ('__attribute__((optimize("O3")))',
- 'attribute_optimize_opt_3'),
- ('__attribute__((nonnull (1)))',
- 'attribute_nonnull'),
- ]
+OPTIONAL_FUNCTION_ATTRIBUTES = [('__attribute__((optimize("unroll-loops")))',
+ 'attribute_optimize_unroll_loops'),
+ ('__attribute__((optimize("O3")))',
+ 'attribute_optimize_opt_3'),
+ ('__attribute__((nonnull (1)))',
+ 'attribute_nonnull'),
+ ]
+
+# variable attributes tested via "int %s a" % attribute
+OPTIONAL_VARIABLE_ATTRIBUTES = ["__thread", "__declspec(thread)"]
# Subset of OPTIONAL_STDFUNCS which may alreay have HAVE_* defined by Python.h
OPTIONAL_STDFUNCS_MAYBE = ["expm1", "log1p", "acosh", "atanh", "asinh", "hypot",