lang/python38: Fix on CentOS 7

Move __has_attribute() inside #if defined(__has_attribute) body so the
preprocessor doesn't break on that.
This commit is contained in:
sjmulder 2020-11-18 10:51:01 +00:00
parent 9ac4083d4a
commit 334ec7ede3
2 changed files with 11 additions and 9 deletions

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.13 2020/11/17 19:33:14 sjmulder Exp $
$NetBSD: distinfo,v 1.14 2020/11/18 10:51:01 sjmulder Exp $
SHA1 (Python-3.8.6.tar.xz) = 6ee446eaacf901a3305565bd6569e2de135168e3
RMD160 (Python-3.8.6.tar.xz) = 89c134d2d1bc02975cf959cc4a7ee63dba5c5388
@ -31,7 +31,7 @@ SHA1 (patch-Modules_nismodule.c) = 1bafe9b06359586d027a77011b103877590d947d
SHA1 (patch-Modules_posixmodule.c) = ea24a1aa19b596b5d4457a4eff761e516406145f
SHA1 (patch-Modules_socketmodule.c) = e99fd9e30e3feafef1747a2f52446d8fec543362
SHA1 (patch-Modules_socketmodule.h) = 13a3290eb72078067060d3e71b7baa08f3eb591c
SHA1 (patch-Modules_timemodule.c) = bc8ba8c63e6be1411067480d661bd3b23dfa14c0
SHA1 (patch-Modules_timemodule.c) = 10dc2769432bbfd4360f90fedfa6504d8b6f6347
SHA1 (patch-Python_bootstrap__hash.c) = 2e7d24ded1369624b2983b15784988517a9697a5
SHA1 (patch-Python_pytime.c) = 41981f821e0b420abcb0334312148deb9a9fed5e
SHA1 (patch-Python_thread__pthread.h) = fb81eaa604b4ed7c1b64c3f4731d58a8aee257be

View file

@ -1,4 +1,4 @@
$NetBSD: patch-Modules_timemodule.c,v 1.1 2020/11/17 19:33:15 sjmulder Exp $
$NetBSD: patch-Modules_timemodule.c,v 1.2 2020/11/18 10:51:01 sjmulder Exp $
Support for macOS 11 and Apple Silicon (ARM). Mostly backported from:
https://github.com/python/cpython/pull/22855
@ -104,24 +104,26 @@ https://github.com/python/cpython/pull/22855
}
#endif
@@ -1346,6 +1374,16 @@ _PyTime_GetThreadTimeWithInfo(_PyTime_t
@@ -1346,6 +1374,18 @@ _PyTime_GetThreadTimeWithInfo(_PyTime_t
#elif defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_PROCESS_CPUTIME_ID)
#define HAVE_THREAD_TIME
+
+#if defined(__APPLE__) && defined(__has_attribute) && __has_attribute(availability)
+#if defined(__APPLE__) && defined(__has_attribute)
+# if __has_attribute(availability)
+static int
+_PyTime_GetThreadTimeWithInfo(_PyTime_t *tp, _Py_clock_info_t *info)
+ __attribute__((availability(macos, introduced=10.12)))
+ __attribute__((availability(ios, introduced=10.0)))
+ __attribute__((availability(tvos, introduced=10.0)))
+ __attribute__((availability(watchos, introduced=3.0)));
+# endif
+#endif
+
static int
_PyTime_GetThreadTimeWithInfo(_PyTime_t *tp, _Py_clock_info_t *info)
{
@@ -1377,6 +1415,15 @@ _PyTime_GetThreadTimeWithInfo(_PyTime_t
@@ -1377,6 +1417,15 @@ _PyTime_GetThreadTimeWithInfo(_PyTime_t
#endif
#ifdef HAVE_THREAD_TIME
@ -137,7 +139,7 @@ https://github.com/python/cpython/pull/22855
static PyObject *
time_thread_time(PyObject *self, PyObject *unused)
{
@@ -1407,6 +1454,11 @@ PyDoc_STRVAR(thread_time_ns_doc,
@@ -1407,6 +1456,11 @@ PyDoc_STRVAR(thread_time_ns_doc,
\n\
Thread time for profiling as nanoseconds:\n\
sum of the kernel and user-space CPU time.");
@ -149,7 +151,7 @@ https://github.com/python/cpython/pull/22855
#endif
@@ -1456,9 +1508,19 @@ time_get_clock_info(PyObject *self, PyOb
@@ -1456,9 +1510,19 @@ time_get_clock_info(PyObject *self, PyOb
}
#ifdef HAVE_THREAD_TIME
else if (strcmp(name, "thread_time") == 0) {
@ -170,7 +172,7 @@ https://github.com/python/cpython/pull/22855
}
#endif
else {
@@ -1757,43 +1819,88 @@ PyInit_time(void)
@@ -1757,43 +1821,88 @@ PyInit_time(void)
if (m == NULL)
return NULL;