aboutsummaryrefslogtreecommitdiff
path: root/libphobos
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2023-08-15 16:29:08 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2023-08-20 11:20:00 +0200
commitd77c280454cfba48ef38357145cecdabc8c1b05c (patch)
tree49e02afce6ab03a3405752c963b6ffb225012a40 /libphobos
parentce33bbfcbc7dd3afc6c96fb48a19ed00f0c598ce (diff)
downloadgcc-d77c280454cfba48ef38357145cecdabc8c1b05c.zip
gcc-d77c280454cfba48ef38357145cecdabc8c1b05c.tar.gz
gcc-d77c280454cfba48ef38357145cecdabc8c1b05c.tar.bz2
d: Merge upstream dmd, druntime 26f049fb26, phobos 330d6a4fd.
D front-end changes: - Import dmd v2.105.0-beta.1. - Added predefined version identifier VisionOS (ignored by GDC). - Functions can no longer have `enum` storage class. - The deprecation of the `body` keyword has been reverted, it is now an obsolete feature. - The error for `scope class` has been reverted, it is now an obsolete feature. D runtime changes: - Import druntime v2.105.0-beta.1. Phobos changes: - Import phobos v2.105.0-beta.1. - AliasSeq has been removed from std.math. - extern(C) getdelim and getline have been removed from std.stdio. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 26f049fb26. * dmd/VERSION: Bump version to v2.105.0-beta.1. * d-codegen.cc (get_frameinfo): Check useGC in condition. * d-lang.cc (d_handle_option): Set obsolete parameter when compiling with -Wall. (d_post_options): Set useGC to false when compiling with -fno-druntime. Propagate obsolete flag to compileEnv. * expr.cc (ExprVisitor::visit (CatExp *)): Check useGC in condition. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 26f049fb26. * src/MERGE: Merge upstream phobos 330d6a4fd.
Diffstat (limited to 'libphobos')
-rw-r--r--libphobos/libdruntime/MERGE2
-rw-r--r--libphobos/libdruntime/core/int128.d8
-rw-r--r--libphobos/libdruntime/core/internal/array/comparison.d25
-rw-r--r--libphobos/libdruntime/core/lifetime.d6
-rw-r--r--libphobos/src/MERGE2
-rw-r--r--libphobos/src/std/algorithm/searching.d17
-rw-r--r--libphobos/src/std/bigint.d23
-rw-r--r--libphobos/src/std/json.d4
-rw-r--r--libphobos/src/std/math/package.d6
-rw-r--r--libphobos/src/std/stdio.d15
10 files changed, 80 insertions, 28 deletions
diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE
index 308d51b..a02a8cb 100644
--- a/libphobos/libdruntime/MERGE
+++ b/libphobos/libdruntime/MERGE
@@ -1,4 +1,4 @@
-a88e1335f7ea767ef438c34998f5d1f26008c586
+26f049fb26e755096dea3f1474decea7c0fef187
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.
diff --git a/libphobos/libdruntime/core/int128.d b/libphobos/libdruntime/core/int128.d
index 20fa7de..4c88f15 100644
--- a/libphobos/libdruntime/core/int128.d
+++ b/libphobos/libdruntime/core/int128.d
@@ -14,8 +14,8 @@ nothrow:
@safe:
@nogc:
-alias I = long;
-alias U = ulong;
+private alias I = long;
+private alias U = ulong;
enum Ubits = uint(U.sizeof * 8);
version (DigitalMars)
@@ -36,6 +36,10 @@ else
else private enum Cent_alignment = (size_t.sizeof * 2);
}
+/**
+ * 128 bit integer type.
+ * See_also: $(REF Int128, std,int128).
+ */
align(Cent_alignment) struct Cent
{
version (LittleEndian)
diff --git a/libphobos/libdruntime/core/internal/array/comparison.d b/libphobos/libdruntime/core/internal/array/comparison.d
index 821f96e..94fa243 100644
--- a/libphobos/libdruntime/core/internal/array/comparison.d
+++ b/libphobos/libdruntime/core/internal/array/comparison.d
@@ -83,7 +83,7 @@ int __cmp(T)(scope const T[] lhs, scope const T[] rhs) @trusted
// This function is called by the compiler when dealing with array
// comparisons in the semantic analysis phase of CmpExp. The ordering
// comparison is lowered to a call to this template.
-int __cmp(T1, T2)(T1[] s1, T2[] s2)
+auto __cmp(T1, T2)(T1[] s1, T2[] s2)
if (!__traits(isScalar, T1) && !__traits(isScalar, T2))
{
import core.internal.traits : Unqual;
@@ -237,3 +237,26 @@ if (!__traits(isScalar, T1) && !__traits(isScalar, T2))
auto vb = [cast(void[])b[0], b[1]];
assert(less2(va, vb));
}
+
+// custom aggregate types
+@safe unittest
+{
+ // https://issues.dlang.org/show_bug.cgi?id=24044
+ // Support float opCmp(...) with array
+ static struct F
+ {
+ float f;
+ float opCmp(F other) const { return this.f - other.f; }
+ }
+
+ F[2] a = [F(1.0f), F(float.nan)];
+ F[2] b = [F(1.0f), F(1.0f)];
+ F[1] c = [F(1.0f)];
+
+ bool isNan(float f) { return f != f; }
+
+ assert(isNan(__cmp(a, b)));
+ assert(isNan(__cmp(a, a)));
+ assert(__cmp(b, b) == 0);
+ assert(__cmp(a, c) > 0);
+}
diff --git a/libphobos/libdruntime/core/lifetime.d b/libphobos/libdruntime/core/lifetime.d
index 89236db..3a55ca9 100644
--- a/libphobos/libdruntime/core/lifetime.d
+++ b/libphobos/libdruntime/core/lifetime.d
@@ -1570,7 +1570,11 @@ template forward(args...)
alias fwd = arg;
// (r)value
else
- @property auto fwd(){ pragma(inline, true); return move(arg); }
+ @property auto fwd()
+ {
+ version (DigitalMars) { /* @@BUG 23890@@ */ } else pragma(inline, true);
+ return move(arg);
+ }
}
alias Result = AliasSeq!();
diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE
index e0011d7..a5414f16 100644
--- a/libphobos/src/MERGE
+++ b/libphobos/src/MERGE
@@ -1,4 +1,4 @@
-1921d29df25f2b44d6014c224e2018ce63ac2b71
+330d6a4fdbe82683e081959d0aeb53597b025bc4
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/algorithm/searching.d b/libphobos/src/std/algorithm/searching.d
index f061915..37a08de 100644
--- a/libphobos/src/std/algorithm/searching.d
+++ b/libphobos/src/std/algorithm/searching.d
@@ -1528,6 +1528,23 @@ if (isInputRange!Range && !isInfinite!Range &&
assert([S(5), S(6)].extremum!"a.value" == S(5));
}
+// https://issues.dlang.org/show_bug.cgi?id=24027
+@safe nothrow unittest
+{
+ class A
+ {
+ int a;
+ this(int a)
+ {
+ this.a = a;
+ }
+ }
+
+ auto test = new A(5);
+ A[] arr = [test];
+ assert(maxElement!"a.a"(arr) is test);
+}
+
// find
/**
Finds an individual element in an $(REF_ALTTEXT input range, isInputRange, std,range,primitives).
diff --git a/libphobos/src/std/bigint.d b/libphobos/src/std/bigint.d
index 50f88da..0240ea1 100644
--- a/libphobos/src/std/bigint.d
+++ b/libphobos/src/std/bigint.d
@@ -323,7 +323,15 @@ public:
else static if (op=="^^")
{
sign = (y & 1) ? sign : false;
- data = BigUint.pow(data, u);
+ if (y < 0)
+ {
+ checkDivByZero();
+ data = cast(ulong) (data == 1);
+ }
+ else
+ {
+ data = BigUint.pow(data, u);
+ }
}
else static if (op=="&")
{
@@ -411,6 +419,19 @@ public:
));
}
+ // https://issues.dlang.org/show_bug.cgi?id=24028
+ @system unittest
+ {
+ import std.exception : assertThrown;
+ import core.exception : AssertError;
+
+ assert(BigInt(100) ^^ -1 == BigInt(0));
+ assert(BigInt(1) ^^ -1 == BigInt(1));
+ assert(BigInt(-1) ^^ -1 == BigInt(-1));
+ assert(BigInt(-1) ^^ -2 == BigInt(1));
+ assertThrown!AssertError(BigInt(0) ^^ -1);
+ }
+
/**
* Implements assignment operators of the form `BigInt op= BigInt`.
*/
diff --git a/libphobos/src/std/json.d b/libphobos/src/std/json.d
index 219af71..7d48890 100644
--- a/libphobos/src/std/json.d
+++ b/libphobos/src/std/json.d
@@ -6,6 +6,10 @@ Implements functionality to read and write JavaScript Object Notation values.
JavaScript Object Notation is a lightweight data interchange format commonly used in web services and configuration files.
It's easy for humans to read and write, and it's easy for machines to parse and generate.
+$(RED Warning: While $(LREF JSONValue) is fine for small-scale use, at the range of hundreds of megabytes it is
+known to cause and exacerbate GC problems. If you encounter problems, try replacing it with a stream parser. See
+also $(LINK https://forum.dlang.org/post/dzfyaxypmkdrpakmycjv@forum.dlang.org).)
+
Copyright: Copyright Jeremie Pelletier 2008 - 2009.
License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
Authors: Jeremie Pelletier, David Herberth
diff --git a/libphobos/src/std/math/package.d b/libphobos/src/std/math/package.d
index 19982ec..b5f914a 100644
--- a/libphobos/src/std/math/package.d
+++ b/libphobos/src/std/math/package.d
@@ -168,12 +168,6 @@ public import std.math.rounding;
public import std.math.traits;
public import std.math.trigonometry;
-// @@@DEPRECATED_2.102@@@
-// Note: Exposed accidentally, should be deprecated / removed
-deprecated("std.meta.AliasSeq was unintentionally available from std.math "
- ~ "and will be removed after 2.102. Please import std.meta instead")
-public import std.meta : AliasSeq;
-
package(std): // Not public yet
/* Return the value that lies halfway between x and y on the IEEE number line.
*
diff --git a/libphobos/src/std/stdio.d b/libphobos/src/std/stdio.d
index 19ce988..d9291b1 100644
--- a/libphobos/src/std/stdio.d
+++ b/libphobos/src/std/stdio.d
@@ -425,21 +425,6 @@ private extern (C) @nogc nothrow
pragma(mangle, _FPUTWC.mangleof) int trustedFPUTWC(wchar_t ch, _iobuf* h) @trusted;
}
-static if (__traits(compiles, core.sys.posix.stdio.getdelim))
-{
- extern(C) nothrow @nogc
- {
- // @@@DEPRECATED_2.104@@@
- deprecated("To be removed after 2.104. Use core.sys.posix.stdio.getdelim instead.")
- ptrdiff_t getdelim(char**, size_t*, int, FILE*);
-
- // @@@DEPRECATED_2.104@@@
- // getline() always comes together with getdelim()
- deprecated("To be removed after 2.104. Use core.sys.posix.stdio.getline instead.")
- ptrdiff_t getline(char**, size_t*, FILE*);
- }
-}
-
//------------------------------------------------------------------------------
private struct ByRecordImpl(Fields...)
{