summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2022-01-24 10:56:07 -0700
committerGitHub <noreply@github.com>2022-01-24 10:56:07 -0700
commit932202d24c399f46161caa7464446b55e27fa947 (patch)
treec9a84d1cfd2e779ef53d4bda30396585be42406d /numpy
parent6df9d2bcd9a52db11c169a6ef28dd4f0ba30931a (diff)
parent0dba00e4c7ba711e858d622b15cab9618b14bd21 (diff)
downloadnumpy-932202d24c399f46161caa7464446b55e27fa947.tar.gz
Merge pull request #20881 from rgommers/f2py-threading-mingw
BUG: fix f2py's define for threading when building with Mingw
Diffstat (limited to 'numpy')
-rw-r--r--numpy/f2py/cfuncs.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/numpy/f2py/cfuncs.py b/numpy/f2py/cfuncs.py
index 528c4adee..bdd27adaf 100644
--- a/numpy/f2py/cfuncs.py
+++ b/numpy/f2py/cfuncs.py
@@ -572,18 +572,20 @@ cppmacros['OLDPYNUM'] = """\
"""
cppmacros["F2PY_THREAD_LOCAL_DECL"] = """\
#ifndef F2PY_THREAD_LOCAL_DECL
-#if defined(_MSC_VER) \\
- || defined(_WIN32) || defined(_WIN64) \\
- || defined(__MINGW32__) || defined(__MINGW64__)
+#if defined(_MSC_VER)
#define F2PY_THREAD_LOCAL_DECL __declspec(thread)
+#elif defined(__MINGW32__) || defined(__MINGW64__)
+#define F2PY_THREAD_LOCAL_DECL __thread
#elif defined(__STDC_VERSION__) \\
&& (__STDC_VERSION__ >= 201112L) \\
&& !defined(__STDC_NO_THREADS__) \\
- && (!defined(__GLIBC__) || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 12))
+ && (!defined(__GLIBC__) || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 12)) \\
+ && !defined(__OpenBSD__)
/* __STDC_NO_THREADS__ was first defined in a maintenance release of glibc 2.12,
see https://lists.gnu.org/archive/html/commit-hurd/2012-07/msg00180.html,
so `!defined(__STDC_NO_THREADS__)` may give false positive for the existence
- of `threads.h` when using an older release of glibc 2.12 */
+ of `threads.h` when using an older release of glibc 2.12
+ See gh-19437 for details on OpenBSD */
#include <threads.h>
#define F2PY_THREAD_LOCAL_DECL thread_local
#elif defined(__GNUC__) \\