Skip to content

Commit 60e2205

Browse files
committed
[stdlib] Enable lgamma for Android.
Android Bionic offers lgammaf_r and lgamma_r only if _GNU_SOURCE is provided. It also offers lgammal_r in API levels 23 and above, but that one will not be available until 128 bit floats are supported. The patch modifies the importer to use _GNU_SOURCE while importing Android headers and slighly modify a check that was avoding the function from being created for Android. This fixes the compilation of the tgmath test in Android.
1 parent 60a4b8b commit 60e2205

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/ClangImporter/ClangImporter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ getNormalInvocationArguments(std::vector<std::string> &invocationArgStrs,
535535
// using Glibc or a libc that respects that flag. This will cause some
536536
// source breakage however (specifically with strerror_r()) on Linux
537537
// without a workaround.
538-
if (triple.isOSFuchsia()) {
538+
if (triple.isOSFuchsia() || triple.isAndroid()) {
539539
// Many of the modern libc features are hidden behind feature macros like
540540
// _GNU_SOURCE or _XOPEN_SOURCE.
541541
invocationArgStrs.insert(invocationArgStrs.end(), {

stdlib/public/Platform/tgmath.swift.gyb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -292,8 +292,8 @@ public func ${bfunc}(_ lhs: ${T}, _ rhs: ${T}) -> ${T} {
292292
% if T == 'Float80':
293293
#if (arch(i386) || arch(x86_64)) && !os(Windows)
294294
% else:
295-
// lgamma not avaialable on Windows, apparently?
296-
#if !os(Windows) && !os(Android)
295+
// lgamma not available on Windows, apparently?
296+
#if !os(Windows)
297297
% end
298298
@_transparent
299299
public func lgamma(_ x: ${T}) -> (${T}, Int) {

0 commit comments

Comments
 (0)