Skip to content

Commit

Permalink
Merge pull request #20909 from charris/backport-20881
Browse files Browse the repository at this point in the history
BUG: fix f2py's define for threading when building with Mingw
  • Loading branch information
charris committed Jan 27, 2022
2 parents 06388b6 + b5bcf5e commit 084d66f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions numpy/f2py/cfuncs.py
Expand Up @@ -572,18 +572,20 @@
"""
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__) \\
Expand Down

0 comments on commit 084d66f

Please sign in to comment.