Skip to content

Commit 2f019f4

Browse files
Changes after testing with Xcode 6.2 on macOS 10.9
- __builtin_available is not present in the compiler, fall back to the ancient way of testing if a symbol is usable. - Logic error code in pytime.c resulted in a compile error.
1 parent 3a1d4f2 commit 2f019f4

2 files changed

Lines changed: 58 additions & 2 deletions

File tree

Modules/posixmodule.c

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@
5555
* In mixing the test with other tests or using negations will result in compile
5656
* errors.
5757
*/
58-
#if defined(__APPLE__) && defined(__has_builtin) && __has_builtin(__builtin_available)
58+
#if defined(__APPLE__)
59+
60+
#if defined(__has_builtin) && __has_builtin(__builtin_available)
5961
# define HAVE_FSTATAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)
6062
# define HAVE_FACCESSAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)
6163
# define HAVE_FCHMODAT_RUNTIME __builtin_available(macOS 10.10, iOS 8.0, *)
@@ -72,7 +74,60 @@
7274
# define HAVE_UTIMENSAT_RUNTIME __builtin_available(macOS 10.13, iOS 11.0, tvOS 11.0, watchOS 4.0, *)
7375
# define HAVE_PWRITEV_RUNTIME __builtin_available(macOS 11.0, iOS 14.0, tvOS 14.0, watchOS 7.0, *)
7476

77+
#else /* Xcode 8 or earlier */
78+
79+
#ifdef HAVE_FSTATAT
80+
# define HAVE_FSTATAT_RUNTIME (fstatat != NULL)
81+
#endif
82+
83+
#ifdef HAVE_FACCESSAT
84+
# define HAVE_FACCESSAT_RUNTIME (faccessat != NULL)
85+
#endif
86+
87+
#ifdef HAVE_FCHMODAT
88+
# define HAVE_FCHMODAT_RUNTIME (fchmodat != NULL)
89+
#endif
90+
91+
#ifdef HAVE_FCHOWNAT
92+
# define HAVE_FCHOWNAT_RUNTIME (fchownat != NULL)
93+
#endif
94+
95+
#ifdef HAVE_LINKAT
96+
# define HAVE_LINKAT_RUNTIME (linkat != NULL)
97+
#endif
98+
99+
#ifdef HAVE_FDOPENDIR
100+
# define HAVE_FDOPENDIR_RUNTIME (fdopendir != NULL)
101+
#endif
102+
103+
#ifdef HAVE_MKDIRAT
104+
# define HAVE_MKDIRAT_RUNTIME (mkdirat != NULL)
105+
#endif
106+
107+
#ifdef HAVE_RENAMEAT
108+
# define HAVE_RENAMEAT_RUNTIME (renameat != NULL)
109+
#endif
110+
111+
#ifdef HAVE_UNLINKAT
112+
# define HAVE_UNLINKAT_RUNTIME (unlinkat != NULL)
113+
#endif
114+
115+
#ifdef HAVE_OPENAT
116+
# define HAVE_OPENAT_RUNTIME (openat != NULL)
117+
#endif
118+
119+
#ifdef HAVE_READLINKAT
120+
# define HAVE_READLINKAT_RUNTIME (readlinkat != NULL)
121+
#endif
122+
123+
#ifdef HAVE_SYMLINKAT
124+
# define HAVE_SYMLINKAT_RUNTIME (symlinkat != NULL)
125+
#endif
126+
127+
#endif
128+
75129
#ifdef HAVE_FUTIMESAT
130+
/* Some of the logic for weak linking depends on this assertion */
76131
# error "HAVE_FUTIMESAT unexpectedly defined"
77132
#endif
78133

@@ -94,6 +149,7 @@
94149
# define HAVE_PWRITEV_RUNTIME 1
95150
#endif
96151

152+
97153
#ifdef __cplusplus
98154
extern "C" {
99155
#endif

Python/pytime.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ pygettimeofday(_PyTime_t *tp, _Py_clock_info_t *info, int raise)
750750
info->adjustable = 1;
751751
}
752752

753-
#ifdef __APPLE__
753+
#if defined(__APPLE__) && defined(HAVE_CLOCK_GETTIME)
754754
} /* end of availibity block */
755755
#endif
756756

0 commit comments

Comments
 (0)