* [PATCH, libphobos] Committed merge with upstream phobos b538f758a.
@ 2019-04-22 14:01 Iain Buclaw
0 siblings, 0 replies; only message in thread
From: Iain Buclaw @ 2019-04-22 14:01 UTC (permalink / raw)
To: gcc-patches; +Cc: Robin Dapp
[-- Attachment #1: Type: text/plain, Size: 315 bytes --]
Hi,
This patch merges the libphobos library with upstream phobos b538f758a.
Fixes endian bugs in std.uni, and corrects unit-tests that failed on
version(BigEndian) targets, with good results on s390-linux-gnu.
Bootstrapped and regression tested on x86_64-linux-gnu.
Committed to trunk as r270491.
--
Iain
---
[-- Attachment #2: phobosb538f758a.patch --]
[-- Type: text/x-patch, Size: 4445 bytes --]
diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE
index 3935c059403..e4807fbf437 100644
--- a/libphobos/src/MERGE
+++ b/libphobos/src/MERGE
@@ -1,4 +1,4 @@
-428460ddd8087fa28815e613ff04facb51108a7b
+b538f758a4d274b64751f80564b0207845cd018c
The first line of this file holds the git revision number of the last
merge done from the dlang/phobos repository.
diff --git a/libphobos/src/std/net/curl.d b/libphobos/src/std/net/curl.d
index e3ce527c303..32ba45ce2de 100644
--- a/libphobos/src/std/net/curl.d
+++ b/libphobos/src/std/net/curl.d
@@ -207,9 +207,7 @@ version (unittest)
}
catch (Throwable e)
{
- import core.stdc.stdlib : exit, EXIT_FAILURE;
- stderr.writeln(e);
- exit(EXIT_FAILURE); // Bugzilla 7018
+ stderr.writeln(e); // Bugzilla 7018
}
}
}
diff --git a/libphobos/src/std/outbuffer.d b/libphobos/src/std/outbuffer.d
index 1d594982cc1..d76ead2ed49 100644
--- a/libphobos/src/std/outbuffer.d
+++ b/libphobos/src/std/outbuffer.d
@@ -408,11 +408,17 @@ class OutBuffer
{
OutBuffer buf = new OutBuffer();
"hello"w.copy(buf);
- assert(buf.toBytes() == "h\x00e\x00l\x00l\x00o\x00");
+ version (LittleEndian)
+ assert(buf.toBytes() == "h\x00e\x00l\x00l\x00o\x00");
+ version (BigEndian)
+ assert(buf.toBytes() == "\x00h\x00e\x00l\x00l\x00o");
}
{
OutBuffer buf = new OutBuffer();
"hello"d.copy(buf);
- assert(buf.toBytes() == "h\x00\x00\x00e\x00\x00\x00l\x00\x00\x00l\x00\x00\x00o\x00\x00\x00");
+ version (LittleEndian)
+ assert(buf.toBytes() == "h\x00\x00\x00e\x00\x00\x00l\x00\x00\x00l\x00\x00\x00o\x00\x00\x00");
+ version (BigEndian)
+ assert(buf.toBytes() == "\x00\x00\x00h\x00\x00\x00e\x00\x00\x00l\x00\x00\x00l\x00\x00\x00o");
}
}
diff --git a/libphobos/src/std/uni.d b/libphobos/src/std/uni.d
index 5f24ad16be5..0b3da58286c 100644
--- a/libphobos/src/std/uni.d
+++ b/libphobos/src/std/uni.d
@@ -770,6 +770,8 @@ version (X86)
enum hasUnalignedReads = true;
else version (X86_64)
enum hasUnalignedReads = true;
+else version (SystemZ)
+ enum hasUnalignedReads = true;
else
enum hasUnalignedReads = false; // better be safe then sorry
@@ -1245,8 +1247,13 @@ pure nothrow:
T opIndex(size_t idx) inout
{
- return __ctfe ? simpleIndex(idx) :
- cast(inout(T))(cast(U*) origin)[idx];
+ T ret;
+ version (LittleEndian)
+ ret = __ctfe ? simpleIndex(idx) :
+ cast(inout(T))(cast(U*) origin)[idx];
+ else
+ ret = simpleIndex(idx);
+ return ret;
}
static if (isBitPacked!T) // lack of user-defined implicit conversion
@@ -1259,10 +1266,15 @@ pure nothrow:
void opIndexAssign(TypeOfBitPacked!T val, size_t idx)
{
- if (__ctfe)
- simpleWrite(val, idx);
+ version (LittleEndian)
+ {
+ if (__ctfe)
+ simpleWrite(val, idx);
+ else
+ (cast(U*) origin)[idx] = cast(U) val;
+ }
else
- (cast(U*) origin)[idx] = cast(U) val;
+ simpleWrite(val, idx);
}
}
else
diff --git a/libphobos/src/std/xml.d b/libphobos/src/std/xml.d
index 770c56fdbfb..13241f53613 100644
--- a/libphobos/src/std/xml.d
+++ b/libphobos/src/std/xml.d
@@ -2201,8 +2201,10 @@ private
mixin Check!("Chars");
dchar c;
- int n = -1;
- foreach (int i,dchar d; s)
+ ptrdiff_t n = -1;
+ // 'i' must not be smaller than size_t because size_t is used internally in
+ // aApply.d and it will be cast e.g to (int *) which fails on BigEndian targets.
+ foreach (size_t i, dchar d; s)
{
if (!isChar(d))
{
@@ -2238,8 +2240,10 @@ private
mixin Check!("Name");
if (s.length == 0) fail();
- int n;
- foreach (int i,dchar c;s)
+ ptrdiff_t n;
+ // 'i' must not be smaller than size_t because size_t is used internally in
+ // aApply.d and it will be cast e.g to (int *) which fails on BigEndian targets.
+ foreach (size_t i, dchar c; s)
{
if (c == '_' || c == ':' || isLetter(c)) continue;
if (i == 0) fail();
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2019-04-22 13:56 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-22 14:01 [PATCH, libphobos] Committed merge with upstream phobos b538f758a Iain Buclaw
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).