146 lines
4.1 KiB
Diff
146 lines
4.1 KiB
Diff
From 034988a0db917719b59887d8017addba76076b1f Mon Sep 17 00:00:00 2001
|
|
From: Joakim <git@joakim.fea.st>
|
|
Date: Sat, 17 Feb 2018 14:25:07 +0530
|
|
Subject: [PATCH] Add needed changes to get all tests passing with Musl
|
|
|
|
---
|
|
.../allocator/building_blocks/region.d | 6 +++
|
|
std/socket.d | 44 +---------------------
|
|
std/stdio.d | 24 ++++++------
|
|
3 files changed, 19 insertions(+), 55 deletions(-)
|
|
|
|
diff --git a/std/experimental/allocator/building_blocks/region.d b/std/experimental/allocator/building_blocks/region.d
|
|
index 40a5387c64..c277498d1e 100644
|
|
--- phobos/std/experimental/allocator/building_blocks/region.d
|
|
+++ phobos/std/experimental/allocator/building_blocks/region.d
|
|
@@ -647,6 +647,12 @@ struct InSituRegion(size_t size, size_t minAlign = platformAlignment)
|
|
assert((() nothrow @nogc => r2.deallocateAll())());
|
|
}
|
|
|
|
+version(CRuntime_Musl)
|
|
+{
|
|
+ // sbrk and brk are disabled in Musl:
|
|
+ // https://git.musl-libc.org/cgit/musl/commit/?id=7a995fe706e519a4f55399776ef0df9596101f93
|
|
+ // https://git.musl-libc.org/cgit/musl/commit/?id=863d628d93ea341b6a32661a1654320ce69f6a07
|
|
+} else:
|
|
private extern(C) void* sbrk(long) nothrow @nogc;
|
|
private extern(C) int brk(shared void*) nothrow @nogc;
|
|
|
|
diff --git a/std/socket.d b/std/socket.d
|
|
index 6a5e5ff2ba..8f0c8a225a 100644
|
|
--- phobos/std/socket.d
|
|
+++ phobos/std/socket.d
|
|
@@ -163,47 +163,7 @@ string formatSocketError(int err) @trusted
|
|
{
|
|
cs = strerror_r(err, buf.ptr, buf.length);
|
|
}
|
|
- else version (OSX)
|
|
- {
|
|
- auto errs = strerror_r(err, buf.ptr, buf.length);
|
|
- if (errs == 0)
|
|
- cs = buf.ptr;
|
|
- else
|
|
- return "Socket error " ~ to!string(err);
|
|
- }
|
|
- else version (FreeBSD)
|
|
- {
|
|
- auto errs = strerror_r(err, buf.ptr, buf.length);
|
|
- if (errs == 0)
|
|
- cs = buf.ptr;
|
|
- else
|
|
- return "Socket error " ~ to!string(err);
|
|
- }
|
|
- else version (NetBSD)
|
|
- {
|
|
- auto errs = strerror_r(err, buf.ptr, buf.length);
|
|
- if (errs == 0)
|
|
- cs = buf.ptr;
|
|
- else
|
|
- return "Socket error " ~ to!string(err);
|
|
- }
|
|
- else version (DragonFlyBSD)
|
|
- {
|
|
- auto errs = strerror_r(err, buf.ptr, buf.length);
|
|
- if (errs == 0)
|
|
- cs = buf.ptr;
|
|
- else
|
|
- return "Socket error " ~ to!string(err);
|
|
- }
|
|
- else version (Solaris)
|
|
- {
|
|
- auto errs = strerror_r(err, buf.ptr, buf.length);
|
|
- if (errs == 0)
|
|
- cs = buf.ptr;
|
|
- else
|
|
- return "Socket error " ~ to!string(err);
|
|
- }
|
|
- else version (CRuntime_Bionic)
|
|
+ else
|
|
{
|
|
auto errs = strerror_r(err, buf.ptr, buf.length);
|
|
if (errs == 0)
|
|
@@ -211,8 +171,6 @@ string formatSocketError(int err) @trusted
|
|
else
|
|
return "Socket error " ~ to!string(err);
|
|
}
|
|
- else
|
|
- static assert(0);
|
|
|
|
auto len = strlen(cs);
|
|
|
|
diff --git a/std/stdio.d b/std/stdio.d
|
|
index 16d34f0e94..9f0495d98c 100644
|
|
--- phobos/std/stdio.d
|
|
+++ phobos/std/stdio.d
|
|
@@ -44,38 +44,38 @@ version (CRuntime_Glibc)
|
|
version = GCC_IO;
|
|
version = HAS_GETDELIM;
|
|
}
|
|
-
|
|
-version (OSX)
|
|
+else version (CRuntime_Bionic)
|
|
{
|
|
version = GENERIC_IO;
|
|
version = HAS_GETDELIM;
|
|
}
|
|
-
|
|
-version (FreeBSD)
|
|
+else version (CRuntime_Musl)
|
|
{
|
|
version = GENERIC_IO;
|
|
version = HAS_GETDELIM;
|
|
}
|
|
|
|
-version (NetBSD)
|
|
+version (OSX)
|
|
{
|
|
version = GENERIC_IO;
|
|
version = HAS_GETDELIM;
|
|
}
|
|
-
|
|
-version (DragonFlyBSD)
|
|
+else version (FreeBSD)
|
|
{
|
|
version = GENERIC_IO;
|
|
version = HAS_GETDELIM;
|
|
}
|
|
-
|
|
-version (Solaris)
|
|
+else version (NetBSD)
|
|
{
|
|
version = GENERIC_IO;
|
|
- version = NO_GETDELIM;
|
|
+ version = HAS_GETDELIM;
|
|
}
|
|
-
|
|
-version (CRuntime_Bionic)
|
|
+else version (DragonFlyBSD)
|
|
+{
|
|
+ version = GENERIC_IO;
|
|
+ version = HAS_GETDELIM;
|
|
+}
|
|
+else version (Solaris)
|
|
{
|
|
version = GENERIC_IO;
|
|
version = NO_GETDELIM;
|