Skip to content

Add Initial platform support for Haiku. #11583

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ set(SWIFT_ANDROID_DEPLOY_DEVICE_PATH "" CACHE STRING
"Path on an Android device where build products will be pushed. These are used when running the test suite against the device")

#
# User-configurable ICU specific options for Android, FreeBSD, Linux.
# User-configurable ICU specific options for Android, FreeBSD, Linux and Haiku.
#

foreach(sdk ANDROID;FREEBSD;LINUX;WINDOWS)
foreach(sdk ANDROID;FREEBSD;LINUX;WINDOWS;HAIKU)
set(SWIFT_${sdk}_ICU_UC "" CACHE STRING
"Path to a directory containing the icuuc library for ${sdk}")
set(SWIFT_${sdk}_ICU_UC_INCLUDE "" CACHE STRING
Expand Down Expand Up @@ -536,6 +536,8 @@ else()
set(SWIFT_HOST_VARIANT_SDK_default "CYGWIN")
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows")
set(SWIFT_HOST_VARIANT_SDK_default "WINDOWS")
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Haiku")
set(SWIFT_HOST_VARIANT_SDK_default "HAIKU")
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
set(SWIFT_HOST_VARIANT_SDK_default "OSX")
else()
Expand Down Expand Up @@ -677,6 +679,16 @@ elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "WINDOWS")
set(SWIFT_PRIMARY_VARIANT_SDK_default "${SWIFT_HOST_VARIANT_SDK}")
set(SWIFT_PRIMARY_VARIANT_ARCH_default "${SWIFT_HOST_VARIANT_ARCH}")

elseif("${SWIFT_HOST_VARIANT_SDK}" STREQUAL "HAIKU")

set(CMAKE_EXECUTABLE_FORMAT "ELF")
set(SWIFT_HOST_VARIANT "haiku" CACHE STRING
"Deployment OS for Swift host tools (the compiler) [haiku].")

configure_sdk_unix(HAIKU "Haiku" "haiku" "haiku" "x86_64" "x86_64-unknown-haiku" "/")
set(SWIFT_PRIMARY_VARIANT_SDK_default "${SWIFT_HOST_VARIANT_SDK}")
set(SWIFT_PRIMARY_VARIANT_ARCH_default "x86_64")

elseif("${SWIFT_HOST_VARIANT_SDK}" MATCHES "(OSX|IOS*|TVOS*|WATCHOS*)")

set(SWIFT_HOST_VARIANT "macosx" CACHE STRING
Expand Down
12 changes: 10 additions & 2 deletions cmake/modules/AddSwift.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,8 @@ function(_add_variant_link_flags)
# options. This causes conflicts.
list(APPEND result "-nostdlib")
endif()
elseif("${LFLAGS_SDK}" STREQUAL "HAIKU")
list(APPEND result "-lbsd" "-latomic" "-Wl,-Bsymbolic")
elseif("${LFLAGS_SDK}" STREQUAL "ANDROID")
list(APPEND result
"-ldl" "-llog" "-latomic" "-licudataswift" "-licui18nswift" "-licuucswift"
Expand Down Expand Up @@ -1262,6 +1264,9 @@ endfunction()
# SWIFT_MODULE_DEPENDS_CYGWIN
# Swift modules this library depends on when built for Cygwin.
#
# SWIFT_MODULE_DEPENDS_HAIKU
# Swift modules this library depends on when built for Haiku.
#
# FRAMEWORK_DEPENDS
# System frameworks this library depends on.
#
Expand Down Expand Up @@ -1335,7 +1340,7 @@ function(add_swift_library name)
cmake_parse_arguments(SWIFTLIB
"${SWIFTLIB_options}"
"INSTALL_IN_COMPONENT;DEPLOYMENT_VERSION_OSX;DEPLOYMENT_VERSION_IOS;DEPLOYMENT_VERSION_TVOS;DEPLOYMENT_VERSION_WATCHOS"
"DEPENDS;LINK_LIBRARIES;SWIFT_MODULE_DEPENDS;SWIFT_MODULE_DEPENDS_OSX;SWIFT_MODULE_DEPENDS_IOS;SWIFT_MODULE_DEPENDS_TVOS;SWIFT_MODULE_DEPENDS_WATCHOS;SWIFT_MODULE_DEPENDS_FREEBSD;SWIFT_MODULE_DEPENDS_LINUX;SWIFT_MODULE_DEPENDS_CYGWIN;FRAMEWORK_DEPENDS;FRAMEWORK_DEPENDS_WEAK;FRAMEWORK_DEPENDS_OSX;FRAMEWORK_DEPENDS_IOS_TVOS;LLVM_COMPONENT_DEPENDS;FILE_DEPENDS;TARGET_SDKS;C_COMPILE_FLAGS;SWIFT_COMPILE_FLAGS;SWIFT_COMPILE_FLAGS_OSX;SWIFT_COMPILE_FLAGS_IOS;SWIFT_COMPILE_FLAGS_TVOS;SWIFT_COMPILE_FLAGS_WATCHOS;LINK_FLAGS;PRIVATE_LINK_LIBRARIES;INTERFACE_LINK_LIBRARIES;INCORPORATE_OBJECT_LIBRARIES;INCORPORATE_OBJECT_LIBRARIES_SHARED_ONLY"
"DEPENDS;LINK_LIBRARIES;SWIFT_MODULE_DEPENDS;SWIFT_MODULE_DEPENDS_OSX;SWIFT_MODULE_DEPENDS_IOS;SWIFT_MODULE_DEPENDS_TVOS;SWIFT_MODULE_DEPENDS_WATCHOS;SWIFT_MODULE_DEPENDS_FREEBSD;SWIFT_MODULE_DEPENDS_LINUX;SWIFT_MODULE_DEPENDS_CYGWIN;SWIFT_MODULE_DEPENDS_HAIKU;FRAMEWORK_DEPENDS;FRAMEWORK_DEPENDS_WEAK;FRAMEWORK_DEPENDS_OSX;FRAMEWORK_DEPENDS_IOS_TVOS;LLVM_COMPONENT_DEPENDS;FILE_DEPENDS;TARGET_SDKS;C_COMPILE_FLAGS;SWIFT_COMPILE_FLAGS;SWIFT_COMPILE_FLAGS_OSX;SWIFT_COMPILE_FLAGS_IOS;SWIFT_COMPILE_FLAGS_TVOS;SWIFT_COMPILE_FLAGS_WATCHOS;LINK_FLAGS;PRIVATE_LINK_LIBRARIES;INTERFACE_LINK_LIBRARIES;INCORPORATE_OBJECT_LIBRARIES;INCORPORATE_OBJECT_LIBRARIES_SHARED_ONLY"
${ARGN})
set(SWIFTLIB_SOURCES ${SWIFTLIB_UNPARSED_ARGUMENTS})

Expand Down Expand Up @@ -1366,7 +1371,7 @@ function(add_swift_library name)
if("${SWIFTLIB_TARGET_SDKS}" STREQUAL "")
set(SWIFTLIB_TARGET_SDKS ${SWIFT_SDKS})
endif()
list_replace(SWIFTLIB_TARGET_SDKS ALL_POSIX_PLATFORMS "ALL_APPLE_PLATFORMS;ANDROID;CYGWIN;FREEBSD;LINUX")
list_replace(SWIFTLIB_TARGET_SDKS ALL_POSIX_PLATFORMS "ALL_APPLE_PLATFORMS;ANDROID;CYGWIN;FREEBSD;LINUX;HAIKU")
list_replace(SWIFTLIB_TARGET_SDKS ALL_APPLE_PLATFORMS "${SWIFT_APPLE_PLATFORMS}")

# All Swift code depends on the standard library, except for the standard
Expand Down Expand Up @@ -1476,6 +1481,9 @@ function(add_swift_library name)
elseif("${sdk}" STREQUAL "CYGWIN")
list(APPEND swiftlib_module_depends_flattened
${SWIFTLIB_SWIFT_MODULE_DEPENDS_CYGWIN})
elseif("${sdk}" STREQUAL "HAIKU")
list(APPEND swiftlib_module_depends_flattened
${SWIFTLIB_SWIFT_MODULE_DEPENDS_HAIKU})
endif()

# Swift compiles depend on swift modules, while links depend on
Expand Down
2 changes: 1 addition & 1 deletion cmake/modules/FindICU.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ foreach(MODULE ${ICU_FIND_COMPONENTS})
endif()
endforeach()

foreach(sdk ANDROID;FREEBSD;LINUX;WINDOWS)
foreach(sdk ANDROID;FREEBSD;LINUX;WINDOWS;HAIKU)
foreach(MODULE ${ICU_FIND_COMPONENTS})
string(TOUPPER "${MODULE}" MODULE)
if("${SWIFT_${sdk}_ICU_${MODULE}_INCLUDE}" STREQUAL "")
Expand Down
3 changes: 2 additions & 1 deletion include/swift/Basic/LangOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ namespace swift {
Target.getOSVersion(major, minor, revision);
} else if (Target.isOSLinux() || Target.isOSFreeBSD() ||
Target.isAndroid() || Target.isOSWindows() ||
Target.isPS4() || Target.getTriple().empty()) {
Target.isPS4() || Target.isOSHaiku() ||
Target.getTriple().empty()) {
major = minor = revision = 0;
} else {
llvm_unreachable("Unsupported target OS");
Expand Down
2 changes: 1 addition & 1 deletion include/swift/Runtime/Concurrent.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <stdint.h>
#include "llvm/Support/Allocator.h"

#if defined(__FreeBSD__) || defined(__CYGWIN__)
#if defined(__FreeBSD__) || defined(__CYGWIN__) || defined(__HAIKU__)
#include <stdio.h>
#endif

Expand Down
2 changes: 1 addition & 1 deletion include/swift/Runtime/Mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include <type_traits>

#if (defined(__APPLE__) || defined(__linux__) || defined(__CYGWIN__) || defined(__FreeBSD__))
#if (defined(__APPLE__) || defined(__linux__) || defined(__CYGWIN__) || defined(__FreeBSD__) || defined(__HAIKU__))
#include "swift/Runtime/MutexPThread.h"
#elif defined(_WIN32)
#include "swift/Runtime/MutexWin32.h"
Expand Down
2 changes: 1 addition & 1 deletion include/swift/Runtime/MutexPThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ typedef pthread_cond_t ConditionHandle;
typedef pthread_mutex_t MutexHandle;
typedef pthread_rwlock_t ReadWriteLockHandle;

#if defined(__CYGWIN__) || defined(__ANDROID__)
#if defined(__CYGWIN__) || defined(__ANDROID__) || defined(__HAIKU__)
// At the moment CYGWIN pthreads implementation doesn't support the use of
// constexpr for static allocation versions. The way they define things
// results in a reinterpret_cast which violates constexpr. Similarly, Android's
Expand Down
3 changes: 3 additions & 0 deletions lib/Basic/LangOptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ static const StringRef SupportedConditionalCompilationOSs[] = {
"Android",
"PS4",
"Cygwin",
"Haiku",
};

static const StringRef SupportedConditionalCompilationArches[] = {
Expand Down Expand Up @@ -181,6 +182,8 @@ std::pair<bool, bool> LangOptions::setTarget(llvm::Triple triple) {
addPlatformConditionValue(PlatformConditionKind::OS, "Cygwin");
else if (triple.isPS4())
addPlatformConditionValue(PlatformConditionKind::OS, "PS4");
else if (triple.isOSHaiku())
addPlatformConditionValue(PlatformConditionKind::OS, "Haiku");
else
UnsupportedOS = true;

Expand Down
3 changes: 2 additions & 1 deletion lib/Basic/Platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ StringRef swift::getPlatformNameForTriple(const llvm::Triple &triple) {
case llvm::Triple::NetBSD:
case llvm::Triple::OpenBSD:
case llvm::Triple::Solaris:
case llvm::Triple::Haiku:
case llvm::Triple::Minix:
case llvm::Triple::RTEMS:
case llvm::Triple::NaCl:
Expand Down Expand Up @@ -135,6 +134,8 @@ StringRef swift::getPlatformNameForTriple(const llvm::Triple &triple) {
}
case llvm::Triple::PS4:
return "ps4";
case llvm::Triple::Haiku:
return "haiku";
}
llvm_unreachable("unsupported OS");
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Basic/Statistic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ using namespace llvm::sys;

static size_t
getChildrenMaxResidentSetSize() {
#if defined(HAVE_GETRUSAGE)
#if defined(HAVE_GETRUSAGE) && !defined(__HAIKU__)
struct rusage RU;
::getrusage(RUSAGE_CHILDREN, &RU);
return RU.ru_maxrss;
Expand Down
2 changes: 1 addition & 1 deletion lib/Basic/TaskQueue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ using namespace swift;
using namespace swift::sys;

// Include the correct TaskQueue implementation.
#if LLVM_ON_UNIX && !defined(__CYGWIN__)
#if LLVM_ON_UNIX && !defined(__CYGWIN__) && !defined(__HAIKU__)
#include "Unix/TaskQueue.inc"
#else
#include "Default/TaskQueue.inc"
Expand Down
3 changes: 3 additions & 0 deletions lib/Driver/Driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,9 @@ makeToolChain(Driver &driver, const llvm::Triple &target) {
case llvm::Triple::Win32:
return llvm::make_unique<toolchains::Cygwin>(driver, target);
break;
case llvm::Triple::Haiku:
return llvm::make_unique<toolchains::GenericUnix>(driver, target);
break;
default:
return nullptr;
}
Expand Down
8 changes: 7 additions & 1 deletion lib/Driver/ToolChains.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1514,7 +1514,7 @@ bool toolchains::GenericUnix::shouldProvideRPathToLinker() const {

std::string toolchains::GenericUnix::getPreInputObjectPath(
StringRef RuntimeLibraryPath) const {
// On Linux and FreeBSD (really, ELF binaries) we need to add objects
// On Linux and FreeBSD and Haiku (really, ELF binaries) we need to add objects
// to provide markers and size for the metadata sections.
SmallString<128> PreInputObjectPath = RuntimeLibraryPath;
llvm::sys::path::append(PreInputObjectPath,
Expand Down Expand Up @@ -1559,7 +1559,13 @@ toolchains::GenericUnix::constructInvocation(const LinkJobAction &job,
Linker = getDefaultLinker();
}
if (!Linker.empty()) {
#if defined(__HAIKU__)
// For now, passing -fuse-ld on Haiku doesn't work as swiftc doesn't recognise
// it. Passing -use-ld= as the argument works fine.
Arguments.push_back(context.Args.MakeArgString("-use-ld=" + Linker));
#else
Arguments.push_back(context.Args.MakeArgString("-fuse-ld=" + Linker));
#endif
}

// Configure the toolchain.
Expand Down
1 change: 1 addition & 0 deletions stdlib/private/StdlibUnittest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ add_swift_library(swiftStdlibUnittest ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS_STD
SWIFT_MODULE_DEPENDS_LINUX Glibc
SWIFT_MODULE_DEPENDS_FREEBSD Glibc
SWIFT_MODULE_DEPENDS_CYGWIN Glibc
SWIFT_MODULE_DEPENDS_HAIKU Glibc
SWIFT_COMPILE_FLAGS ${swift_stdlib_unittest_compile_flags}
TARGET_SDKS ALL_POSIX_PLATFORMS
INSTALL_IN_COMPONENT stdlib-experimental)
Expand Down
2 changes: 1 addition & 1 deletion stdlib/private/StdlibUnittest/RaceTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import SwiftPrivateLibcExtras
import SwiftPrivatePthreadExtras
#if os(OSX) || os(iOS)
import Darwin
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin)
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
import Glibc
#endif

Expand Down
2 changes: 1 addition & 1 deletion stdlib/private/StdlibUnittest/StdlibCoreExtras.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import SwiftPrivate
import SwiftPrivateLibcExtras
#if os(OSX) || os(iOS)
import Darwin
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin)
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
import Glibc
#endif

Expand Down
20 changes: 19 additions & 1 deletion stdlib/private/StdlibUnittest/StdlibUnittest.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import SwiftPrivateLibcExtras

#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
import Darwin
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin)
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
import Glibc
#endif

Expand Down Expand Up @@ -1464,6 +1464,7 @@ public enum OSVersion : CustomStringConvertible {
case ps4
case windowsCygnus
case windows
case haiku

public var description: String {
switch self {
Expand Down Expand Up @@ -1493,6 +1494,8 @@ public enum OSVersion : CustomStringConvertible {
return "Cygwin"
case .windows:
return "Windows"
case .haiku:
return "Haiku"
}
}
}
Expand Down Expand Up @@ -1535,6 +1538,8 @@ func _getOSVersion() -> OSVersion {
return .windowsCygnus
#elseif os(Windows)
return .windows
#elseif os(Haiku)
return .haiku
#else
let productVersion = _stdlib_getSystemVersionPlistProperty("ProductVersion")!
let (major, minor, bugFix) = _parseDottedVersionTriple(productVersion)
Expand Down Expand Up @@ -1616,6 +1621,8 @@ public enum TestRunPredicate : CustomStringConvertible {
case windowsAny(reason: String)

case windowsCygnusAny(reason: String)

case haikuAny(reason: String)

case objCRuntime(/*reason:*/ String)
case nativeRuntime(/*reason:*/ String)
Expand Down Expand Up @@ -1708,6 +1715,9 @@ public enum TestRunPredicate : CustomStringConvertible {

case .windowsCygnusAny(reason: let reason):
return "windowsCygnusAny(*, reason: \(reason))"

case .haikuAny(reason: let reason):
return "haikuAny(*, reason: \(reason))"

case .objCRuntime(let reason):
return "Objective-C runtime, reason: \(reason))"
Expand Down Expand Up @@ -1991,6 +2001,14 @@ public enum TestRunPredicate : CustomStringConvertible {
default:
return false
}

case .haikuAny:
switch _getRunningOSVersion() {
case .haiku:
return true
default:
return false
}

case .objCRuntime:
#if _runtime(_ObjC)
Expand Down
1 change: 1 addition & 0 deletions stdlib/private/SwiftPrivateLibcExtras/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,5 @@ add_swift_library(swiftSwiftPrivateLibcExtras ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES
SWIFT_MODULE_DEPENDS_LINUX Glibc
SWIFT_MODULE_DEPENDS_FREEBSD Glibc
SWIFT_MODULE_DEPENDS_CYGWIN Glibc
SWIFT_MODULE_DEPENDS_HAIKU Glibc
INSTALL_IN_COMPONENT stdlib-experimental)
4 changes: 2 additions & 2 deletions stdlib/private/SwiftPrivateLibcExtras/Subprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
//===----------------------------------------------------------------------===//

// posix_spawn is not available on Android or Windows (MSVC).
#if !defined(__ANDROID__) && (!defined(_WIN32) || defined(__CYGWIN__))
#if !defined(__ANDROID__) && !defined(__HAIKU__) && (!defined(_WIN32) || defined(__CYGWIN__))

#include "swift/Runtime/Config.h"

Expand Down Expand Up @@ -65,5 +65,5 @@ char ***swift_SwiftPrivateLibcExtras_NSGetEnviron(void) {
return _NSGetEnviron();
}
#endif // defined(__APPLE__)
#endif // !defined(__ANDROID__) && (!defined(_WIN32) || defined(__CGYWIN__))
#endif // !defined(__ANDROID__) && !defined(__HAIKU__) && (!defined(_WIN32) || defined(__CGYWIN__))

11 changes: 7 additions & 4 deletions stdlib/private/SwiftPrivateLibcExtras/Subprocess.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,16 @@
import SwiftPrivate
#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
import Darwin
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin)
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
import Glibc
#endif


#if !os(Windows)
// posix_spawn is not available on Windows.
// posix_spawn is not available on Android.
#if !os(Android)
// posix_spawn is not available on Haiku.
#if !os(Android) && !os(Haiku)
// swift_posix_spawn isn't available in the public watchOS SDK, we sneak by the
// unavailable attribute declaration here of the APIs that we need.

Expand Down Expand Up @@ -83,7 +84,7 @@ public func spawnChild(_ args: [String])
let childStdin = posixPipe()
let childStderr = posixPipe()

#if os(Android)
#if os(Android) || os(Haiku)
// posix_spawn isn't available on Android. Instead, we fork and exec.
// To correctly communicate the exit status of the child process to this
// (parent) process, we'll use this pipe.
Expand Down Expand Up @@ -222,7 +223,7 @@ public func spawnChild(_ args: [String])
return (pid, childStdin.writeFD, childStdout.readFD, childStderr.readFD)
}

#if !os(Android)
#if !os(Android) && !os(Haiku)
#if os(Linux)
internal func _make_posix_spawn_file_actions_t()
-> swift_posix_spawn_file_actions_t {
Expand Down Expand Up @@ -307,6 +308,8 @@ internal func _getEnviron() -> UnsafeMutablePointer<UnsafeMutablePointer<CChar>?
return environ
#elseif os(Cygwin)
return environ
#elseif os(Haiku)
return environ
#else
return __environ
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
import SwiftPrivate
#if os(OSX) || os(iOS) || os(watchOS) || os(tvOS)
import Darwin
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin)
#elseif os(Linux) || os(FreeBSD) || os(PS4) || os(Android) || os(Cygwin) || os(Haiku)
import Glibc
#elseif os(Windows)
import ucrt
#endif

#if !os(Windows)
public func _stdlib_mkstemps(_ template: inout String, _ suffixlen: CInt) -> CInt {
#if os(Android)
preconditionFailure("mkstemps doesn't work on Android")
#if os(Android) || os(Haiku)
preconditionFailure("mkstemps doesn't work on your platform")
#else
var utf8CStr = template.utf8CString
let (fd, fileName) = utf8CStr.withUnsafeMutableBufferPointer {
Expand Down
Loading