File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
stdlib/public/SwiftShims/swift/shims Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -170,11 +170,16 @@ long double _stdlib_squareRootl(long double _self) {
170170// Apple's math.h does not declare lgamma_r() etc by default, but they're
171171// unconditionally exported by libsystem_m.dylib in all OS versions that
172172// support Swift development; we simply need to provide declarations here.
173- #if defined(__APPLE__)
173+ // In the macOS 15.0, iOS 18.0, et al SDKs, math.h unconditionally declares
174+ // lgamma_r() when building for Swift. Detect those SDKs by checking for a
175+ // header which was added in those versions. (Redeclaring the function
176+ // would cause an error where `lgamma_r` is ambiguous between the SDK
177+ // `_math.lgamma_r` and this `SwiftShims.lgamma_r`.)
178+ #if defined(__APPLE__) && !__has_include(<_modules/_math_h.h>)
174179float lgammaf_r (float x, int *psigngam);
175180double lgamma_r (double x, int *psigngam);
176181long double lgammal_r (long double x, int *psigngam);
177- #endif // defined(__APPLE__)
182+ #endif // defined(__APPLE__) && !__has_include(<_modules/_math_h.h>)
178183
179184#ifdef __cplusplus
180185} // extern "C"
You can’t perform that action at this time.
0 commit comments