From cafda248a5856a6424324929c1708ea8048d89d6 Mon Sep 17 00:00:00 2001 From: Pearu Peterson Date: Tue, 19 Jan 2021 20:52:54 +0200 Subject: BUG: threads.h existence test requires GLIBC > 2.12. (#18180) * defined(__STDC_NO_THREADS__) can be trusted only when using glibc > 2.12 * Add __GLIBC__ defined check. --- numpy/f2py/cfuncs.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'numpy/f2py') diff --git a/numpy/f2py/cfuncs.py b/numpy/f2py/cfuncs.py index 26b43e7e6..40496ccf1 100644 --- a/numpy/f2py/cfuncs.py +++ b/numpy/f2py/cfuncs.py @@ -549,7 +549,12 @@ cppmacros["F2PY_THREAD_LOCAL_DECL"] = """\ #define F2PY_THREAD_LOCAL_DECL __declspec(thread) #elif defined(__STDC_VERSION__) \\ && (__STDC_VERSION__ >= 201112L) \\ - && !defined(__STDC_NO_THREADS__) + && !defined(__STDC_NO_THREADS__) \\ + && (!defined(__GLIBC__) || __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 12)) +/* __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 */ #include #define F2PY_THREAD_LOCAL_DECL thread_local #elif defined(__GNUC__) \\ -- cgit v1.2.1