diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2021-12-15 19:47:02 +0100 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2021-12-15 19:51:30 +0100 |
commit | fd43568cc54e17c8b4a845677872c6282bc6dbb7 (patch) | |
tree | 24f591392a2978706aef4d58e377b8b42b5ba418 /libphobos/src/std | |
parent | 639ece7abfa3688008cb791aec4c7a1a4f76e59f (diff) | |
download | gcc-fd43568cc54e17c8b4a845677872c6282bc6dbb7.zip gcc-fd43568cc54e17c8b4a845677872c6282bc6dbb7.tar.gz gcc-fd43568cc54e17c8b4a845677872c6282bc6dbb7.tar.bz2 |
d: Merge upstream dmd 93108bb9e, druntime 6364e010, phobos 575b67a9b.
D front-end changes:
- Import dmd v2.098.1-beta.1.
- Default extern(C++) compatibility to C++17.
Druntime changes:
- Import druntime v2.098.1-beta.1.
- Fix definition of stat_t on MIPS64 (PR103604)
Phobos changes:
- Import phobos v2.098.1-beta.1.
gcc/d/ChangeLog:
* d-lang.cc (d_init_options): Set default -fextern-std= to C++17.
* dmd/MERGE: Merge upstream dmd 93108bb9e.
* gdc.texi (Runtime Options): Document the default for -fextern-std=.
libphobos/ChangeLog:
PR d/103604
* configure: Regenerate.
* configure.ac (libtool_VERSION): Update to 3:0:0.
* libdruntime/MERGE: Merge upstream druntime 6364e010.
* src/MERGE: Merge upstream phobos 575b67a9b.
* testsuite/libphobos.traits/all_satisfy.d: New test.
* testsuite/libphobos.traits/traits.exp: New test.
Diffstat (limited to 'libphobos/src/std')
-rw-r--r-- | libphobos/src/std/algorithm/searching.d | 12 | ||||
-rw-r--r-- | libphobos/src/std/datetime/timezone.d | 3 | ||||
-rw-r--r-- | libphobos/src/std/parallelism.d | 6 | ||||
-rw-r--r-- | libphobos/src/std/regex/package.d | 16 | ||||
-rw-r--r-- | libphobos/src/std/traits.d | 5 |
5 files changed, 31 insertions, 11 deletions
diff --git a/libphobos/src/std/algorithm/searching.d b/libphobos/src/std/algorithm/searching.d index 9635206..55a1438 100644 --- a/libphobos/src/std/algorithm/searching.d +++ b/libphobos/src/std/algorithm/searching.d @@ -638,7 +638,7 @@ Returns: */ size_t count(alias pred = "a == b", Range, E)(Range haystack, E needle) if (isInputRange!Range && !isInfinite!Range && - is(typeof(binaryFun!pred(haystack.front, needle)) : bool)) + is(typeof(binaryFun!pred(haystack.front, needle)))) { bool pred2(ElementType!Range a) { return binaryFun!pred(a, needle); } return count!pred2(haystack); @@ -693,7 +693,7 @@ if (isInputRange!Range && !isInfinite!Range && size_t count(alias pred = "a == b", R1, R2)(R1 haystack, R2 needle) if (isForwardRange!R1 && !isInfinite!R1 && isForwardRange!R2 && - is(typeof(binaryFun!pred(haystack.front, needle.front)) : bool)) + is(typeof(binaryFun!pred(haystack.front, needle.front)))) { assert(!needle.empty, "Cannot count occurrences of an empty range"); @@ -716,7 +716,7 @@ if (isForwardRange!R1 && !isInfinite!R1 && /// Ditto size_t count(alias pred, R)(R haystack) if (isInputRange!R && !isInfinite!R && - is(typeof(unaryFun!pred(haystack.front)) : bool)) + is(typeof(unaryFun!pred(haystack.front)))) { size_t result; alias T = ElementType!R; //For narrow strings forces dchar iteration @@ -745,6 +745,12 @@ if (isInputRange!R && !isInfinite!R) assert([1, 2, 3].count([2, 3]) == 1); } +// https://issues.dlang.org/show_bug.cgi?id=22582 +@safe unittest +{ + assert([1, 2, 3].count!"a & 1" == 2); +} + /++ Counts elements in the given $(REF_ALTTEXT forward range, isForwardRange, std,range,primitives) diff --git a/libphobos/src/std/datetime/timezone.d b/libphobos/src/std/datetime/timezone.d index a55411b..28255f4 100644 --- a/libphobos/src/std/datetime/timezone.d +++ b/libphobos/src/std/datetime/timezone.d @@ -2464,7 +2464,8 @@ public: if (!tzName.extension().empty || !tzName.startsWith(subName) || baseName(tzName) == "leapseconds" || - tzName == "+VERSION") + tzName == "+VERSION" || + tzName == "SECURITY") { continue; } diff --git a/libphobos/src/std/parallelism.d b/libphobos/src/std/parallelism.d index bd467d2..971cfa0 100644 --- a/libphobos/src/std/parallelism.d +++ b/libphobos/src/std/parallelism.d @@ -2738,7 +2738,7 @@ public: immutable size_t nBytesNeeded = nWorkUnits * RTask.sizeof; import core.stdc.stdlib : malloc, free; - if (nBytesNeeded < maxStack) + if (nBytesNeeded <= maxStack) { tasks = (cast(RTask*) buf.ptr)[0 .. nWorkUnits]; } @@ -3045,11 +3045,11 @@ public: Since the underlying data for this struct is heap-allocated, this struct has reference semantics when passed between functions. - The main uses cases for `WorkerLocalStorageStorage` are: + The main uses cases for `WorkerLocalStorage` are: 1. Performing parallel reductions with an imperative, as opposed to functional, programming style. In this case, it's useful to treat - `WorkerLocalStorageStorage` as local to each thread for only the parallel + `WorkerLocalStorage` as local to each thread for only the parallel portion of an algorithm. 2. Recycling temporary buffers across iterations of a parallel foreach loop. diff --git a/libphobos/src/std/regex/package.d b/libphobos/src/std/regex/package.d index 82207b6..8db0b1e 100644 --- a/libphobos/src/std/regex/package.d +++ b/libphobos/src/std/regex/package.d @@ -70,7 +70,7 @@ $(TR $(TD Objects) $(TD ... // multi-pattern regex - auto multi = regex([`\d+,\d+`,`(a-z]+):(\d+)`]); + auto multi = regex([`\d+,\d+`, `([a-z]+):(\d+)`]); auto m = "abc:43 12,34".matchAll(multi); assert(m.front.whichPattern == 2); assert(m.front[1] == "abc"); @@ -80,9 +80,17 @@ $(TR $(TD Objects) $(TD assert(m.front[1] == "12"); ... - // The result of the `matchAll/matchFirst` is directly testable with if/assert/while. - // e.g. test if a string consists of letters: - assert(matchFirst("Letter", `^\p{L}+$`)); + // The result of `matchAll/matchFirst` is directly testable with `if/assert/while`, + // e.g. test if a string consists of letters only: + assert(matchFirst("LettersOnly", `^\p{L}+$`)); + + // And we can take advantage of the ability to define a variable in the $(LINK2 https://dlang.org/spec/statement.html#IfCondition `IfCondition`): + if (const auto captures = matchFirst("At l34st one digit, but maybe more...", `((\d)(\d*))`)) + { + assert(captures[2] == "3"); + assert(captures[3] == "4"); + assert(captures[1] == "34"); + } --- $(SECTION Syntax and general information) diff --git a/libphobos/src/std/traits.d b/libphobos/src/std/traits.d index 1541415..c1d6bc9 100644 --- a/libphobos/src/std/traits.d +++ b/libphobos/src/std/traits.d @@ -829,6 +829,10 @@ private template fqnType(T, { enum fqnType = "dstring"; } + else static if (is(T == typeof(null))) + { + enum fqnType = "typeof(null)"; + } else static if (isBasicType!T && !is(T == enum)) { enum fqnType = chain!((Unqual!T).stringof); @@ -919,6 +923,7 @@ private template fqnType(T, static assert(fqn!(string) == "string"); static assert(fqn!(wstring) == "wstring"); static assert(fqn!(dstring) == "dstring"); + static assert(fqn!(typeof(null)) == "typeof(null)"); static assert(fqn!(void) == "void"); static assert(fqn!(const(void)) == "const(void)"); static assert(fqn!(shared(void)) == "shared(void)"); |