diff options
55 files changed, 1215 insertions, 649 deletions
diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE index 44c7e3f..46d435e 100644 --- a/libphobos/libdruntime/MERGE +++ b/libphobos/libdruntime/MERGE @@ -1,4 +1,4 @@ -e60bfd11bd6a523418f94d1d821b7af71f5ad05b +c11e1d1708646c9ac81ac2aafb57fa1ef5d289ad 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/Makefile.am b/libphobos/libdruntime/Makefile.am index c2027f1..a20bf6b 100644 --- a/libphobos/libdruntime/Makefile.am +++ b/libphobos/libdruntime/Makefile.am @@ -266,17 +266,18 @@ DRUNTIME_DSOURCES_ELF = core/sys/elf/package.d DRUNTIME_DSOURCES_FREEBSD = core/sys/freebsd/config.d \ core/sys/freebsd/dlfcn.d core/sys/freebsd/err.d \ core/sys/freebsd/execinfo.d core/sys/freebsd/ifaddrs.d \ - core/sys/freebsd/net/if_.d core/sys/freebsd/net/if_dl.d \ - core/sys/freebsd/netinet/in_.d core/sys/freebsd/pthread_np.d \ - core/sys/freebsd/stdlib.d core/sys/freebsd/string.d \ - core/sys/freebsd/sys/_bitset.d core/sys/freebsd/sys/_cpuset.d \ - core/sys/freebsd/sys/cdefs.d core/sys/freebsd/sys/elf.d \ - core/sys/freebsd/sys/elf32.d core/sys/freebsd/sys/elf64.d \ - core/sys/freebsd/sys/elf_common.d core/sys/freebsd/sys/event.d \ - core/sys/freebsd/sys/link_elf.d core/sys/freebsd/sys/mman.d \ - core/sys/freebsd/sys/mount.d core/sys/freebsd/sys/socket.d \ - core/sys/freebsd/sys/sysctl.d core/sys/freebsd/sys/types.d \ - core/sys/freebsd/time.d core/sys/freebsd/unistd.d + core/sys/freebsd/mqueue.d core/sys/freebsd/net/if_.d \ + core/sys/freebsd/net/if_dl.d core/sys/freebsd/netinet/in_.d \ + core/sys/freebsd/pthread_np.d core/sys/freebsd/stdlib.d \ + core/sys/freebsd/string.d core/sys/freebsd/sys/_bitset.d \ + core/sys/freebsd/sys/_cpuset.d core/sys/freebsd/sys/cdefs.d \ + core/sys/freebsd/sys/elf.d core/sys/freebsd/sys/elf32.d \ + core/sys/freebsd/sys/elf64.d core/sys/freebsd/sys/elf_common.d \ + core/sys/freebsd/sys/event.d core/sys/freebsd/sys/link_elf.d \ + core/sys/freebsd/sys/mman.d core/sys/freebsd/sys/mount.d \ + core/sys/freebsd/sys/socket.d core/sys/freebsd/sys/sysctl.d \ + core/sys/freebsd/sys/types.d core/sys/freebsd/time.d \ + core/sys/freebsd/unistd.d DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \ core/sys/linux/dlfcn.d core/sys/linux/elf.d core/sys/linux/epoll.d \ @@ -290,13 +291,13 @@ DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \ core/sys/linux/stdio.d core/sys/linux/string.d \ core/sys/linux/sys/auxv.d core/sys/linux/sys/eventfd.d \ core/sys/linux/sys/file.d core/sys/linux/sys/inotify.d \ - core/sys/linux/sys/mman.d core/sys/linux/sys/prctl.d \ - core/sys/linux/sys/procfs.d core/sys/linux/sys/signalfd.d \ - core/sys/linux/sys/socket.d core/sys/linux/sys/sysinfo.d \ - core/sys/linux/sys/time.d core/sys/linux/sys/xattr.d \ - core/sys/linux/termios.d core/sys/linux/time.d \ - core/sys/linux/timerfd.d core/sys/linux/tipc.d core/sys/linux/uinput.d \ - core/sys/linux/unistd.d + core/sys/linux/sys/mman.d core/sys/linux/sys/mount.d \ + core/sys/linux/sys/prctl.d core/sys/linux/sys/procfs.d \ + core/sys/linux/sys/signalfd.d core/sys/linux/sys/socket.d \ + core/sys/linux/sys/sysinfo.d core/sys/linux/sys/time.d \ + core/sys/linux/sys/xattr.d core/sys/linux/termios.d \ + core/sys/linux/time.d core/sys/linux/timerfd.d core/sys/linux/tipc.d \ + core/sys/linux/uinput.d core/sys/linux/unistd.d DRUNTIME_DSOURCES_NETBSD = core/sys/netbsd/dlfcn.d \ core/sys/netbsd/err.d core/sys/netbsd/execinfo.d \ diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in index 8f1202c..53c197e 100644 --- a/libphobos/libdruntime/Makefile.in +++ b/libphobos/libdruntime/Makefile.in @@ -329,10 +329,11 @@ am__objects_11 = core/sys/bionic/err.lo core/sys/bionic/fcntl.lo \ @DRUNTIME_OS_ANDROID_TRUE@am__objects_12 = $(am__objects_11) am__objects_13 = core/sys/freebsd/config.lo core/sys/freebsd/dlfcn.lo \ core/sys/freebsd/err.lo core/sys/freebsd/execinfo.lo \ - core/sys/freebsd/ifaddrs.lo core/sys/freebsd/net/if_.lo \ - core/sys/freebsd/net/if_dl.lo core/sys/freebsd/netinet/in_.lo \ - core/sys/freebsd/pthread_np.lo core/sys/freebsd/stdlib.lo \ - core/sys/freebsd/string.lo core/sys/freebsd/sys/_bitset.lo \ + core/sys/freebsd/ifaddrs.lo core/sys/freebsd/mqueue.lo \ + core/sys/freebsd/net/if_.lo core/sys/freebsd/net/if_dl.lo \ + core/sys/freebsd/netinet/in_.lo core/sys/freebsd/pthread_np.lo \ + core/sys/freebsd/stdlib.lo core/sys/freebsd/string.lo \ + core/sys/freebsd/sys/_bitset.lo \ core/sys/freebsd/sys/_cpuset.lo core/sys/freebsd/sys/cdefs.lo \ core/sys/freebsd/sys/elf.lo core/sys/freebsd/sys/elf32.lo \ core/sys/freebsd/sys/elf64.lo \ @@ -377,13 +378,14 @@ am__objects_19 = core/sys/linux/config.lo core/sys/linux/dlfcn.lo \ core/sys/linux/stdio.lo core/sys/linux/string.lo \ core/sys/linux/sys/auxv.lo core/sys/linux/sys/eventfd.lo \ core/sys/linux/sys/file.lo core/sys/linux/sys/inotify.lo \ - core/sys/linux/sys/mman.lo core/sys/linux/sys/prctl.lo \ - core/sys/linux/sys/procfs.lo core/sys/linux/sys/signalfd.lo \ - core/sys/linux/sys/socket.lo core/sys/linux/sys/sysinfo.lo \ - core/sys/linux/sys/time.lo core/sys/linux/sys/xattr.lo \ - core/sys/linux/termios.lo core/sys/linux/time.lo \ - core/sys/linux/timerfd.lo core/sys/linux/tipc.lo \ - core/sys/linux/uinput.lo core/sys/linux/unistd.lo + core/sys/linux/sys/mman.lo core/sys/linux/sys/mount.lo \ + core/sys/linux/sys/prctl.lo core/sys/linux/sys/procfs.lo \ + core/sys/linux/sys/signalfd.lo core/sys/linux/sys/socket.lo \ + core/sys/linux/sys/sysinfo.lo core/sys/linux/sys/time.lo \ + core/sys/linux/sys/xattr.lo core/sys/linux/termios.lo \ + core/sys/linux/time.lo core/sys/linux/timerfd.lo \ + core/sys/linux/tipc.lo core/sys/linux/uinput.lo \ + core/sys/linux/unistd.lo @DRUNTIME_OS_LINUX_TRUE@am__objects_20 = $(am__objects_19) am__objects_21 = core/sys/windows/accctrl.lo \ core/sys/windows/aclapi.lo core/sys/windows/aclui.lo \ @@ -943,17 +945,18 @@ DRUNTIME_DSOURCES_ELF = core/sys/elf/package.d DRUNTIME_DSOURCES_FREEBSD = core/sys/freebsd/config.d \ core/sys/freebsd/dlfcn.d core/sys/freebsd/err.d \ core/sys/freebsd/execinfo.d core/sys/freebsd/ifaddrs.d \ - core/sys/freebsd/net/if_.d core/sys/freebsd/net/if_dl.d \ - core/sys/freebsd/netinet/in_.d core/sys/freebsd/pthread_np.d \ - core/sys/freebsd/stdlib.d core/sys/freebsd/string.d \ - core/sys/freebsd/sys/_bitset.d core/sys/freebsd/sys/_cpuset.d \ - core/sys/freebsd/sys/cdefs.d core/sys/freebsd/sys/elf.d \ - core/sys/freebsd/sys/elf32.d core/sys/freebsd/sys/elf64.d \ - core/sys/freebsd/sys/elf_common.d core/sys/freebsd/sys/event.d \ - core/sys/freebsd/sys/link_elf.d core/sys/freebsd/sys/mman.d \ - core/sys/freebsd/sys/mount.d core/sys/freebsd/sys/socket.d \ - core/sys/freebsd/sys/sysctl.d core/sys/freebsd/sys/types.d \ - core/sys/freebsd/time.d core/sys/freebsd/unistd.d + core/sys/freebsd/mqueue.d core/sys/freebsd/net/if_.d \ + core/sys/freebsd/net/if_dl.d core/sys/freebsd/netinet/in_.d \ + core/sys/freebsd/pthread_np.d core/sys/freebsd/stdlib.d \ + core/sys/freebsd/string.d core/sys/freebsd/sys/_bitset.d \ + core/sys/freebsd/sys/_cpuset.d core/sys/freebsd/sys/cdefs.d \ + core/sys/freebsd/sys/elf.d core/sys/freebsd/sys/elf32.d \ + core/sys/freebsd/sys/elf64.d core/sys/freebsd/sys/elf_common.d \ + core/sys/freebsd/sys/event.d core/sys/freebsd/sys/link_elf.d \ + core/sys/freebsd/sys/mman.d core/sys/freebsd/sys/mount.d \ + core/sys/freebsd/sys/socket.d core/sys/freebsd/sys/sysctl.d \ + core/sys/freebsd/sys/types.d core/sys/freebsd/time.d \ + core/sys/freebsd/unistd.d DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \ core/sys/linux/dlfcn.d core/sys/linux/elf.d core/sys/linux/epoll.d \ @@ -967,13 +970,13 @@ DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \ core/sys/linux/stdio.d core/sys/linux/string.d \ core/sys/linux/sys/auxv.d core/sys/linux/sys/eventfd.d \ core/sys/linux/sys/file.d core/sys/linux/sys/inotify.d \ - core/sys/linux/sys/mman.d core/sys/linux/sys/prctl.d \ - core/sys/linux/sys/procfs.d core/sys/linux/sys/signalfd.d \ - core/sys/linux/sys/socket.d core/sys/linux/sys/sysinfo.d \ - core/sys/linux/sys/time.d core/sys/linux/sys/xattr.d \ - core/sys/linux/termios.d core/sys/linux/time.d \ - core/sys/linux/timerfd.d core/sys/linux/tipc.d core/sys/linux/uinput.d \ - core/sys/linux/unistd.d + core/sys/linux/sys/mman.d core/sys/linux/sys/mount.d \ + core/sys/linux/sys/prctl.d core/sys/linux/sys/procfs.d \ + core/sys/linux/sys/signalfd.d core/sys/linux/sys/socket.d \ + core/sys/linux/sys/sysinfo.d core/sys/linux/sys/time.d \ + core/sys/linux/sys/xattr.d core/sys/linux/termios.d \ + core/sys/linux/time.d core/sys/linux/timerfd.d core/sys/linux/tipc.d \ + core/sys/linux/uinput.d core/sys/linux/unistd.d DRUNTIME_DSOURCES_NETBSD = core/sys/netbsd/dlfcn.d \ core/sys/netbsd/err.d core/sys/netbsd/execinfo.d \ @@ -1610,6 +1613,7 @@ core/sys/freebsd/dlfcn.lo: core/sys/freebsd/$(am__dirstamp) core/sys/freebsd/err.lo: core/sys/freebsd/$(am__dirstamp) core/sys/freebsd/execinfo.lo: core/sys/freebsd/$(am__dirstamp) core/sys/freebsd/ifaddrs.lo: core/sys/freebsd/$(am__dirstamp) +core/sys/freebsd/mqueue.lo: core/sys/freebsd/$(am__dirstamp) core/sys/freebsd/net/$(am__dirstamp): @$(MKDIR_P) core/sys/freebsd/net @: > core/sys/freebsd/net/$(am__dirstamp) @@ -1732,6 +1736,7 @@ core/sys/linux/sys/eventfd.lo: core/sys/linux/sys/$(am__dirstamp) core/sys/linux/sys/file.lo: core/sys/linux/sys/$(am__dirstamp) core/sys/linux/sys/inotify.lo: core/sys/linux/sys/$(am__dirstamp) core/sys/linux/sys/mman.lo: core/sys/linux/sys/$(am__dirstamp) +core/sys/linux/sys/mount.lo: core/sys/linux/sys/$(am__dirstamp) core/sys/linux/sys/prctl.lo: core/sys/linux/sys/$(am__dirstamp) core/sys/linux/sys/procfs.lo: core/sys/linux/sys/$(am__dirstamp) core/sys/linux/sys/signalfd.lo: core/sys/linux/sys/$(am__dirstamp) diff --git a/libphobos/libdruntime/core/gc/gcinterface.d b/libphobos/libdruntime/core/gc/gcinterface.d index 5560c62..fa3d859 100644 --- a/libphobos/libdruntime/core/gc/gcinterface.d +++ b/libphobos/libdruntime/core/gc/gcinterface.d @@ -54,11 +54,6 @@ interface GC void collect() nothrow; /** - * - */ - void collectNoStack() nothrow; - - /** * minimize free space usage */ void minimize() nothrow; diff --git a/libphobos/libdruntime/core/internal/array/construction.d b/libphobos/libdruntime/core/internal/array/construction.d index 0950b5a..8f0323a 100644 --- a/libphobos/libdruntime/core/internal/array/construction.d +++ b/libphobos/libdruntime/core/internal/array/construction.d @@ -526,7 +526,7 @@ Tarr _d_newarraymTX(Tarr : U[], T, U)(size_t[] dims, bool isShared=false) @trust auto dim = dims[0]; - debug(PRINTF) printf("__allocateInnerArray(ti = %p, ti.next = %p, dim = %d, ndims = %d\n", ti, ti.next, dim, dims.length); + debug(PRINTF) printf("__allocateInnerArray(UnqT = %s, dim = %lu, ndims = %lu\n", UnqT.stringof.ptr, dim, dims.length); if (dims.length == 1) { auto r = _d_newarrayT!UnqT(dim, isShared); @@ -534,8 +534,9 @@ Tarr _d_newarraymTX(Tarr : U[], T, U)(size_t[] dims, bool isShared=false) @trust } auto allocSize = (void[]).sizeof * dim; - auto info = __arrayAlloc!UnqT(allocSize); - __setArrayAllocLength!UnqT(info, allocSize, isShared); + // the array-of-arrays holds pointers! Don't use UnqT here! + auto info = __arrayAlloc!(void[])(allocSize); + __setArrayAllocLength!(void[])(info, allocSize, isShared); auto p = __arrayStart(info)[0 .. dim]; foreach (i; 0..dim) @@ -579,6 +580,16 @@ unittest } } +// https://issues.dlang.org/show_bug.cgi?id=24436 +@system unittest +{ + import core.memory : GC; + + int[][] a = _d_newarraymTX!(int[][], int)([2, 2]); + + assert(!(GC.getAttr(a.ptr) & GC.BlkAttr.NO_SCAN)); +} + version (D_ProfileGC) { /** diff --git a/libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d b/libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d index cb8df47..b1b2707 100644 --- a/libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d +++ b/libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d @@ -1252,12 +1252,6 @@ class ConservativeGC : GC } - void collectNoStack() nothrow - { - fullCollectNoStack(); - } - - /** * Begins a full collection, scanning all stack segments for roots. * @@ -1291,21 +1285,6 @@ class ConservativeGC : GC /** - * Begins a full collection while ignoring all stack segments for roots. - */ - void fullCollectNoStack() nothrow - { - // Since a finalizer could launch a new thread, we always need to lock - // when collecting. - static size_t go(Gcx* gcx) nothrow - { - return gcx.fullcollect(true, true, true); // standard stop the world - } - runLocked!go(gcx); - } - - - /** * Minimize free space usage. */ void minimize() nothrow @@ -2556,14 +2535,11 @@ struct Gcx } // collection step 2: mark roots and heap - void markAll(alias markFn)(bool nostack) nothrow + void markAll(alias markFn)() nothrow { - if (!nostack) - { - debug(COLLECT_PRINTF) printf("\tscan stacks.\n"); - // Scan stacks and registers for each paused thread - thread_scanAll(&markFn); - } + debug(COLLECT_PRINTF) printf("\tscan stacks.\n"); + // Scan stacks registers, and TLS for each paused thread + thread_scanAll(&markFn); // Scan roots[] debug(COLLECT_PRINTF) printf("\tscan roots[]\n"); @@ -2584,14 +2560,11 @@ struct Gcx } version (COLLECT_PARALLEL) - void collectAllRoots(bool nostack) nothrow + void collectAllRoots() nothrow { - if (!nostack) - { - debug(COLLECT_PRINTF) printf("\tcollect stacks.\n"); - // Scan stacks and registers for each paused thread - thread_scanAll(&collectRoots); - } + debug(COLLECT_PRINTF) printf("\tcollect stacks.\n"); + // Scan stacks registers and TLS for each paused thread + thread_scanAll(&collectRoots); // Scan roots[] debug(COLLECT_PRINTF) printf("\tcollect roots[]\n"); @@ -2920,7 +2893,7 @@ struct Gcx } version (COLLECT_FORK) - ChildStatus markFork(bool nostack, bool block, bool doParallel) nothrow + ChildStatus markFork(bool block, bool doParallel) nothrow { // Forking is enabled, so we fork() and start a new concurrent mark phase // in the child. If the collection should not block, the parent process @@ -2936,11 +2909,11 @@ struct Gcx int child_mark() scope { if (doParallel) - markParallel(nostack); + markParallel(); else if (ConservativeGC.isPrecise) - markAll!(markPrecise!true)(nostack); + markAll!(markPrecise!true)(); else - markAll!(markConservative!true)(nostack); + markAll!(markConservative!true)(); return 0; } @@ -2999,11 +2972,11 @@ struct Gcx // do the marking in this thread disableFork(); if (doParallel) - markParallel(nostack); + markParallel(); else if (ConservativeGC.isPrecise) - markAll!(markPrecise!false)(nostack); + markAll!(markPrecise!false)(); else - markAll!(markConservative!false)(nostack); + markAll!(markConservative!false)(); } else { assert(r == ChildStatus.done); assert(r != ChildStatus.running); @@ -3016,7 +2989,7 @@ struct Gcx * Return number of full pages free'd. * The collection is done concurrently only if block and isFinal are false. */ - size_t fullcollect(bool nostack = false, bool block = false, bool isFinal = false) nothrow + size_t fullcollect(bool block = false, bool isFinal = false) nothrow { // It is possible that `fullcollect` will be called from a thread which // is not yet registered in runtime (because allocating `new Thread` is @@ -3098,7 +3071,7 @@ Lmark: { version (COLLECT_FORK) { - auto forkResult = markFork(nostack, block, doParallel); + auto forkResult = markFork(block, doParallel); final switch (forkResult) { case ChildStatus.error: @@ -3125,14 +3098,14 @@ Lmark: else if (doParallel) { version (COLLECT_PARALLEL) - markParallel(nostack); + markParallel(); } else { if (ConservativeGC.isPrecise) - markAll!(markPrecise!false)(nostack); + markAll!(markPrecise!false)(); else - markAll!(markConservative!false)(nostack); + markAll!(markConservative!false)(); } thread_processGCMarks(&isMarked); @@ -3184,7 +3157,7 @@ Lmark: updateCollectThresholds(); if (doFork && isFinal) - return fullcollect(true, true, false); + return fullcollect(true, false); return freedPages; } @@ -3300,10 +3273,10 @@ Lmark: shared uint stoppedThreads; bool stopGC; - void markParallel(bool nostack) nothrow + void markParallel() nothrow { toscanRoots.clear(); - collectAllRoots(nostack); + collectAllRoots(); if (toscanRoots.empty) return; diff --git a/libphobos/libdruntime/core/internal/gc/impl/manual/gc.d b/libphobos/libdruntime/core/internal/gc/impl/manual/gc.d index b820add..36add7a 100644 --- a/libphobos/libdruntime/core/internal/gc/impl/manual/gc.d +++ b/libphobos/libdruntime/core/internal/gc/impl/manual/gc.d @@ -79,10 +79,6 @@ class ManualGC : GC { } - void collectNoStack() nothrow - { - } - void minimize() nothrow { } diff --git a/libphobos/libdruntime/core/internal/gc/impl/proto/gc.d b/libphobos/libdruntime/core/internal/gc/impl/proto/gc.d index 2286d17..dbe8600 100644 --- a/libphobos/libdruntime/core/internal/gc/impl/proto/gc.d +++ b/libphobos/libdruntime/core/internal/gc/impl/proto/gc.d @@ -76,10 +76,6 @@ class ProtoGC : GC { } - void collectNoStack() nothrow - { - } - void minimize() nothrow { } diff --git a/libphobos/libdruntime/core/internal/gc/pooltable.d b/libphobos/libdruntime/core/internal/gc/pooltable.d index 0966338..f9ec3d2 100644 --- a/libphobos/libdruntime/core/internal/gc/pooltable.d +++ b/libphobos/libdruntime/core/internal/gc/pooltable.d @@ -181,9 +181,10 @@ package: unittest { + import core.internal.gc.impl.conservative.gc : PAGESIZE; + enum NPOOLS = 6; enum NPAGES = 10; - enum PAGESIZE = 4096; static struct MockPool { diff --git a/libphobos/libdruntime/core/internal/gc/proxy.d b/libphobos/libdruntime/core/internal/gc/proxy.d index abc8c6a..c7dab71 100644 --- a/libphobos/libdruntime/core/internal/gc/proxy.d +++ b/libphobos/libdruntime/core/internal/gc/proxy.d @@ -106,18 +106,7 @@ extern (C) case "none": break; case "collect": - // NOTE: There may be daemons threads still running when this routine is - // called. If so, cleaning memory out from under then is a good - // way to make them crash horribly. This probably doesn't matter - // much since the app is supposed to be shutting down anyway, but - // I'm disabling cleanup for now until I can think about it some - // more. - // - // NOTE: Due to popular demand, this has been re-enabled. It still has - // the problems mentioned above though, so I guess we'll see. - - instance.collectNoStack(); // not really a 'collect all' -- still scans - // static data area, roots, and ranges. + instance.collect(); break; case "finalize": instance.runFinalizers((cast(ubyte*)null)[0 .. size_t.max]); diff --git a/libphobos/libdruntime/core/internal/hash.d b/libphobos/libdruntime/core/internal/hash.d index ef9f1e5..80fdc32 100644 --- a/libphobos/libdruntime/core/internal/hash.d +++ b/libphobos/libdruntime/core/internal/hash.d @@ -36,7 +36,7 @@ private enum hasCallableToHash(T) = __traits(compiles, @nogc nothrow pure @safe unittest { - static struct S { size_t toHash() { return 4; } } + static struct S { size_t toHash() const { return 4; } } assert(hasCallableToHash!S); assert(!hasCallableToHash!(shared const S)); } diff --git a/libphobos/libdruntime/core/internal/qsort.d b/libphobos/libdruntime/core/internal/qsort.d index ada914c..0040f6b 100644 --- a/libphobos/libdruntime/core/internal/qsort.d +++ b/libphobos/libdruntime/core/internal/qsort.d @@ -56,17 +56,49 @@ static if (Glibc_Qsort_R) } else version (FreeBSD) { - alias extern (C) int function(scope void *, scope const void *, scope const void *) Cmp; - extern (C) void qsort_r(scope void *base, size_t nmemb, size_t size, scope void *thunk, Cmp cmp); + import core.sys.freebsd.config : __FreeBSD_version; - extern (C) void[] _adSort(return scope void[] a, TypeInfo ti) + static if (__FreeBSD_version >= 1400000) { - extern (C) int cmp(scope void* ti, scope const void* p1, scope const void* p2) + alias extern (C) int function(scope const void*, scope const void*, scope void*) Cmp; + extern (C) void qsort_r(scope void* base, size_t nmemb, size_t size, Cmp cmp, scope void* thunk); + + // https://cgit.freebsd.org/src/tree/include/stdlib.h?h=stable/14#n350 + pragma(mangle, "qsort_r@FBSD_1.0") + private extern (C) void __qsort_r_compat(scope void* base, size_t nmemb, size_t size, scope void* thunk, OldCmp cmp); + alias extern (C) int function(scope void*, scope const void*, scope const void*) OldCmp; + + deprecated("In FreeBSD 14, qsort_r's signature was fixed to match POSIX. This extern(D) overload has been " ~ + "provided to avoid breaking code, but code should be updated to use the POSIX version.") + extern (D) void qsort_r(scope void* base, size_t nmemb, size_t size, scope void* thunk, OldCmp cmp) { - return (cast(TypeInfo)ti).compare(p1, p2); + __qsort_r_compat(base, nmemb, size, thunk, cmp); + } + + extern (C) void[] _adSort(return scope void[] a, TypeInfo ti) + { + extern (C) int cmp(scope const void* p1, scope const void* p2, scope void* ti) + { + return (cast(TypeInfo)ti).compare(p1, p2); + } + qsort_r(a.ptr, a.length, ti.tsize, &cmp, cast(void*)ti); + return a; + } + } + else + { + alias extern (C) int function(scope void *, scope const void *, scope const void *) Cmp; + extern (C) void qsort_r(scope void* base, size_t nmemb, size_t size, scope void* thunk, Cmp cmp); + + extern (C) void[] _adSort(return scope void[] a, TypeInfo ti) + { + extern (C) int cmp(scope void* ti, scope const void* p1, scope const void* p2) + { + return (cast(TypeInfo)ti).compare(p1, p2); + } + qsort_r(a.ptr, a.length, ti.tsize, cast(void*)ti, &cmp); + return a; } - qsort_r(a.ptr, a.length, ti.tsize, cast(void*)ti, &cmp); - return a; } } else version (DragonFlyBSD) diff --git a/libphobos/libdruntime/core/memory.d b/libphobos/libdruntime/core/memory.d index 239d23f..001c315 100644 --- a/libphobos/libdruntime/core/memory.d +++ b/libphobos/libdruntime/core/memory.d @@ -322,7 +322,7 @@ extern(D): This can be used to manually allocate arrays. Initial slice size is 0. Note: The slice's usable size will not match the block size. Use - $(LREF capacity) to retrieve actual usable capacity. + $(REF1 capacity, object) to retrieve actual usable capacity. Example: ---- @@ -611,7 +611,7 @@ extern(C): * Note: * Extend may also be used to extend slices (or memory blocks with * $(LREF APPENDABLE) info). However, use the return value only - * as an indicator of success. $(LREF capacity) should be used to + * as an indicator of success. $(REF1 capacity, object) should be used to * retrieve actual usable slice capacity. */ version (D_ProfileGC) @@ -1197,13 +1197,13 @@ $(UL ) Note: Users should prefer $(REF1 destroy, object) to explicitly finalize objects, -and only resort to $(REF __delete, core,memory) when $(REF destroy, object) +and only resort to $(LREF __delete) when $(REF1 destroy, object) wouldn't be a feasible option. Params: x = aggregate object that should be destroyed -See_Also: $(REF1 destroy, object), $(REF free, core,GC) +See_Also: $(REF1 destroy, object), $(LREF GC.free) History: diff --git a/libphobos/libdruntime/core/runtime.d b/libphobos/libdruntime/core/runtime.d index 19bb61b..4ff728c 100644 --- a/libphobos/libdruntime/core/runtime.d +++ b/libphobos/libdruntime/core/runtime.d @@ -101,15 +101,15 @@ struct UnitTestResult } /// Legacy module unit test handler -alias bool function() ModuleUnitTester; +alias ModuleUnitTester = bool function(); /// Module unit test handler -alias UnitTestResult function() ExtendedModuleUnitTester; +alias ExtendedModuleUnitTester = UnitTestResult function(); private { - alias bool function(Object) CollectHandler; - alias Throwable.TraceInfo function( void* ptr ) TraceHandler; + alias CollectHandler = bool function(Object); + alias TraceHandler = Throwable.TraceInfo function(void* ptr); - alias void delegate( Throwable ) ExceptionHandler; + alias ExceptionHandler = void delegate(Throwable); extern (C) void _d_print_throwable(Throwable t); extern (C) void* thread_stackBottom() nothrow @nogc; diff --git a/libphobos/libdruntime/core/stdc/limits.d b/libphobos/libdruntime/core/stdc/limits.d index f3f8800..2684b22 100644 --- a/libphobos/libdruntime/core/stdc/limits.d +++ b/libphobos/libdruntime/core/stdc/limits.d @@ -90,8 +90,7 @@ version (Darwin) /// enum PIPE_BUF = 512; } - -version (DragonFlyBSD) +else version (DragonFlyBSD) { /// enum MAX_CANON = 255; @@ -182,3 +181,5 @@ else version (Windows) /// enum PIPE_BUF = 5120; } +else + static assert(0, "unsupported OS"); diff --git a/libphobos/libdruntime/core/stdcpp/new_.d b/libphobos/libdruntime/core/stdcpp/new_.d index de9e10a..5f80b28 100644 --- a/libphobos/libdruntime/core/stdcpp/new_.d +++ b/libphobos/libdruntime/core/stdcpp/new_.d @@ -33,7 +33,7 @@ extern (C++, "std") { @nogc: /// - this() { super("bad allocation", 1); } + extern(D) this() { super("bad allocation", 1); } } } diff --git a/libphobos/libdruntime/core/sys/freebsd/mqueue.d b/libphobos/libdruntime/core/sys/freebsd/mqueue.d new file mode 100644 index 0000000..448ead7 --- /dev/null +++ b/libphobos/libdruntime/core/sys/freebsd/mqueue.d @@ -0,0 +1,19 @@ +//Written in the D programming language + +/++ + D header file for FreeBSD's ifaddrs.h. + + Copyright: Copyright 2024 + License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0). + Authors: $(HTTP jmdavisprog.com, Jonathan M Davis) + +/ +module core.sys.freebsd.mqueue; + +public import core.sys.posix.mqueue; + +version (FreeBSD): +extern(C): +@nogc: +nothrow: + +int mq_getfd_np(mqd_t mqd); diff --git a/libphobos/libdruntime/core/sys/linux/sys/mount.d b/libphobos/libdruntime/core/sys/linux/sys/mount.d new file mode 100644 index 0000000..8b8511a --- /dev/null +++ b/libphobos/libdruntime/core/sys/linux/sys/mount.d @@ -0,0 +1,63 @@ +/** + * D header file for Linux. + */ +module core.sys.linux.sys.mount; + +version (linux): + +public import core.sys.linux.fs : + BLKROSET, BLKROGET, BLKRRPART, BLKGETSIZE, BLKFLSBUF, BLKRASET, BLKRAGET, + BLKFRASET, BLKFRAGET, BLKSECTSET, BLKSECTGET, BLKSSZGET, BLKBSZGET, + BLKBSZSET, BLKGETSIZE64; + +import core.stdc.config : c_ulong; + +extern (C): +nothrow: +@nogc: + +enum c_ulong MS_RDONLY = 1; +enum c_ulong MS_NOSUID = 2; +enum c_ulong MS_NODEV = 4; +enum c_ulong MS_NOEXEC = 8; +enum c_ulong MS_SYNCHRONOUS = 16; +enum c_ulong MS_REMOUNT = 32; +enum c_ulong MS_MANDLOCK = 64; +enum c_ulong MS_DIRSYNC = 128; +enum c_ulong MS_NOSYMFOLLOW = 256; +enum c_ulong MS_NOATIME = 1024; +enum c_ulong MS_NODIRATIME = 2048; +enum c_ulong MS_BIND = 4096; +enum c_ulong MS_MOVE = 8192; +enum c_ulong MS_REC = 16384; +enum c_ulong MS_SILENT = 32768; +enum c_ulong MS_POSIXACL = 1 << 16; +enum c_ulong MS_UNBINDABLE = 1 << 17; +enum c_ulong MS_PRIVATE = 1 << 18; +enum c_ulong MS_SLAVE = 1 << 19; +enum c_ulong MS_SHARED = 1 << 20; +enum c_ulong MS_RELATIME = 1 << 21; +enum c_ulong MS_KERNMOUNT = 1 << 22; +enum c_ulong MS_I_VERSION = 1 << 23; +enum c_ulong MS_STRICTATIME = 1 << 24; +enum c_ulong MS_LAZYTIME = 1 << 25; +enum c_ulong MS_NOREMOTELOCK = 1 << 27; +enum c_ulong MS_NOSEC = 1 << 28; +enum c_ulong MS_BORN = 1 << 29; +enum c_ulong MS_ACTIVE = 1 << 30; +enum c_ulong MS_NOUSER = 1 << 31; + +enum MS_RMT_MASK = + MS_RDONLY | MS_SYNCHRONOUS | MS_MANDLOCK | MS_I_VERSION | MS_LAZYTIME; + +enum MS_MGC_VAL = 0xC0ED0000; +enum MS_MGC_MSK = 0xFFFF0000; + +enum MNT_FORCE = 1; +enum MNT_DETACH = 2; +enum MNT_EXPIRE = 4; +enum UMOUNT_NOFOLLOW = 8; + +int mount(const(char)*, const(char)*, const(char)*, c_ulong, const(void)*); +int umount(const(char)*); +int umount2(const(char)*, int); diff --git a/libphobos/libdruntime/core/sys/posix/config.d b/libphobos/libdruntime/core/sys/posix/config.d index ae6752f2..6b80d1f 100644 --- a/libphobos/libdruntime/core/sys/posix/config.d +++ b/libphobos/libdruntime/core/sys/posix/config.d @@ -88,7 +88,7 @@ else version (CRuntime_Musl) enum __REDIRECT = false; // Those three are irrelevant for Musl as it always uses 64 bits off_t - enum __USE_FILE_OFFSET64 = _FILE_OFFSET_BITS == 64; + enum __USE_FILE_OFFSET64 = false; enum __USE_LARGEFILE = __USE_FILE_OFFSET64 && !__REDIRECT; enum __USE_LARGEFILE64 = __USE_FILE_OFFSET64 && !__REDIRECT; diff --git a/libphobos/libdruntime/core/sys/posix/mqueue.d b/libphobos/libdruntime/core/sys/posix/mqueue.d index eae50d2..f8b4b15 100644 --- a/libphobos/libdruntime/core/sys/posix/mqueue.d +++ b/libphobos/libdruntime/core/sys/posix/mqueue.d @@ -28,195 +28,231 @@ import core.sys.posix.signal; import core.sys.posix.time; version (Posix): -version (CRuntime_Glibc): extern (C): @nogc nothrow: +version (CRuntime_Glibc) +{ + /// Message queue descriptor. + alias int mqd_t; -/// Message queue descriptor. -alias int mqd_t; + /** + * Used in getting and setting the attributes of a message queue. + */ + struct mq_attr + { + /// Message queue flags. + c_long mq_flags; + /// Maximum number of messages. + c_long mq_maxmsg; + /// Maximum message size. + c_long mq_msgsize; + /// Number of messages currently queued. + c_long mq_curmsgs; + } -/** - * Used in getting and setting the attributes of a message queue. - */ -struct mq_attr -{ - /// Message queue flags. - c_long mq_flags; - /// Maximum number of messages. - c_long mq_maxmsg; - /// Maximum message size. - c_long mq_msgsize; - /// Number of messages currently queued. - c_long mq_curmsgs; -} + /** + * Establish connection between a process and a message queue `name`. + * + * Note: + * Linux prototypes are: + * mqd_t mq_open (const(char)* name, int oflag); + * mqd_t mq_open (const(char)* name, int oflag, mode_t mode, mq_attr* attr); + * + * Params: + * name = Name of the message queue to open. + * oflag = determines the type of access used. + * If `O_CREAT` is on `oflag`, the third argument is taken as a + * `mode_t`, the mode of the created message queue. + * If `O_CREAT` is on `oflag`, the fourth argument is taken as + * a pointer to a `mq_attr' (message queue attributes). + * If the fourth argument is `null`, default attributes are used. + * ... = varargs matching the function prototypes + * + * Returns: + * Message queue descriptor or (mqd_t) -1 on error. + */ + mqd_t mq_open(const(char)* name, int oflag, ...); -/** - * Establish connection between a process and a message queue `name`. - * - * Note: - * Linux prototypes are: - * mqd_t mq_open (const(char)* name, int oflag); - * mqd_t mq_open (const(char)* name, int oflag, mode_t mode, mq_attr* attr); - * - * Params: - * name = Name of the message queue to open. - * oflag = determines the type of access used. - * If `O_CREAT` is on `oflag`, the third argument is taken as a - * `mode_t`, the mode of the created message queue. - * If `O_CREAT` is on `oflag`, the fourth argument is taken as - * a pointer to a `mq_attr' (message queue attributes). - * If the fourth argument is `null`, default attributes are used. - * ... = varargs matching the function prototypes - * - * Returns: - * Message queue descriptor or (mqd_t) -1 on error. - */ -mqd_t mq_open(const(char)* name, int oflag, ...); + /** + * Closes the message queue descriptor mqdes. + * + * Params: + * mqdes = Message queue descriptor to close. + * + * Returns: + * On success mq_close() returns 0; on error, -1 is returned, with errno + * set to indicate the error. + */ + int mq_close (mqd_t mqdes); -/** - * Closes the message queue descriptor mqdes. - * - * Params: - * mqdes = Message queue descriptor to close. - * - * Returns: - * On success mq_close() returns 0; on error, -1 is returned, with errno - * set to indicate the error. - */ -int mq_close (mqd_t mqdes); + /** + * Query status and attributes of message queue `mqdes`. + * + * Params: + * mqdes = Message queue descriptor. + * mqstat = Buffer to fill with the message queue's attributes. + * + * Returns: + * On success mq_getattr() return 0; on error, -1 is returned, with errno + * set to indicate the error. + */ + int mq_getattr (mqd_t mqdes, mq_attr* mqstat); -/** - * Query status and attributes of message queue `mqdes`. - * - * Params: - * mqdes = Message queue descriptor. - * mqstat = Buffer to fill with the message queue's attributes. - * - * Returns: - * On success mq_getattr() return 0; on error, -1 is returned, with errno - * set to indicate the error. - */ -int mq_getattr (mqd_t mqdes, mq_attr* mqstat); + /* + * Set attributes associated with message queue `mqdes` + * + * Params: + * mqdes = Message queue descriptor. + * newstat = non-null pointer to fill with attributes for `mqdes`. + * oldstat = if not `null` it is filled with the old attributes. + * + * Returns: + * On success mq_setattr() return 0; on error, -1 is returned, with errno + * set to indicate the error. + */ + int mq_setattr (mqd_t mqdes, const(mq_attr)* newstat, mq_attr* oldstat); -/* - * Set attributes associated with message queue `mqdes` - * - * Params: - * mqdes = Message queue descriptor. - * newstat = non-null pointer to fill with attributes for `mqdes`. - * oldstat = if not `null` it is filled with the old attributes. - * - * Returns: - * On success mq_setattr() return 0; on error, -1 is returned, with errno - * set to indicate the error. - */ -int mq_setattr (mqd_t mqdes, const(mq_attr)* newstat, mq_attr* oldstat); + /** + * Remove the specified message queue `name`. + * + * Params: + * name = Name of the queue to remove. + * + * Returns: + * On success mq_unlink() returns 0; on error, -1 is returned, with errno + * set to indicate the error. + */ + int mq_unlink (const(char)* name); -/** - * Remove the specified message queue `name`. - * - * Params: - * name = Name of the queue to remove. - * - * Returns: - * On success mq_unlink() returns 0; on error, -1 is returned, with errno - * set to indicate the error. - */ -int mq_unlink (const(char)* name); + /** + * Register for notification when a message is available + * + * Params: + * mqdes = Message queue descriptor. + * notification = See `man 3 mq_notify` for details. + * + * Returns: + * On success mq_notify() returns 0; on error, -1 is returned, with errno + * set to indicate the error. + */ + int mq_notify (mqd_t mqdes, const(sigevent)* notification); -/** - * Register for notification when a message is available - * - * Params: - * mqdes = Message queue descriptor. - * notification = See `man 3 mq_notify` for details. - * - * Returns: - * On success mq_notify() returns 0; on error, -1 is returned, with errno - * set to indicate the error. - */ -int mq_notify (mqd_t mqdes, const(sigevent)* notification); + /** + * Receive the oldest message with the highest priority the message queue + * + * Params: + * mqdes = Message queue descriptor. + * msg_ptr = Buffer to write the message to + * msg_len = Size of the buffer provided as `msg_ptr`. Must be greater + * than the mq_msgsize attribute of the queue. + * msg_prio = If not `null`, set to the priority of this message. + * + * Returns: + * On success, mq_receive() returns the number of bytes in the received + * message; on error, -1 is returned, with errno set to indicate the error + */ + ssize_t mq_receive (mqd_t mqdes, char* msg_ptr, size_t msg_len, uint* msg_prio); -/** - * Receive the oldest message with the highest priority the message queue - * - * Params: - * mqdes = Message queue descriptor. - * msg_ptr = Buffer to write the message to - * msg_len = Size of the buffer provided as `msg_ptr`. Must be greater - * than the mq_msgsize attribute of the queue. - * msg_prio = If not `null`, set to the priority of this message. - * - * Returns: - * On success, mq_receive() returns the number of bytes in the received - * message; on error, -1 is returned, with errno set to indicate the error - */ -ssize_t mq_receive (mqd_t mqdes, char* msg_ptr, size_t msg_len, uint* msg_prio); + /** + * Receive the oldest message with the highest priority the message queue, + * wait up to a certain timeout. + * + * Params: + * mqdes = Message queue descriptor. + * msg_ptr = Buffer to write the message to + * msg_len = Size of the buffer provided as `msg_ptr`. Must be greater + * than the mq_msgsize attribute of the queue. + * msg_prio = If not `null`, set to the priority of this message. + * abs_timeout = Specify a ceiling on the time to block if the queue is empty. + * + * Returns: + * On success, mq_receive() returns the number of bytes in the received + * message; on error, -1 is returned, with errno set to indicate the error + */ + pragma(mangle, muslRedirTime64Mangle!("mq_timedreceive", "__mq_timedreceive_time64")) + ssize_t mq_timedreceive (mqd_t mqdes, char* msg_ptr, size_t msg_len, + uint* msg_prio, const(timespec)* abs_timeout); -/** - * Receive the oldest message with the highest priority the message queue, - * wait up to a certain timeout. - * - * Params: - * mqdes = Message queue descriptor. - * msg_ptr = Buffer to write the message to - * msg_len = Size of the buffer provided as `msg_ptr`. Must be greater - * than the mq_msgsize attribute of the queue. - * msg_prio = If not `null`, set to the priority of this message. - * abs_timeout = Specify a ceiling on the time to block if the queue is empty. - * - * Returns: - * On success, mq_receive() returns the number of bytes in the received - * message; on error, -1 is returned, with errno set to indicate the error - */ -pragma(mangle, muslRedirTime64Mangle!("mq_timedreceive", "__mq_timedreceive_time64")) -ssize_t mq_timedreceive (mqd_t mqdes, char* msg_ptr, size_t msg_len, - uint* msg_prio, const(timespec)* abs_timeout); + /** + * Add a message to a message queue. + * + * Params: + * mqdes = Message queue descriptor. + * msg_ptr = Buffer to read the message from + * msg_len = Size of the message provided via `msg_ptr`. Must be lower + * or equal to the mq_msgsize attribute of the queue. + * msg_prio = Priority of this message. + * + * Returns: + * On success, mq_send() return zero; on error, -1 is returned, with errno + * set to indicate the error. + */ + int mq_send (mqd_t mqdes, const(char)* msg_ptr, size_t msg_len, uint msg_prio); -/** - * Add a message to a message queue. - * - * Params: - * mqdes = Message queue descriptor. - * msg_ptr = Buffer to read the message from - * msg_len = Size of the message provided via `msg_ptr`. Must be lower - * or equal to the mq_msgsize attribute of the queue. - * msg_prio = Priority of this message. - * - * Returns: - * On success, mq_send() return zero; on error, -1 is returned, with errno - * set to indicate the error. - */ -int mq_send (mqd_t mqdes, const(char)* msg_ptr, size_t msg_len, uint msg_prio); + /** + * Add a message to a message queue, block up to a certain time if the queue + * is full. + * + * Params: + * mqdes = Message queue descriptor. + * msg_ptr = Buffer to read the message from + * msg_len = Size of the message provided via `msg_ptr`. Must be lower + * or equal to the mq_msgsize attribute of the queue. + * msg_prio = Priority of this message. + * abs_timeout = Specify a ceiling on the time to block if the queue is empty. + * + * Returns: + * On success, mq_timedsend() return zero; on error, -1 is returned, + * with errno set to indicate the error. + * + */ + pragma(mangle, muslRedirTime64Mangle!("mq_timedsend", "__mq_timedsend_time64")) + int mq_timedsend (mqd_t mqdes, const(char)* msg_ptr, size_t msg_len, + uint msg_prio, const(timespec)* abs_timeout); +} +else version (FreeBSD) +{ + private struct __mq; -/** - * Add a message to a message queue, block up to a certain time if the queue - * is full. - * - * Params: - * mqdes = Message queue descriptor. - * msg_ptr = Buffer to read the message from - * msg_len = Size of the message provided via `msg_ptr`. Must be lower - * or equal to the mq_msgsize attribute of the queue. - * msg_prio = Priority of this message. - * abs_timeout = Specify a ceiling on the time to block if the queue is empty. - * - * Returns: - * On success, mq_timedsend() return zero; on error, -1 is returned, - * with errno set to indicate the error. - * - */ -pragma(mangle, muslRedirTime64Mangle!("mq_timedsend", "__mq_timedsend_time64")) -int mq_timedsend (mqd_t mqdes, const(char)* msg_ptr, size_t msg_len, - uint msg_prio, const(timespec)* abs_timeout); + alias mqd_t = __mq*; + + struct mq_attr + { + c_long mq_flags; + c_long mq_maxmsg; + c_long mq_msgsize; + c_long mq_curmsgs; + c_long[4] __reserved; + } + + int mq_close(mqd_t); + + int mq_getattr(mqd_t, mq_attr*); + + int mq_notify(mqd_t, const sigevent*); + + mqd_t mq_open(const char*, int, ...); + + ssize_t mq_receive(mqd_t, char*, size_t, uint*); + + int mq_send(mqd_t, const char*, size_t, uint); + + int mq_setattr(mqd_t, const mq_attr*, mq_attr*); + + ssize_t mq_timedreceive(mqd_t, char*, size_t, uint*, const timespec*); + + int mq_timedsend(mqd_t, const char*, size_t, uint, const timespec*); + + int mq_unlink(const char*); +} diff --git a/libphobos/libdruntime/core/sys/solaris/sys/priocntl.d b/libphobos/libdruntime/core/sys/solaris/sys/priocntl.d index c56be3b..87e3e47 100644 --- a/libphobos/libdruntime/core/sys/solaris/sys/priocntl.d +++ b/libphobos/libdruntime/core/sys/solaris/sys/priocntl.d @@ -2,7 +2,7 @@ * D header file for the Solaris priocntl(2) and priocntlset(2) functions. * * Copyright: Copyright 2014 Jason King. - * License: $(HTTP www.boost.org/LICENSE_1.0.txt, Boost License 1.0). + * License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0). * Authors: Jason King */ diff --git a/libphobos/libdruntime/core/sys/solaris/sys/procset.d b/libphobos/libdruntime/core/sys/solaris/sys/procset.d index 8bd9115..9266aee 100644 --- a/libphobos/libdruntime/core/sys/solaris/sys/procset.d +++ b/libphobos/libdruntime/core/sys/solaris/sys/procset.d @@ -2,7 +2,7 @@ * D header file defining a process set. * * Copyright: Copyright 2014 Jason King. - * License: $(HTTP www.boost.org/LICENSE_1.0.txt, Boost License 1.0). + * License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0). * Authors: Jason King */ diff --git a/libphobos/libdruntime/core/sys/solaris/sys/types.d b/libphobos/libdruntime/core/sys/solaris/sys/types.d index 4b30a68..5855876 100644 --- a/libphobos/libdruntime/core/sys/solaris/sys/types.d +++ b/libphobos/libdruntime/core/sys/solaris/sys/types.d @@ -2,7 +2,7 @@ * D header file that defines Solaris-specific types. * * Copyright: Copyright 2014 Jason King. - * License: $(HTTP www.boost.org/LICENSE_1.0.txt, Boost License 1.0). + * License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0). * Authors: Jason King */ diff --git a/libphobos/libdruntime/core/thread/fiber.d b/libphobos/libdruntime/core/thread/fiber.d index 48b6f9e..e02733b 100644 --- a/libphobos/libdruntime/core/thread/fiber.d +++ b/libphobos/libdruntime/core/thread/fiber.d @@ -150,6 +150,14 @@ private version = AsmExternal; } } + else version (MIPS_N64) + { + version (Posix) + { + version = AsmMIPS_N64_Posix; + version = AsmExternal; + } + } else version (AArch64) { version (Posix) @@ -1437,6 +1445,44 @@ private: pstack -= ABOVE; *cast(size_t*)(pstack - SZ_RA) = cast(size_t)&fiber_entryPoint; } + else version (AsmMIPS_N64_Posix) + { + version (StackGrowsDown) {} + else static assert(0); + + /* We keep the FP registers and the return address below + * the stack pointer, so they don't get scanned by the + * GC. The last frame before swapping the stack pointer is + * organized like the following. + * + * |-----------|<= frame pointer + * | $fp/$gp | + * | $s0-7 | + * |-----------|<= stack pointer + * | $ra | + * | $f24-31 | + * |-----------| + * + */ + enum SZ_GP = 10 * size_t.sizeof; // $fp + $gp + $s0-7 + enum SZ_RA = size_t.sizeof; // $ra + version (MIPS_HardFloat) + { + enum SZ_FP = 8 * double.sizeof; // $f24-31 + } + else + { + enum SZ_FP = 0; + } + + enum BELOW = SZ_FP + SZ_RA; + enum ABOVE = SZ_GP; + enum SZ = BELOW + ABOVE; + + (cast(ubyte*)pstack - SZ)[0 .. SZ] = 0; + pstack -= ABOVE; + *cast(size_t*)(pstack - SZ_RA) = cast(size_t)&fiber_entryPoint; + } else version (AsmLoongArch64_Posix) { // Like others, FP registers and return address ($r1) are kept diff --git a/libphobos/libdruntime/core/thread/osthread.d b/libphobos/libdruntime/core/thread/osthread.d index a9fcf96..0bdb45a 100644 --- a/libphobos/libdruntime/core/thread/osthread.d +++ b/libphobos/libdruntime/core/thread/osthread.d @@ -977,7 +977,7 @@ class Thread : ThreadBase * * ------------------------------------------------------------------------ */ - static void sleep( Duration val ) @nogc nothrow + static void sleep( Duration val ) @nogc nothrow @trusted in { assert( !val.isNegative ); @@ -1242,6 +1242,12 @@ unittest thread_resumeAll(); } +@nogc @safe nothrow +unittest +{ + Thread.sleep(1.msecs); +} + /////////////////////////////////////////////////////////////////////////////// // GC Support Routines /////////////////////////////////////////////////////////////////////////////// diff --git a/libphobos/libdruntime/object.d b/libphobos/libdruntime/object.d index 4264ecf..9bc929c 100644 --- a/libphobos/libdruntime/object.d +++ b/libphobos/libdruntime/object.d @@ -3614,7 +3614,7 @@ if (is(typeof(create()) : V) && (is(typeof(update(aa[K.init])) : V) || is(typeof @safe const: // stubs bool opEquals(S rhs) { assert(0); } - size_t toHash() { assert(0); } + size_t toHash() const { assert(0); } } int[string] aai; diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE index 79cd181..b71e3dd 100644 --- a/libphobos/src/MERGE +++ b/libphobos/src/MERGE @@ -1,4 +1,4 @@ -8729740e3221cd6dcccdbbbb12b452d0ee9c1ee1 +303b9c9f7c6457a4f31e7444d5ff0315ba97c704 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 465723c..2d89dea 100644 --- a/libphobos/src/std/algorithm/searching.d +++ b/libphobos/src/std/algorithm/searching.d @@ -22,8 +22,9 @@ $(T2 boyerMooreFinder, $(T2 canFind, `canFind("hello world", "or")` returns `true`.) $(T2 count, - Counts elements that are equal to a specified value or satisfy a - predicate. `count([1, 2, 1], 1)` returns `2` and + Counts all elements or elements matching a predicate, specific element or sub-range.$(BR) + `count([1, 2, 1])` returns `3`, + `count([1, 2, 1], 1)` returns `2` and `count!"a < 0"([1, -3, 0])` returns `1`.) $(T2 countUntil, `countUntil(a, b)` returns the number of steps taken in `a` to @@ -605,34 +606,29 @@ if (isNarrowString!R1 && isNarrowString!R2) // count /** -The first version counts the number of elements `x` in `r` for -which `pred(x, value)` is `true`. `pred` defaults to +Counts matches of `needle` in `haystack`. + +The first overload counts each element `e` in `haystack` for +which `pred(e, needle)` is `true`. `pred` defaults to equality. Performs $(BIGOH haystack.length) evaluations of `pred`. -The second version returns the number of times `needle` occurs in -`haystack`. Throws an exception if `needle.empty`, as the _count +The second overload counts the number of times `needle` was matched in +`haystack`. `pred` compares elements in each range. +Throws an exception if `needle.empty` is `true`, as the _count of the empty range in any range would be infinite. Overlapped counts -are not considered, for example `count("aaa", "aa")` is `1`, not +are *not* considered, for example `count("aaa", "aa")` is `1`, not `2`. -The third version counts the elements for which `pred(x)` is $(D -true). Performs $(BIGOH haystack.length) evaluations of `pred`. - -The fourth version counts the number of elements in a range. It is -an optimization for the third version: if the given range has the -`length` property the count is returned right away, otherwise -performs $(BIGOH haystack.length) to walk the range. - Note: Regardless of the overload, `count` will not accept infinite ranges for `haystack`. Params: - pred = The predicate to evaluate. + pred = The predicate to compare elements. haystack = The range to _count. - needle = The element or sub-range to _count in the `haystack`. + needle = The element or sub-range to _count in `haystack`. Returns: - The number of positions in the `haystack` for which `pred` returned true. + The number of matches in `haystack`. */ size_t count(alias pred = "a == b", Range, E)(Range haystack, E needle) if (isInputRange!Range && !isInfinite!Range && @@ -645,21 +641,22 @@ if (isInputRange!Range && !isInfinite!Range && /// @safe unittest { - import std.uni : toLower; - // count elements in range int[] a = [ 1, 2, 4, 3, 2, 5, 3, 2, 4 ]; - assert(count(a) == 9); assert(count(a, 2) == 3); assert(count!("a > b")(a, 2) == 5); +} + +/// +@safe unittest +{ + import std.uni : toLower; // count range in range assert(count("abcadfabf", "ab") == 2); assert(count("ababab", "abab") == 1); assert(count("ababab", "abx") == 0); // fuzzy count range in range assert(count!((a, b) => toLower(a) == toLower(b))("AbcAdFaBf", "ab") == 2); - // count predicate in range - assert(count!("a > 1")(a) == 8); } @safe unittest @@ -711,7 +708,24 @@ if (isForwardRange!R1 && !isInfinite!R1 && } } -/// Ditto +/** +Counts all elements or elements satisfying a predicate in `haystack`. + +The first overload counts each element `e` in `haystack` for which `pred(e)` is $(D +true). Performs $(BIGOH haystack.length) evaluations of `pred`. + +The second overload counts the number of elements in a range. +If the given range has the `length` property, +that is returned right away, otherwise +performs $(BIGOH haystack.length) to walk the range. + +Params: + pred = Optional predicate to find elements. + haystack = The range to _count. + +Returns: + The number of elements in `haystack` (for which `pred` returned true). +*/ size_t count(alias pred, R)(R haystack) if (isInputRange!R && !isInfinite!R && is(typeof(unaryFun!pred(haystack.front)))) @@ -723,6 +737,16 @@ if (isInputRange!R && !isInfinite!R && return result; } +/// +@safe unittest +{ + // count elements in range + int[] a = [ 1, 2, 4, 3, 2, 5, 3, 2, 4 ]; + assert(count(a) == 9); + // count predicate in range + assert(count!("a > 2")(a) == 5); +} + /// Ditto size_t count(R)(R haystack) if (isInputRange!R && !isInfinite!R) diff --git a/libphobos/src/std/algorithm/setops.d b/libphobos/src/std/algorithm/setops.d index cc6f5b7..363bd16 100644 --- a/libphobos/src/std/algorithm/setops.d +++ b/libphobos/src/std/algorithm/setops.d @@ -8,7 +8,7 @@ $(LREF setIntersection), $(LREF setSymmetricDifference) expect a range of sorted ranges as input. All algorithms are generalized to accept as input not only sets but also -$(HTTP https://en.wikipedia.org/wiki/Multiset, multisets). Each algorithm +$(LINK2 https://en.wikipedia.org/wiki/Multiset, multisets). Each algorithm documents behaviour in the presence of duplicated inputs. $(SCRIPT inhibitQuickIndex = 1;) diff --git a/libphobos/src/std/bitmanip.d b/libphobos/src/std/bitmanip.d index 61c6c20..de2ff31 100644 --- a/libphobos/src/std/bitmanip.d +++ b/libphobos/src/std/bitmanip.d @@ -164,8 +164,7 @@ private template createStorageAndFields(Ts...) alias StoreType = ulong; else { - import std.conv : to; - static assert(false, "Field widths must sum to 8, 16, 32, or 64, not " ~ to!string(Size)); + static assert(false, "Field widths must sum to 8, 16, 32, or 64, not " ~ Size.stringof); alias StoreType = ulong; // just to avoid another error msg } @@ -2959,10 +2958,10 @@ if (__traits(isIntegral, T)) Unqual!T result; version (LittleEndian) foreach_reverse (b; array) - result = cast(Unqual!T) ((result << 8) | b); + result = cast() cast(T) ((result << 8) | b); else foreach (b; array) - result = cast(Unqual!T) ((result << 8) | b); + result = cast() cast(T) ((result << 8) | b); return cast(T) result; } @@ -2977,7 +2976,7 @@ if (__traits(isIntegral, T)) foreach (i; 0 .. T.sizeof) { result[i] = cast(ubyte) tmp; - tmp = cast(Unqual!T) (tmp >>> 8); + tmp = cast() cast(T) (tmp >>> 8); } } else @@ -2985,7 +2984,7 @@ if (__traits(isIntegral, T)) foreach_reverse (i; 0 .. T.sizeof) { result[i] = cast(ubyte) tmp; - tmp = cast(Unqual!T) (tmp >>> 8); + tmp = cast()(T) (tmp >>> 8); } } return result; diff --git a/libphobos/src/std/conv.d b/libphobos/src/std/conv.d index 5d02df0..3aa73c6 100644 --- a/libphobos/src/std/conv.d +++ b/libphobos/src/std/conv.d @@ -5250,7 +5250,7 @@ if (isIntegral!T && isOutputRange!(W, char)) auto unsigned(T)(T x) if (isIntegral!T) { - return cast(Unqual!(Unsigned!T))x; + return cast() cast(Unsigned!T) x; } /// @@ -5271,7 +5271,7 @@ if (isSomeChar!T) { // All characters are unsigned static assert(T.min == 0, T.stringof ~ ".min must be zero"); - return cast(Unqual!T) x; + return cast() x; } @safe unittest @@ -5328,7 +5328,7 @@ if (isSomeChar!T) auto signed(T)(T x) if (isIntegral!T) { - return cast(Unqual!(Signed!T))x; + return cast() cast(Signed!T) x; } /// diff --git a/libphobos/src/std/csv.d b/libphobos/src/std/csv.d index 7f5c2b2..9ee9b5d 100644 --- a/libphobos/src/std/csv.d +++ b/libphobos/src/std/csv.d @@ -175,6 +175,16 @@ class CSVException : Exception assert(ex.toString == "(Row: 1, Col: 2) Unexpected 'b' when converting from type string to type int"); } +// https://issues.dlang.org/show_bug.cgi?id=24478 +@safe unittest +{ + import std.exception : collectException; + import std.algorithm.searching : count; + string text = "A, B\n1, 2, 3"; + auto ex = collectException!CSVException(csvReader!(string[string])(text, null).count); + assert(ex.toString == "(Row: 1, Col: 3) row contains more values than header"); +} + @safe pure unittest { import std.string; @@ -1179,7 +1189,10 @@ public: { for (; !recordRange.empty; recordRange.popFront()) { - aa[header[_input.col-1]] = recordRange.front; + const i = _input.col - 1; + if (i >= header.length) + throw new CSVException("row contains more values than header", _input.row, _input.col); + aa[header[i]] = recordRange.front; } } catch (ConvException e) diff --git a/libphobos/src/std/file.d b/libphobos/src/std/file.d index 5b8925d..1db779b 100644 --- a/libphobos/src/std/file.d +++ b/libphobos/src/std/file.d @@ -1083,6 +1083,7 @@ private void removeImpl(scope const(char)[] name, scope const(FSChar)* namez) @t @safe unittest { import std.exception : collectExceptionMsg, assertThrown; + import std.algorithm.searching : startsWith; string filename = null; // e.g. as returned by File.tmpfile.name @@ -1090,12 +1091,10 @@ private void removeImpl(scope const(char)[] name, scope const(FSChar)* namez) @t { // exact exception message is OS-dependent auto msg = filename.remove.collectExceptionMsg!FileException; - assert("Failed to remove file (null): Bad address" == msg, msg); + assert(msg.startsWith("Failed to remove file (null):"), msg); } else version (Windows) { - import std.algorithm.searching : startsWith; - // don't test exact message on windows, it's language dependent auto msg = filename.remove.collectExceptionMsg!FileException; assert(msg.startsWith("(null):"), msg); diff --git a/libphobos/src/std/internal/math/biguintcore.d b/libphobos/src/std/internal/math/biguintcore.d index d5c4768..9df6bb2 100644 --- a/libphobos/src/std/internal/math/biguintcore.d +++ b/libphobos/src/std/internal/math/biguintcore.d @@ -2241,31 +2241,6 @@ do return carry; } -// result = left - right -// returns carry (0 or 1) -BigDigit subSimple(BigDigit [] result,const(BigDigit) [] left, - const(BigDigit) [] right) pure nothrow -in -{ - assert(result.length == left.length, - "result and left must be of the same length"); - assert(left.length >= right.length, - "left must be longer or of equal length to right"); - assert(right.length > 0, "right must not be empty"); -} -do -{ - BigDigit carry = multibyteSub(result[0 .. right.length], - left[0 .. right.length], right, 0); - if (right.length < left.length) - { - result[right.length .. left.length] = left[right.length .. $]; - carry = multibyteIncrementAssign!('-')(result[right.length..$], carry); - } //else if (result.length == left.length+1) { result[$-1] = carry; carry=0; } - return carry; -} - - /* result = result - right * Returns carry = 1 if result was less than right. */ diff --git a/libphobos/src/std/internal/test/range.d b/libphobos/src/std/internal/test/range.d index 6aa9676..4a5ff72 100644 --- a/libphobos/src/std/internal/test/range.d +++ b/libphobos/src/std/internal/test/range.d @@ -23,3 +23,94 @@ module std.internal.test.range; auto r = R().chunks(3); assert(r.equal!equal([[ 0, 1, 2 ], [ 3, 4 ]])); } + +// https://issues.dlang.org/show_bug.cgi?id=24415 +@safe unittest +{ + import std.range : only; + + static struct S(T) + { + T i; + + this(ref return scope inout(S) rhs) scope @safe inout pure nothrow + { + i = rhs.i; + } + } + { + auto a = only(S!int(42)); + auto b = a; + assert(!b.empty); + assert(b.front == S!int(42)); + + a.popFront(); + auto c = a; + assert(c.empty); + } + { + auto a = only(S!(const int)(42)); + auto b = a; + assert(!b.empty); + assert(b.front == S!(const int)(42)); + + a.popFront(); + auto c = a; + assert(c.empty); + } + { + auto a = only(S!(immutable int)(42)); + auto b = a; + assert(!b.empty); + assert(b.front == S!(immutable int)(42)); + + a.popFront(); + auto c = a; + assert(c.empty); + } + { + auto a = only(S!int(42), S!int(192)); + auto b = a; + assert(!b.empty); + assert(b.front == S!int(42)); + + a.popFront(); + auto c = a; + assert(!c.empty); + assert(c.front == S!int(192)); + + a.popFront(); + auto d = a; + assert(d.empty); + } + { + auto a = only(S!(const int)(42), S!(const int)(192)); + auto b = a; + assert(!b.empty); + assert(b.front == S!(const int)(42)); + + a.popFront(); + auto c = a; + assert(!c.empty); + assert(c.front == S!(const int)(192)); + + a.popFront(); + auto d = a; + assert(d.empty); + } + { + auto a = only(S!(immutable int)(42), S!(immutable int)(192)); + auto b = a; + assert(!b.empty); + assert(b.front == S!(immutable int)(42)); + + a.popFront(); + auto c = a; + assert(!c.empty); + assert(c.front == S!(immutable int)(192)); + + a.popFront(); + auto d = a; + assert(d.empty); + } +} diff --git a/libphobos/src/std/internal/unicode_comp.d b/libphobos/src/std/internal/unicode_comp.d index 646aeeb..28b2e0d 100644 --- a/libphobos/src/std/internal/unicode_comp.d +++ b/libphobos/src/std/internal/unicode_comp.d @@ -7,11 +7,11 @@ import std.internal.unicode_tables; static if (size_t.sizeof == 4) { //10144 bytes -enum combiningClassTrieEntries = TrieEntry!(ubyte, 8, 8, 5)(cast(immutable size_t[]) x" +enum combiningClassTrieEntries = TrieEntry!(ubyte, 8, 8, 5)(x" 0000000000000040000005C0", -cast(immutable size_t[]) x" +x" 0000010000000B00000010A0", -cast(immutable size_t[]) x" +x" 020201000402030206020205090807020000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 @@ -226,11 +226,11 @@ E600E6E6E6E600E600E6E6E600000000000000000000000000000000000000000000000000000000 00000000000000000000000000000000", ); enum composeIdxMask = (1 << 11) - 1, composeCntShift = 11; -enum compositionJumpTrieEntries = TrieEntry!(ushort, 12, 9)(cast(immutable size_t[]) x" +enum compositionJumpTrieEntries = TrieEntry!(ushort, 12, 9)(x" 0000000000000800", -cast(immutable size_t[]) x" +x" 0000100000002600", -cast(immutable size_t[]) x" +x" 00010000000300020005000400070006000700080007000700090007000A0007000C000B000700070007000700070007 0007000D0007000700070007000700070007000700070007000700070007000700070007000700070007000700070007 000700070007000700070007000700070007000700070007000700070007000700070007000700070007000700070007 @@ -919,11 +919,11 @@ return t[]; static if (size_t.sizeof == 8) { //10144 bytes -enum combiningClassTrieEntries = TrieEntry!(ubyte, 8, 8, 5)(cast(immutable size_t[]) x" +enum combiningClassTrieEntries = TrieEntry!(ubyte, 8, 8, 5)(x" 0000000000000000000000000000002000000000000002E0", -cast(immutable size_t[]) x" +x" 00000000000001000000000000000B0000000000000010A0", -cast(immutable size_t[]) x" +x" 040203020202010009080702060202050000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 @@ -1138,11 +1138,11 @@ E6E6E6E600000000000000000007E6E6000000000000000000000000000000000000000000000000 00000000000000000000000000000000", ); enum composeIdxMask = (1 << 11) - 1, composeCntShift = 11; -enum compositionJumpTrieEntries = TrieEntry!(ushort, 12, 9)(cast(immutable size_t[]) x" +enum compositionJumpTrieEntries = TrieEntry!(ushort, 12, 9)(x" 00000000000000000000000000000400", -cast(immutable size_t[]) x" +x" 00000000000010000000000000002600", -cast(immutable size_t[]) x" +x" 000300020001000000070006000500040007000700070008000A00070009000700070007000C000B0007000700070007 000700070007000D00070007000700070007000700070007000700070007000700070007000700070007000700070007 000700070007000700070007000700070007000700070007000700070007000700070007000700070007000700070007 diff --git a/libphobos/src/std/internal/unicode_decomp.d b/libphobos/src/std/internal/unicode_decomp.d index 6016f3d..d596d48 100644 --- a/libphobos/src/std/internal/unicode_decomp.d +++ b/libphobos/src/std/internal/unicode_decomp.d @@ -19,11 +19,11 @@ import std.internal.unicode_tables; static if (size_t.sizeof == 4) { //23488 bytes -enum compatMappingTrieEntries = TrieEntry!(ushort, 8, 8, 5)(cast(immutable size_t[]) x" +enum compatMappingTrieEntries = TrieEntry!(ushort, 8, 8, 5)(x" 000000000000004000000540", -cast(immutable size_t[]) x" +x" 0000010000000A0000002360", -cast(immutable size_t[]) x" +x" 020201000402030202020205070602020202020208020202000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 @@ -516,11 +516,11 @@ cast(immutable size_t[]) x" 00000000000000000000000000000000", ); //12544 bytes -enum canonMappingTrieEntries = TrieEntry!(ushort, 8, 8, 5)(cast(immutable size_t[]) x" +enum canonMappingTrieEntries = TrieEntry!(ushort, 8, 8, 5)(x" 000000000000004000000440", -cast(immutable size_t[]) x" +x" 000001000000080000001000", -cast(immutable size_t[]) x" +x" 020201000302020202020204020502020202020206020202000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 @@ -1636,11 +1636,11 @@ return t[]; static if (size_t.sizeof == 8) { //23488 bytes -enum compatMappingTrieEntries = TrieEntry!(ushort, 8, 8, 5)(cast(immutable size_t[]) x" +enum compatMappingTrieEntries = TrieEntry!(ushort, 8, 8, 5)(x" 0000000000000000000000000000002000000000000002A0", -cast(immutable size_t[]) x" +x" 00000000000001000000000000000A000000000000002360", -cast(immutable size_t[]) x" +x" 040203020202010007060202020202050802020202020202000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 @@ -2133,11 +2133,11 @@ cast(immutable size_t[]) x" 00000000000000000000000000000000", ); //12544 bytes -enum canonMappingTrieEntries = TrieEntry!(ushort, 8, 8, 5)(cast(immutable size_t[]) x" +enum canonMappingTrieEntries = TrieEntry!(ushort, 8, 8, 5)(x" 000000000000000000000000000000200000000000000220", -cast(immutable size_t[]) x" +x" 000000000000010000000000000008000000000000001000", -cast(immutable size_t[]) x" +x" 030202020202010002050202020202040602020202020202000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 diff --git a/libphobos/src/std/internal/unicode_grapheme.d b/libphobos/src/std/internal/unicode_grapheme.d index d33e987..ba80e18 100644 --- a/libphobos/src/std/internal/unicode_grapheme.d +++ b/libphobos/src/std/internal/unicode_grapheme.d @@ -19,11 +19,11 @@ package(std): static if (size_t.sizeof == 4) { //832 bytes -enum hangulLVTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum hangulLVTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000004000000080", -cast(immutable size_t[]) x" +x" 000001000000008000000A00", -cast(immutable size_t[]) x" +x" 000000000002010000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 @@ -44,11 +44,11 @@ cast(immutable size_t[]) x" 00000000000000000000000000000000", ); //832 bytes -enum hangulLVTTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum hangulLVTTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000004000000080", -cast(immutable size_t[]) x" +x" 000001000000008000000A00", -cast(immutable size_t[]) x" +x" 000000000002010000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 @@ -69,11 +69,11 @@ FEFFFFFFFFEFFFFFFFFEFFFFFFFFEFFFFFFFFEFF0000000F00000000000000000000000000000000 00000000000000000000000000000000", ); //896 bytes -enum prependTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum prependTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000004000000080", -cast(immutable size_t[]) x" +x" 000001000000008000000C00", -cast(immutable size_t[]) x" +x" 010101000101010101010102010101010101010101010101010101010101010101010101010101010101010101010101 010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101 010101010101010101010101010101010101010101010101010101010101010101010101010101010000000000000000 @@ -95,11 +95,11 @@ cast(immutable size_t[]) x" 0000000000000000000000000000000000000000000000000000000000000000", ); //1280 bytes -enum controlTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum controlTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 0000000000000040000000D0", -cast(immutable size_t[]) x" +x" 000001000000012000000E00", -cast(immutable size_t[]) x" +x" 020201000302020202020402020605020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020702020202020202020202020202020202020202020000000000000000 @@ -129,11 +129,11 @@ FFFFFFFF000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000 0000000000000000000000000000000000000000000000000000000000000000", ); //1856 bytes -enum spacingMarkTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum spacingMarkTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 0000000000000040000000B0", -cast(immutable size_t[]) x" +x" 00000100000000E000002400", -cast(immutable size_t[]) x" +x" 010101000101020104010103010501010101010101010101010101010101010101010101010101010101010101010101 010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101 010101010101010101010101010101010101010101010101010101010101010101010101010101010000000000000000 @@ -175,11 +175,11 @@ cast(immutable size_t[]) x" 0000000000000000000000000000000000000000000000000000000000000000", ); //3488 bytes -enum graphemeExtendTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum graphemeExtendTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000004000000110", -cast(immutable size_t[]) x" +x" 00000100000001A000004B00", -cast(immutable size_t[]) x" +x" 0202010004020302070206050A0908020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020B02020202020202020202020202020202020202020000000000000000 @@ -255,11 +255,11 @@ FFFFFFFFF87FFFFFFFFFFFFF00201FFFF80000100000FFFE0000000000000000F9FFFF7F000007DB 0000000000000000000000000000000000000000000000000000000000000000", ); //1344 bytes -enum Extended_PictographicTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum Extended_PictographicTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000004000000090", -cast(immutable size_t[]) x" +x" 00000100000000A000001800", -cast(immutable size_t[]) x" +x" 020201000202020202020202030202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020000000000000000 @@ -296,11 +296,11 @@ FFFFFFFFFFFFFFFFFFFFFFFF3FFFFFFF000000000000000000000000000000000000000000000000 static if (size_t.sizeof == 8) { //832 bytes -enum hangulLVTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum hangulLVTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000000000000000000000200000000000000040", -cast(immutable size_t[]) x" +x" 000000000000010000000000000000800000000000000A00", -cast(immutable size_t[]) x" +x" 000201000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 @@ -321,11 +321,11 @@ cast(immutable size_t[]) x" 00000000000000000000000000000000", ); //832 bytes -enum hangulLVTTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum hangulLVTTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000000000000000000000200000000000000040", -cast(immutable size_t[]) x" +x" 000000000000010000000000000000800000000000000A00", -cast(immutable size_t[]) x" +x" 000201000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 @@ -346,11 +346,11 @@ FFEFFFFFFEFFFFFFFFFFEFFFFFFEFFFF0000000FFFFFFEFF00000000000000000000000000000000 00000000000000000000000000000000", ); //896 bytes -enum prependTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum prependTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000000000000000000000200000000000000040", -cast(immutable size_t[]) x" +x" 000000000000010000000000000000800000000000000C00", -cast(immutable size_t[]) x" +x" 010101010101010001010101010101020101010101010101010101010101010101010101010101010101010101010101 010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101 010101010101010101010101010101010101010101010101010101010101010101010101010101010000000000000000 @@ -372,11 +372,11 @@ cast(immutable size_t[]) x" 0000000000000000000000000000000000000000000000000000000000000000", ); //1280 bytes -enum controlTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum controlTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000000000000000000000200000000000000068", -cast(immutable size_t[]) x" +x" 000000000000010000000000000001200000000000000E00", -cast(immutable size_t[]) x" +x" 030202020202010002060502020204020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020207020202020202020202020202020202020000000000000000 @@ -406,11 +406,11 @@ FFFF0000000000000000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000", ); //1856 bytes -enum spacingMarkTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum spacingMarkTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000000000000000000000200000000000000058", -cast(immutable size_t[]) x" +x" 000000000000010000000000000000E00000000000002400", -cast(immutable size_t[]) x" +x" 010102010101010001050101040101030101010101010101010101010101010101010101010101010101010101010101 010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101 010101010101010101010101010101010101010101010101010101010101010101010101010101010000000000000000 @@ -452,11 +452,11 @@ C0300000000000080000000000000002000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000", ); //3488 bytes -enum graphemeExtendTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum graphemeExtendTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000000000000000000000200000000000000088", -cast(immutable size_t[]) x" +x" 000000000000010000000000000001A00000000000004B00", -cast(immutable size_t[]) x" +x" 04020302020201000A090802070206050202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 02020202020202020202020202020202020202020202020B020202020202020202020202020202020000000000000000 @@ -532,11 +532,11 @@ F87FFFFFFFFFFFFF00201FFFFFFFFFFF0000FFFEF80000100000000000000000000007DBF9FFFF7F 0000000000000000000000000000000000000000000000000000000000000000", ); //1344 bytes -enum Extended_PictographicTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum Extended_PictographicTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000000000000000000000200000000000000048", -cast(immutable size_t[]) x" +x" 000000000000010000000000000000A00000000000001800", -cast(immutable size_t[]) x" +x" 020202020202010003020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020000000000000000 diff --git a/libphobos/src/std/internal/unicode_norm.d b/libphobos/src/std/internal/unicode_norm.d index c103c25..bc51c8c 100644 --- a/libphobos/src/std/internal/unicode_norm.d +++ b/libphobos/src/std/internal/unicode_norm.d @@ -19,11 +19,11 @@ package(std): static if (size_t.sizeof == 4) { //1728 bytes -enum nfcQCTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum nfcQCTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 0000000000000040000000C0", -cast(immutable size_t[]) x" +x" 000001000000010000001E00", -cast(immutable size_t[]) x" +x" 020201000302020202020204020502020202020206020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020000000000000000 @@ -62,11 +62,11 @@ FFFFFFFFFFFFFFFF03FFFFFF00000000A00000005F7FFC0000007FDB000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", ); //2048 bytes -enum nfdQCTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum nfdQCTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 0000000000000040000000E0", -cast(immutable size_t[]) x" +x" 000001000000014000002400", -cast(immutable size_t[]) x" +x" 020201000504030202020206020702020202020208020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020000000000000000 @@ -112,11 +112,11 @@ A00000005F7FFC0000007FDB00000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000", ); //2848 bytes -enum nfkcQCTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum nfkcQCTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 0000000000000040000000E0", -cast(immutable size_t[]) x" +x" 000001000000014000003D00", -cast(immutable size_t[]) x" +x" 020201000402030202020205070602020202020208020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020000000000000000 @@ -179,11 +179,11 @@ FFFF07FFFFFF7FFF0000FFFF00001C0000010000000000000000000000000000FFFF00070FFFFFFF 00000000000000000000000000000000", ); //2944 bytes -enum nfkdQCTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum nfkdQCTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 0000000000000040000000F0", -cast(immutable size_t[]) x" +x" 000001000000016000003E00", -cast(immutable size_t[]) x" +x" 020201000504030202020206080702020202020209020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020000000000000000 @@ -254,11 +254,11 @@ FFFF07FFFFFF7FFF0000FFFF00001C0000010000000000000000000000000000FFFF00070FFFFFFF static if (size_t.sizeof == 8) { //1728 bytes -enum nfcQCTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum nfcQCTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000000000000000000000200000000000000060", -cast(immutable size_t[]) x" +x" 000000000000010000000000000001000000000000001E00", -cast(immutable size_t[]) x" +x" 030202020202010002050202020202040602020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020000000000000000 @@ -297,11 +297,11 @@ FFFFFFFFFFFFFFFF0000000003FFFFFF5F7FFC00A00000000000000000007FDB0000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", ); //2048 bytes -enum nfdQCTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum nfdQCTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000000000000000000000200000000000000070", -cast(immutable size_t[]) x" +x" 000000000000010000000000000001400000000000002400", -cast(immutable size_t[]) x" +x" 050403020202010002070202020202060802020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020000000000000000 @@ -347,11 +347,11 @@ F8000000000000000000000000000001000000003FFFFFFF00000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000", ); //2848 bytes -enum nfkcQCTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum nfkcQCTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000000000000000000000200000000000000070", -cast(immutable size_t[]) x" +x" 000000000000010000000000000001400000000000003D00", -cast(immutable size_t[]) x" +x" 040203020202010007060202020202050802020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020000000000000000 @@ -414,11 +414,11 @@ FFFF7FFFFFFF07FF00001C000000FFFF000000000001000000000000000000000FFFFFFFFFFF0007 00000000000000000000000000000000", ); //2944 bytes -enum nfkdQCTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum nfkdQCTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000000000000000000000200000000000000078", -cast(immutable size_t[]) x" +x" 000000000000010000000000000001600000000000003E00", -cast(immutable size_t[]) x" +x" 050403020202010008070202020202060902020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020000000000000000 diff --git a/libphobos/src/std/internal/unicode_tables.d b/libphobos/src/std/internal/unicode_tables.d index cc0225b..a686e38 100644 --- a/libphobos/src/std/internal/unicode_tables.d +++ b/libphobos/src/std/internal/unicode_tables.d @@ -75,7 +75,7 @@ struct TrieEntry(T...) SCE simpleCaseTable(size_t i) { -static immutable uint[] t = cast(immutable uint[]) x" +static immutable uint[] t = x" 0201E90B0211E92D0201E9110211E93302000496021004970200A7220210A72302001F7902101FF902001F4402101F4C 0200015A0210015B020010FD02101CBD02016E4C02116E6C02001E3802101E390201E9210211E94302001F2302101F2B 020001A0021001A1030003A3031003C2032003C3020004DC021004DD02002CA602102CA70200017B0210017C0201E906 @@ -329,7 +329,7 @@ return SCE(t[i]); } @property FCE fullCaseTable(size_t index) nothrow @nogc @safe pure { -static immutable ulong[] t = cast(immutable ulong[]) x" +static immutable ulong[] t = x" 001E90B000000021001E92D0000001210010CAE0000000210010CEE00000012100004960000000210000497000000121 001E911000000021001E933000000121000A722000000021000A7230000001210001F790000000210001FF9000000121 0001F440000000210001F4C000000121000015A000000021000015B00000012100010FD0000000210001CBD000000121 @@ -2285,11 +2285,11 @@ bool isHangT(dchar ch) @safe pure nothrow @nogc static if (size_t.sizeof == 4) { //2080 bytes -enum lowerCaseTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum lowerCaseTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 0000000000000040000000E0", -cast(immutable size_t[]) x" +x" 000001000000014000002500", -cast(immutable size_t[]) x" +x" 020201000402030206020205080702020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020000000000000000 @@ -2336,11 +2336,11 @@ FFFFFFC0FC000000000FFFFFFFFFC000000000FF0FFFFFFCFFC000000000FFFFFFFFFC000000003F 00000000000000000000000000000000", ); //1856 bytes -enum upperCaseTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum upperCaseTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 0000000000000040000000E0", -cast(immutable size_t[]) x" +x" 000001000000014000001E00", -cast(immutable size_t[]) x" +x" 020201000402030206020205080702020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020000000000000000 @@ -2382,11 +2382,11 @@ F0000000001FFFFFFFC0000000007FFFFFFF0000000001FF0000040000000000FFFFFFFF00000003 0000000000000000000000000000000000000000000000000000000000000000", ); //11648 bytes -enum simpleCaseTrieEntries = TrieEntry!(ushort, 8, 7, 6)(cast(immutable size_t[]) x" +enum simpleCaseTrieEntries = TrieEntry!(ushort, 8, 7, 6)(x" 000000000000004000000280", -cast(immutable size_t[]) x" +x" 0000010000000480000011C0", -cast(immutable size_t[]) x" +x" 020201000402030206020205070202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 @@ -2632,11 +2632,11 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", ); //11648 bytes -enum fullCaseTrieEntries = TrieEntry!(ushort, 8, 7, 6)(cast(immutable size_t[]) x" +enum fullCaseTrieEntries = TrieEntry!(ushort, 8, 7, 6)(x" 000000000000004000000280", -cast(immutable size_t[]) x" +x" 0000010000000480000011C0", -cast(immutable size_t[]) x" +x" 020201000402030206020205070202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 @@ -2882,11 +2882,11 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", ); //5600 bytes -enum alphaTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum alphaTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 0000000000000040000001A0", -cast(immutable size_t[]) x" +x" 00000100000002C000007B00", -cast(immutable size_t[]) x" +x" 03020100060504030A0908070E0D0C0B0303030311100F03141413121414141414141414141414141414141414141414 141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414 141414141414141414141414141414141414141414141414141414141414141414141414141414140000000000000000 @@ -3006,11 +3006,11 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFF 0000000000000000000000000000000000000000000000000000000000000000", ); //3392 bytes -enum markTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum markTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000004000000110", -cast(immutable size_t[]) x" +x" 00000100000001A000004800", -cast(immutable size_t[]) x" +x" 0202010004020302070206050A0908020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020B02020202020202020202020202020202020202020000000000000000 @@ -3084,11 +3084,11 @@ F9FFFF7F000007DB0000000000000000000080000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000", ); //2848 bytes -enum numberTrieEntries = TrieEntry!(bool, 8, 6, 7)(cast(immutable size_t[]) x" +enum numberTrieEntries = TrieEntry!(bool, 8, 6, 7)(x" 0000000000000040000001A0", -cast(immutable size_t[]) x" +x" 00000100000002C000002500", -cast(immutable size_t[]) x" +x" 020201000402030207020605090802020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020000000000000000 @@ -3151,11 +3151,11 @@ FFFFFFFF001EEFFF0000000000000000FFFFFFFE3FFFBFFF000000000000000000001FFF00000000 00000000000000000000000003FF0000", ); //3360 bytes -enum punctuationTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum punctuationTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000004000000100", -cast(immutable size_t[]) x" +x" 000001000000018000004900", -cast(immutable size_t[]) x" +x" 0202010004020302070206050A0908020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020000000000000000 @@ -3228,11 +3228,11 @@ E8003600000000000000000000003C000000000000000000001000000000000000003FFF00000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", ); //3424 bytes -enum symbolTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum symbolTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000004000000100", -cast(immutable size_t[]) x" +x" 000001000000018000004B00", -cast(immutable size_t[]) x" +x" 0302010005030403070303060A0908030303030303030303030303030303030303030303030303030303030303030303 030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303 030303030303030303030303030303030303030303030303030303030303030303030303030303030000000000000000 @@ -3307,11 +3307,11 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFFFFFFF000007FF000000000000000000000000 00000000000000000000000000000000", ); //6080 bytes -enum graphicalTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum graphicalTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 0000000000000040000001A0", -cast(immutable size_t[]) x" +x" 00000100000002C000008A00", -cast(immutable size_t[]) x" +x" 0202010005040302090807060D0C0B0A02020202100F0E02131312111313131313131313131313131313131313131313 131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313 131313131313131313131313131313131313131413131313131313131313131313131313131313130000000000000000 @@ -3441,11 +3441,11 @@ FFFFFFFF0000FFFF0000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 0000000000000000000000000000000000000000000000000000000000000000", ); //4824 bytes -enum nonCharacterTrieEntries = TrieEntry!(bool, 7, 4, 4, 6)(cast(immutable size_t[]) x" +enum nonCharacterTrieEntries = TrieEntry!(bool, 7, 4, 4, 6)(x" 00000000000000200000009800000298", -cast(immutable size_t[]) x" +x" 00000080000000F000000400000043C0", -cast(immutable size_t[]) x" +x" 0302010007060504090801010B0B0B0A0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B 0B0B0B0B0B0B0B0B0B0B0B0C0D0101010D01010100000000000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000010000000300020005000400070006 @@ -3552,11 +3552,11 @@ enum MAX_SIMPLE_LOWER = 1433; enum MAX_SIMPLE_UPPER = 1450; enum MAX_SIMPLE_TITLE = 1454; //10496 bytes -enum toUpperIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(cast(immutable size_t[]) x" +enum toUpperIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(x" 000000000000004000000280", -cast(immutable size_t[]) x" +x" 000001000000048000000F80", -cast(immutable size_t[]) x" +x" 020201000402030206020205070202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 @@ -3778,11 +3778,11 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", ); //10112 bytes -enum toLowerIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(cast(immutable size_t[]) x" +enum toLowerIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(x" 000000000000004000000280", -cast(immutable size_t[]) x" +x" 000001000000048000000EC0", -cast(immutable size_t[]) x" +x" 020201000402030206020205070202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 @@ -3996,11 +3996,11 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", ); //10496 bytes -enum toTitleIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(cast(immutable size_t[]) x" +enum toTitleIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(x" 000000000000004000000280", -cast(immutable size_t[]) x" +x" 000001000000048000000F80", -cast(immutable size_t[]) x" +x" 020201000402030206020205070202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 @@ -4222,11 +4222,11 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", ); //10368 bytes -enum toUpperSimpleIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(cast(immutable size_t[]) x" +enum toUpperSimpleIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(x" 000000000000004000000280", -cast(immutable size_t[]) x" +x" 000001000000048000000F40", -cast(immutable size_t[]) x" +x" 020201000402030206020205070202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 @@ -4445,11 +4445,11 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", ); //9856 bytes -enum toLowerSimpleIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(cast(immutable size_t[]) x" +enum toLowerSimpleIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(x" 000000000000004000000280", -cast(immutable size_t[]) x" +x" 000001000000048000000E40", -cast(immutable size_t[]) x" +x" 020201000402030206020205070202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 @@ -4658,11 +4658,11 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", ); //10368 bytes -enum toTitleSimpleIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(cast(immutable size_t[]) x" +enum toTitleSimpleIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(x" 000000000000004000000280", -cast(immutable size_t[]) x" +x" 000001000000048000000F40", -cast(immutable size_t[]) x" +x" 020201000402030206020205070202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 @@ -4882,7 +4882,7 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ); immutable(uint)[] toUpperTable() nothrow @nogc pure @safe { static immutable uint[] t = -cast(immutable uint[]) x" +x" 0000004100000042000000430000004400000045000000460000004700000048000000490000004A0000004B0000004C 0000004D0000004E0000004F000000500000005100000052000000530000005400000055000000560000005700000058 000000590000005A0000039C000000C0000000C1000000C2000000C3000000C4000000C5000000C6000000C7000000C8 @@ -5027,7 +5027,7 @@ return t; } immutable(uint)[] toLowerTable() nothrow @nogc pure @safe { static immutable uint[] t = -cast(immutable uint[]) x" +x" 0000006100000062000000630000006400000065000000660000006700000068000000690000006A0000006B0000006C 0000006D0000006E0000006F000000700000007100000072000000730000007400000075000000760000007700000078 000000790000007A000000E0000000E1000000E2000000E3000000E4000000E5000000E6000000E7000000E8000000E9 @@ -5161,7 +5161,7 @@ return t; } immutable(uint)[] toTitleTable() nothrow @nogc pure @safe { static immutable uint[] t = -cast(immutable uint[]) x" +x" 0000004100000042000000430000004400000045000000460000004700000048000000490000004A0000004B0000004C 0000004D0000004E0000004F000000500000005100000052000000530000005400000055000000560000005700000058 000000590000005A0000039C000000C0000000C1000000C2000000C3000000C4000000C5000000C6000000C7000000C8 @@ -5307,11 +5307,11 @@ return t; static if (size_t.sizeof == 8) { //2080 bytes -enum lowerCaseTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum lowerCaseTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000000000000000000000200000000000000070", -cast(immutable size_t[]) x" +x" 000000000000010000000000000001400000000000002500", -cast(immutable size_t[]) x" +x" 040203020202010008070202060202050202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020000000000000000 @@ -5358,11 +5358,11 @@ FFFFFFFC00000000000000000000000F000000000000000000000000000000000000000000000000 00000000000000000000000000000000", ); //1856 bytes -enum upperCaseTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum upperCaseTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000000000000000000000200000000000000070", -cast(immutable size_t[]) x" +x" 000000000000010000000000000001400000000000001E00", -cast(immutable size_t[]) x" +x" 040203020202010008070202060202050202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020000000000000000 @@ -5404,11 +5404,11 @@ FFF0000003FFFFFFFFFFFF0000003FFF003FDE64D0000003000003FFFFFF00007B0000001FDFE7B0 0000000000000000000000000000000000000000000000000000000000000000", ); //11648 bytes -enum simpleCaseTrieEntries = TrieEntry!(ushort, 8, 7, 6)(cast(immutable size_t[]) x" +enum simpleCaseTrieEntries = TrieEntry!(ushort, 8, 7, 6)(x" 000000000000000000000000000000200000000000000140", -cast(immutable size_t[]) x" +x" 0000000000000100000000000000048000000000000011C0", -cast(immutable size_t[]) x" +x" 040203020202010007020202060202050202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 @@ -5654,11 +5654,11 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", ); //11648 bytes -enum fullCaseTrieEntries = TrieEntry!(ushort, 8, 7, 6)(cast(immutable size_t[]) x" +enum fullCaseTrieEntries = TrieEntry!(ushort, 8, 7, 6)(x" 000000000000000000000000000000200000000000000140", -cast(immutable size_t[]) x" +x" 0000000000000100000000000000048000000000000011C0", -cast(immutable size_t[]) x" +x" 040203020202010007020202060202050202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 @@ -5904,11 +5904,11 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", ); //5600 bytes -enum alphaTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum alphaTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 0000000000000000000000000000002000000000000000D0", -cast(immutable size_t[]) x" +x" 000000000000010000000000000002C00000000000007B00", -cast(immutable size_t[]) x" +x" 06050403030201000E0D0C0B0A09080711100F0303030303141414141414131214141414141414141414141414141414 141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414141414 141414141414141414141414141414141414141414141414141414141414141414141414141414140000000000000000 @@ -6028,11 +6028,11 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000FFFFFFFFFFFF 0000000000000000000000000000000000000000000000000000000000000000", ); //3392 bytes -enum markTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum markTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000000000000000000000200000000000000088", -cast(immutable size_t[]) x" +x" 000000000000010000000000000001A00000000000004800", -cast(immutable size_t[]) x" +x" 04020302020201000A090802070206050202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 02020202020202020202020202020202020202020202020B020202020202020202020202020202020000000000000000 @@ -6106,11 +6106,11 @@ B47E00000000000000000000000000BF0000000000FB7C0000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000", ); //2848 bytes -enum numberTrieEntries = TrieEntry!(bool, 8, 6, 7)(cast(immutable size_t[]) x" +enum numberTrieEntries = TrieEntry!(bool, 8, 6, 7)(x" 0000000000000000000000000000002000000000000000D0", -cast(immutable size_t[]) x" +x" 000000000000010000000000000002C00000000000002500", -cast(immutable size_t[]) x" +x" 040203020202010009080202070206050202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020000000000000000 @@ -6173,11 +6173,11 @@ FFFE0000000003FF0000000000000000000003FF000000000000000000000000003F000000000000 000000000000000003FF000000000000", ); //3360 bytes -enum punctuationTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum punctuationTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000000000000000000000200000000000000080", -cast(immutable size_t[]) x" +x" 000000000000010000000000000001800000000000004900", -cast(immutable size_t[]) x" +x" 04020302020201000A090802070206050202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020000000000000000 @@ -6250,11 +6250,11 @@ FE000000000000000000000000000000000000001E00000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", ); //3424 bytes -enum symbolTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum symbolTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 000000000000000000000000000000200000000000000080", -cast(immutable size_t[]) x" +x" 000000000000010000000000000001800000000000004B00", -cast(immutable size_t[]) x" +x" 05030403030201000A090803070303060303030303030303030303030303030303030303030303030303030303030303 030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303030303 030303030303030303030303030303030303030303030303030303030303030303030303030303030000000000000000 @@ -6329,11 +6329,11 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFF00000000000007FF0000000000000000 00000000000000000000000000000000", ); //6080 bytes -enum graphicalTrieEntries = TrieEntry!(bool, 8, 5, 8)(cast(immutable size_t[]) x" +enum graphicalTrieEntries = TrieEntry!(bool, 8, 5, 8)(x" 0000000000000000000000000000002000000000000000D0", -cast(immutable size_t[]) x" +x" 000000000000010000000000000002C00000000000008A00", -cast(immutable size_t[]) x" +x" 05040302020201000D0C0B0A09080706100F0E0202020202131313131313121113131313131313131313131313131313 131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313131313 131313131313131313131313131313131313131313131314131313131313131313131313131313130000000000000000 @@ -6463,11 +6463,11 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFF07FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF 0000000000000000000000000000000000000000000000000000000000000000", ); //4824 bytes -enum nonCharacterTrieEntries = TrieEntry!(bool, 7, 4, 4, 6)(cast(immutable size_t[]) x" +enum nonCharacterTrieEntries = TrieEntry!(bool, 7, 4, 4, 6)(x" 00000000000000000000000000000010000000000000004C000000000000014C", -cast(immutable size_t[]) x" +x" 000000000000008000000000000000F0000000000000040000000000000043C0", -cast(immutable size_t[]) x" +x" 07060504030201000B0B0B0A090801010B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B 0B0B0B0B0B0B0B0B0D0101010B0B0B0C000000000D010101000000000000000000000000000000000000000000000000 000000000000000000000000000000000000000000000000000000000000000000030002000100000007000600050004 @@ -6574,11 +6574,11 @@ enum MAX_SIMPLE_LOWER = 1433; enum MAX_SIMPLE_UPPER = 1450; enum MAX_SIMPLE_TITLE = 1454; //10496 bytes -enum toUpperIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(cast(immutable size_t[]) x" +enum toUpperIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(x" 000000000000000000000000000000200000000000000140", -cast(immutable size_t[]) x" +x" 000000000000010000000000000004800000000000000F80", -cast(immutable size_t[]) x" +x" 040203020202010007020202060202050202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 @@ -6800,11 +6800,11 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", ); //10112 bytes -enum toLowerIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(cast(immutable size_t[]) x" +enum toLowerIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(x" 000000000000000000000000000000200000000000000140", -cast(immutable size_t[]) x" +x" 000000000000010000000000000004800000000000000EC0", -cast(immutable size_t[]) x" +x" 040203020202010007020202060202050202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 @@ -7018,11 +7018,11 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", ); //10496 bytes -enum toTitleIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(cast(immutable size_t[]) x" +enum toTitleIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(x" 000000000000000000000000000000200000000000000140", -cast(immutable size_t[]) x" +x" 000000000000010000000000000004800000000000000F80", -cast(immutable size_t[]) x" +x" 040203020202010007020202060202050202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 @@ -7244,11 +7244,11 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", ); //10368 bytes -enum toUpperSimpleIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(cast(immutable size_t[]) x" +enum toUpperSimpleIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(x" 000000000000000000000000000000200000000000000140", -cast(immutable size_t[]) x" +x" 000000000000010000000000000004800000000000000F40", -cast(immutable size_t[]) x" +x" 040203020202010007020202060202050202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 @@ -7467,11 +7467,11 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", ); //9856 bytes -enum toLowerSimpleIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(cast(immutable size_t[]) x" +enum toLowerSimpleIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(x" 000000000000000000000000000000200000000000000140", -cast(immutable size_t[]) x" +x" 000000000000010000000000000004800000000000000E40", -cast(immutable size_t[]) x" +x" 040203020202010007020202060202050202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 @@ -7680,11 +7680,11 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF", ); //10368 bytes -enum toTitleSimpleIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(cast(immutable size_t[]) x" +enum toTitleSimpleIndexTrieEntries = TrieEntry!(ushort, 8, 7, 6)(x" 000000000000000000000000000000200000000000000140", -cast(immutable size_t[]) x" +x" 000000000000010000000000000004800000000000000F40", -cast(immutable size_t[]) x" +x" 040203020202010007020202060202050202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202020202 @@ -7904,7 +7904,7 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF ); immutable(uint)[] toUpperTable() nothrow @nogc pure @safe { static immutable uint[] t = -cast(immutable uint[]) x" +x" 0000004100000042000000430000004400000045000000460000004700000048000000490000004A0000004B0000004C 0000004D0000004E0000004F000000500000005100000052000000530000005400000055000000560000005700000058 000000590000005A0000039C000000C0000000C1000000C2000000C3000000C4000000C5000000C6000000C7000000C8 @@ -8049,7 +8049,7 @@ return t; } immutable(uint)[] toLowerTable() nothrow @nogc pure @safe { static immutable uint[] t = -cast(immutable uint[]) x" +x" 0000006100000062000000630000006400000065000000660000006700000068000000690000006A0000006B0000006C 0000006D0000006E0000006F000000700000007100000072000000730000007400000075000000760000007700000078 000000790000007A000000E0000000E1000000E2000000E3000000E4000000E5000000E6000000E7000000E8000000E9 @@ -8183,7 +8183,7 @@ return t; } immutable(uint)[] toTitleTable() nothrow @nogc pure @safe { static immutable uint[] t = -cast(immutable uint[]) x" +x" 0000004100000042000000430000004400000045000000460000004700000048000000490000004A0000004B0000004C 0000004D0000004E0000004F000000500000005100000052000000530000005400000055000000560000005700000058 000000590000005A0000039C000000C0000000C1000000C2000000C3000000C4000000C5000000C6000000C7000000C8 diff --git a/libphobos/src/std/logger/core.d b/libphobos/src/std/logger/core.d index 846f6ee..0633bdd 100644 --- a/libphobos/src/std/logger/core.d +++ b/libphobos/src/std/logger/core.d @@ -1473,15 +1473,15 @@ if (sharedLog !is myLogger) atomicStore!(MemoryOrder.seq)(stdSharedLogger, atomicLoad(logger)); } -/** This methods get and set the global `LogLevel`. +/** These methods get and set the global `LogLevel`. -Every log message with a `LogLevel` lower as the global `LogLevel` +Every log message with a `LogLevel` lower than the global `LogLevel` will be discarded before it reaches `writeLogMessage` method of any `Logger`. */ /* Implementation note: For any public logging call, the global log level shall only be queried once on -entry. Otherwise when another threads changes the level, we would work with +entry. Otherwise when another thread changes the level, we would work with different levels at different spots in the code. */ @property LogLevel globalLogLevel() @safe @nogc diff --git a/libphobos/src/std/math/algebraic.d b/libphobos/src/std/math/algebraic.d index fd30523..cfb88c8 100644 --- a/libphobos/src/std/math/algebraic.d +++ b/libphobos/src/std/math/algebraic.d @@ -974,9 +974,9 @@ private T powIntegralImpl(PowType type, T)(T val) else { static if (isSigned!T) - return cast(Unqual!T) (val < 0 ? -(T(1) << bsr(0 - val) + type) : T(1) << bsr(val) + type); + return cast() cast(T) (val < 0 ? -(T(1) << bsr(0 - val) + type) : T(1) << bsr(val) + type); else - return cast(Unqual!T) (T(1) << bsr(val) + type); + return cast() cast(T) (T(1) << bsr(val) + type); } } diff --git a/libphobos/src/std/math/hardware.d b/libphobos/src/std/math/hardware.d index c7c5d6e..dec8fdd 100644 --- a/libphobos/src/std/math/hardware.d +++ b/libphobos/src/std/math/hardware.d @@ -315,7 +315,7 @@ private: { asm nothrow @nogc { - "movgr2fcsr $r2,$r0"; + "movgr2fcsr $fcsr2,$r0"; } } else @@ -1166,7 +1166,7 @@ private: { asm nothrow @nogc { - "movgr2fcsr $r0,%0" : + "movgr2fcsr $fcsr0,%0" : : "r" (newState & (roundingMask | allExceptions)); } } diff --git a/libphobos/src/std/net/isemail.d b/libphobos/src/std/net/isemail.d index 12a29fe..2234f35 100644 --- a/libphobos/src/std/net/isemail.d +++ b/libphobos/src/std/net/isemail.d @@ -111,8 +111,9 @@ if (isSomeChar!(Char)) auto endOrDie = false; auto crlfCount = int.min; // int.min == not defined - foreach (ref i, e ; email) + for (size_t i; i < email.length; i++) { + auto e = email[i]; token = email.get(i, e); switch (context) diff --git a/libphobos/src/std/path.d b/libphobos/src/std/path.d index 449235a..a45865a 100644 --- a/libphobos/src/std/path.d +++ b/libphobos/src/std/path.d @@ -2732,6 +2732,9 @@ else version (Posix) The function allocates memory if and only if it gets to the third stage of this algorithm. + Note that `absolutePath` will not normalize `..` segments. + Use `buildNormalizedPath(absolutePath(path))` if that is desired. + Params: path = the relative path to transform base = the base directory of the relative path @@ -2815,6 +2818,9 @@ string absolutePath(return scope const string path, lazy string base = getcwd()) which allocates memory.) ) + Note that `asAbsolutePath` will not normalize `..` segments. + Use `asNormalizedPath(asAbsolutePath(path))` if that is desired. + Params: path = the relative path to transform @@ -3391,7 +3397,7 @@ do else { C[] pattmp; - foreach (ref pi; 0 .. pattern.length) + for (size_t pi = 0; pi < pattern.length; pi++) { const pc = pattern[pi]; switch (pc) diff --git a/libphobos/src/std/process.d b/libphobos/src/std/process.d index 494910f..325689b 100644 --- a/libphobos/src/std/process.d +++ b/libphobos/src/std/process.d @@ -1102,6 +1102,14 @@ private Pid spawnProcessPosix(scope const(char[])[] args, } } + if (config.preExecDelegate !is null) + { + if (config.preExecDelegate() != true) + { + abortOnError(forkPipeOut, InternalError.preExec, .errno); + } + } + // Execute program. core.sys.posix.unistd.execve(argz[0], argz.ptr, envz); @@ -1187,7 +1195,7 @@ private Pid spawnProcessPosix(scope const(char[])[] args, errorMsg = "Failed to allocate memory"; break; case InternalError.preExec: - errorMsg = "Failed to execute preExecFunction"; + errorMsg = "Failed to execute preExecFunction or preExecDelegate"; break; case InternalError.noerror: assert(false); @@ -1271,6 +1279,29 @@ version (Posix) assert(received); } +version (Posix) +@system unittest +{ + __gshared int j; + foreach (i; 0 .. 3) + { + auto config = Config( + preExecFunction: function() @trusted { + j = 1; + return true; + }, + preExecDelegate: delegate() @trusted { + // j should now be 1, as preExecFunction is called before + // preExecDelegate is. + _Exit(i + j); + return true; + }, + ); + auto pid = spawnProcess(["false"], config: config); + assert(wait(pid) == i + 1); + } +} + /* Implementation of spawnProcess() for Windows. @@ -2186,13 +2217,30 @@ struct Config Please note that the code in this function must only use async-signal-safe functions.) + If $(LREF preExecDelegate) is also set, it is called last. + On Windows, this member is not available. */ bool function() nothrow @nogc @safe preExecFunction; + + /** + A delegate that is called before `exec` in $(LREF spawnProcess). + It returns `true` if succeeded and otherwise returns `false`. + + $(RED Warning: + Please note that the code in this function must only use + async-signal-safe functions.) + + If $(LREF preExecFunction) is also set, it is called first. + + On Windows, this member is not available. + */ + bool delegate() nothrow @nogc @safe preExecDelegate; } else version (Posix) { bool function() nothrow @nogc @safe preExecFunction; + bool delegate() nothrow @nogc @safe preExecDelegate; } } diff --git a/libphobos/src/std/range/package.d b/libphobos/src/std/range/package.d index 30f6ffb..995bf1e 100644 --- a/libphobos/src/std/range/package.d +++ b/libphobos/src/std/range/package.d @@ -313,16 +313,18 @@ if (isBidirectionalRange!(Unqual!Range)) { @property void front(ElementType!R val) { - import std.algorithm.mutation : move; + import core.lifetime : forward; - source.back = move(val); + // __ctfe check is workaround for https://issues.dlang.org/show_bug.cgi?id=21542 + source.back = __ctfe ? val : forward!val; } @property void back(ElementType!R val) { - import std.algorithm.mutation : move; + import core.lifetime : forward; - source.front = move(val); + // __ctfe check is workaround for https://issues.dlang.org/show_bug.cgi?id=21542 + source.front = __ctfe ? val : forward!val; } } @@ -334,9 +336,10 @@ if (isBidirectionalRange!(Unqual!Range)) { void opIndexAssign(ElementType!R val, size_t n) { - import std.algorithm.mutation : move; + import core.lifetime : forward; - source[retroIndex(n)] = move(val); + // __ctfe check is workaround for https://issues.dlang.org/show_bug.cgi?id=21542 + source[retroIndex(n)] = __ctfe ? val : forward!val; } } @@ -494,6 +497,32 @@ pure @safe nothrow unittest assert(equal(r, [S(3), S(2), S(1)])); } +// https://issues.dlang.org/show_bug.cgi?id=24481 +@safe unittest +{ + bool called; + struct Handle + { + int entry; + void opAssign()(auto ref const(typeof(this)) that) const { called = true; } + } + + const(Handle)[5] arr = [Handle(0), Handle(1), Handle(2), Handle(3), Handle(4)]; + auto range = arr[].retro(); + + called = false; + range.front = Handle(42); + assert(called); + + called = false; + range.back = Handle(42); + assert(called); + + called = false; + range[2] = Handle(42); + assert(called); +} + /** Iterates range `r` with stride `n`. If the range is a random-access range, moves by indexing into the range; otherwise, @@ -604,9 +633,10 @@ do { @property void front(ElementType!R val) { - import std.algorithm.mutation : move; + import core.lifetime : forward; - source.front = move(val); + // __ctfe check is workaround for https://issues.dlang.org/show_bug.cgi?id=21542 + source.front = __ctfe ? val : forward!val; } } @@ -899,6 +929,24 @@ pure @safe nothrow unittest assert(equal(r, [S(1), S(4)])); } +// https://issues.dlang.org/show_bug.cgi?id=24481 +@safe unittest +{ + bool called; + struct Handle + { + int entry; + void opAssign()(auto ref const(typeof(this)) that) const { called = true; } + } + + const(Handle)[5] arr = [Handle(0), Handle(1), Handle(2), Handle(3), Handle(4)]; + auto range = arr[].stride(2); + + called = false; + range.front = Handle(42); + assert(called); +} + /** Spans multiple ranges in sequence. The function `chain` takes any number of ranges and returns a $(D Chain!(R1, R2,...)) object. The @@ -1120,14 +1168,15 @@ if (Ranges.length > 0 && @property void front(RvalueElementType v) { - import std.algorithm.mutation : move; + import core.lifetime : forward; sw: switch (frontIndex) { static foreach (i; 0 .. R.length) { case i: - source[i].front = move(v); + // __ctfe check is workaround for https://issues.dlang.org/show_bug.cgi?id=21542 + source[i].front = __ctfe ? v : forward!v; break sw; } @@ -1246,14 +1295,15 @@ if (Ranges.length > 0 && { @property void back(RvalueElementType v) { - import std.algorithm.mutation : move; + import core.lifetime : forward; sw: switch (backIndex) { static foreach_reverse (i; 1 .. R.length + 1) { case i: - source[i-1].back = move(v); + // __ctfe check is workaround for https://issues.dlang.org/show_bug.cgi?id=21542 + source[i - 1].back = __ctfe ? v : forward!v; break sw; } @@ -1359,7 +1409,7 @@ if (Ranges.length > 0 && static if (allSameType && allSatisfy!(hasAssignableElements, R)) void opIndexAssign(ElementType v, size_t index) { - import std.algorithm.mutation : move; + import core.lifetime : forward; sw: switch (frontIndex) { @@ -1376,7 +1426,8 @@ if (Ranges.length > 0 && } } - source[i][index] = move(v); + // __ctfe check is workaround for https://issues.dlang.org/show_bug.cgi?id=21542 + source[i][index] = __ctfe ? v : forward!v; break sw; } @@ -1683,7 +1734,7 @@ pure @safe unittest assert(range.array == [S(5), S(6)]); } -/// https://issues.dlang.org/show_bug.cgi?id=24064 +// https://issues.dlang.org/show_bug.cgi?id=24064 pure @safe nothrow unittest { import std.algorithm.comparison : equal; @@ -1716,7 +1767,7 @@ pure @safe nothrow @nogc unittest } } -/// https://issues.dlang.org/show_bug.cgi?id=24243 +// https://issues.dlang.org/show_bug.cgi?id=24243 pure @safe nothrow unittest { import std.algorithm.iteration : filter; @@ -1727,6 +1778,32 @@ pure @safe nothrow unittest assert(typeof(range).init.empty); } +// https://issues.dlang.org/show_bug.cgi?id=24481 +@safe unittest +{ + bool called; + struct Handle + { + int entry; + void opAssign()(auto ref const(typeof(this)) that) const { called = true; } + } + + const(Handle)[5] arr = [Handle(0), Handle(1), Handle(2), Handle(3), Handle(4)]; + auto range = arr[0 .. 2].chain(arr[4 .. 5]); + + called = false; + range.front = Handle(42); + assert(called); + + called = false; + range.back = Handle(42); + assert(called); + + called = false; + range[2] = Handle(42); + assert(called); +} + /** Choose one of two ranges at runtime depending on a Boolean condition. @@ -1882,7 +1959,7 @@ private struct ChooseResult(Ranges...) this(this) { actOnChosen!((ref r) { - static if (hasElaborateCopyConstructor!(typeof(r))) r.__postblit(); + static if (hasElaborateCopyConstructor!(typeof(r))) r.__xpostblit(); })(this); } @@ -2177,6 +2254,29 @@ pure @safe nothrow unittest assert(chosen2.front.v == 4); } +// https://issues.dlang.org/show_bug.cgi?id=15708 +@safe unittest +{ + static struct HasPostblit + { + this(this) {} + } + + static struct Range + { + bool empty; + int front; + void popFront() {} + HasPostblit member; + } + + Range range; + int[] arr; + + auto chosen = choose(true, range, arr); + auto copy = chosen; +} + /** Choose one of multiple ranges at runtime. @@ -2694,12 +2794,14 @@ if (isInputRange!(Unqual!Range) && /// ditto @property void front(ElementType!R v) { - import std.algorithm.mutation : move; + import core.lifetime : forward; assert(!empty, "Attempting to assign to the front of an empty " ~ Take.stringof); - source.front = move(v); + + // __ctfe check is workaround for https://issues.dlang.org/show_bug.cgi?id=21542 + source.front = __ctfe ? v : forward!v; } static if (hasMobileElements!R) @@ -2996,6 +3098,25 @@ pure @safe nothrow @nogc unittest assert(r.take(2).equal(repeat(1, 2))); } +// https://issues.dlang.org/show_bug.cgi?id=24481 +@safe unittest +{ + import std.algorithm.iteration : filter; + + bool called; + struct Handle + { + int entry; + void opAssign()(auto ref const(typeof(this)) that) const { called = true; } + } + + const(Handle)[5] arr = [Handle(0), Handle(1), Handle(2), Handle(3), Handle(4)]; + auto range = arr[].filter!(a => true)().take(3); + + called = false; + range.front = Handle(42); + assert(called); +} /** Similar to $(LREF take), but assumes that `range` has at least $(D @@ -3075,12 +3196,14 @@ if (isInputRange!R) { @property auto ref front(ElementType!R v) { - import std.algorithm.mutation : move; + import core.lifetime : forward; assert(!empty, "Attempting to assign to the front of an empty " ~ typeof(this).stringof); - return _input.front = move(v); + + // __ctfe check is workaround for https://issues.dlang.org/show_bug.cgi?id=21542 + return _input.front = __ctfe ? v : forward!v; } } } @@ -3217,6 +3340,26 @@ pure @safe nothrow unittest }} } +// https://issues.dlang.org/show_bug.cgi?id=24481 +@safe unittest +{ + import std.algorithm.iteration : filter; + + bool called; + struct Handle + { + int entry; + void opAssign()(auto ref const(typeof(this)) that) const { called = true; } + } + + const(Handle)[5] arr = [Handle(0), Handle(1), Handle(2), Handle(3), Handle(4)]; + auto range = arr[].filter!(a => true)().takeExactly(3); + + called = false; + range.front = Handle(42); + assert(called); +} + /** Returns a range with at most one element; for example, $(D takeOne([42, 43, 44])) returns a range consisting of the integer $(D @@ -4310,9 +4453,10 @@ if (isForwardRange!R && !isInfinite!R) /// ditto @property void front(ElementType!R val) { - import std.algorithm.mutation : move; + import core.lifetime : forward; - _original[_index] = move(val); + // __ctfe check is workaround for https://issues.dlang.org/show_bug.cgi?id=21542 + _original[_index] = __ctfe ? val : forward!val; } } @@ -4422,9 +4566,10 @@ if (isForwardRange!R && !isInfinite!R) /// ditto @property auto front(ElementType!R val) { - import std.algorithm.mutation : move; + import core.lifetime : forward; - return _current.front = move(val); + // __ctfe check is workaround for https://issues.dlang.org/show_bug.cgi?id=21542 + return _current.front = __ctfe ? val : forward!val; } } @@ -4767,6 +4912,35 @@ pure @safe unittest assert(equal(r.save, "foof")); } +// https://issues.dlang.org/show_bug.cgi?id=24481 +@safe unittest +{ + import std.algorithm.iteration : filter; + + bool called; + struct Handle + { + int entry; + void opAssign()(auto ref const(typeof(this)) that) const { called = true; } + } + + const(Handle)[3] arr = [Handle(0), Handle(1), Handle(2)]; + { + auto range = arr[].cycle().take(5); + + called = false; + range.front = Handle(42); + assert(called); + } + { + auto range = arr[].filter!(a => true)().cycle().take(5); + + called = false; + range.front = Handle(42); + assert(called); + } +} + private alias lengthType(R) = typeof(R.init.length.init); /** @@ -7438,9 +7612,10 @@ struct FrontTransversal(Ror, { @property void front(ElementType val) { - import std.algorithm.mutation : move; + import core.lifetime : forward; - _input.front.front = move(val); + // __ctfe check is workaround for https://issues.dlang.org/show_bug.cgi?id=21542 + _input.front.front = __ctfe ? val : forward!val; } } @@ -7497,9 +7672,10 @@ struct FrontTransversal(Ror, { @property void back(ElementType val) { - import std.algorithm.mutation : move; + import core.lifetime : forward; - _input.back.front = move(val); + // __ctfe check is workaround for https://issues.dlang.org/show_bug.cgi?id=21542 + _input.back.front = __ctfe ? val : forward!val; } } } @@ -7532,9 +7708,10 @@ struct FrontTransversal(Ror, { void opIndexAssign(ElementType val, size_t n) { - import std.algorithm.mutation : move; + import core.lifetime : forward; - _input[n].front = move(val); + // __ctfe check is workaround for https://issues.dlang.org/show_bug.cgi?id=21542 + _input[n].front = __ctfe ? val : forward!val; } } mixin ImplementLength!_input; @@ -7675,6 +7852,50 @@ pure @safe unittest assert(ft.empty); } +// https://issues.dlang.org/show_bug.cgi?id=24481 +@safe unittest +{ + bool called; + struct Handle + { + int entry; + void opAssign()(auto ref const(typeof(this)) that) const { called = true; } + } + + const(Handle)[][] arr = [[Handle(0), Handle(10)], + [Handle(1), Handle(11)], + [Handle(2), Handle(12)], + [Handle(3), Handle(13)], + [Handle(4), Handle(14)]]; + + { + auto range = arr.frontTransversal(); + + called = false; + range.front = Handle(42); + assert(called == true); + + called = false; + range.back = Handle(42); + assert(called == true); + } + { + auto range = arr.frontTransversal!(TransverseOptions.assumeNotJagged)(); + + called = false; + range.front = Handle(42); + assert(called == true); + + called = false; + range.back = Handle(42); + assert(called == true); + + called = false; + range[0] = Handle(42); + assert(called == true); + } +} + /** Given a range of ranges, iterate transversally through the `n`th element of each of the enclosed ranges. This function @@ -10375,6 +10596,14 @@ private struct OnlyResult(T) } alias opDollar = length; + // FIXME Workaround for https://issues.dlang.org/show_bug.cgi?id=24415 + import std.traits : hasElaborateCopyConstructor; + static if (hasElaborateCopyConstructor!T) + { + private static struct WorkaroundBugzilla24415 {} + public this()(WorkaroundBugzilla24415) {} + } + private this()(return scope auto ref T value) { ref @trusted unqual(ref T x){return cast() x;} diff --git a/libphobos/src/std/socket.d b/libphobos/src/std/socket.d index 4052479..e86a51f 100644 --- a/libphobos/src/std/socket.d +++ b/libphobos/src/std/socket.d @@ -1116,7 +1116,7 @@ Address[] getAddress(scope const(char)[] hostname, ushort port) // test via gethostbyname auto getaddrinfoPointerBackup = getaddrinfoPointer; cast() getaddrinfoPointer = null; - scope(exit) cast() getaddrinfoPointer = getaddrinfoPointerBackup; + scope(exit) () @trusted { cast() getaddrinfoPointer = getaddrinfoPointerBackup; }(); addresses = getAddress("63.105.9.61"); assert(addresses.length && addresses[0].toAddrString() == "63.105.9.61"); @@ -1196,7 +1196,7 @@ Address parseAddress(scope const(char)[] hostaddr, ushort port) // test via inet_addr auto getaddrinfoPointerBackup = getaddrinfoPointer; cast() getaddrinfoPointer = null; - scope(exit) cast() getaddrinfoPointer = getaddrinfoPointerBackup; + scope(exit) () @trusted { cast() getaddrinfoPointer = getaddrinfoPointerBackup; }(); address = parseAddress("63.105.9.61"); assert(address.toAddrString() == "63.105.9.61"); @@ -1698,7 +1698,7 @@ public: // test reverse lookup, via gethostbyaddr auto getnameinfoPointerBackup = getnameinfoPointer; cast() getnameinfoPointer = null; - scope(exit) cast() getnameinfoPointer = getnameinfoPointerBackup; + scope(exit) () @trusted { cast() getnameinfoPointer = getnameinfoPointerBackup; }(); assert(ia.toHostNameString() == "digitalmars.com"); } @@ -1716,7 +1716,7 @@ public: // test failing reverse lookup, via gethostbyaddr auto getnameinfoPointerBackup = getnameinfoPointer; cast() getnameinfoPointer = null; - scope(exit) cast() getnameinfoPointer = getnameinfoPointerBackup; + scope(exit) () @trusted { cast() getnameinfoPointer = getnameinfoPointerBackup; }(); assert(ia.toHostNameString() is null); } @@ -1925,7 +1925,7 @@ version (StdDdoc) * auto abstractAddr = new UnixAddress("\0/tmp/dbus-OtHLWmCLPR"); * --- * - * See_Also: $(HTTP http://man7.org/linux/man-pages/man7/unix.7.html, UNIX(7)) + * See_Also: $(HTTP man7.org/linux/man-pages/man7/unix.7.html, UNIX(7)) */ class UnixAddress: Address { diff --git a/libphobos/src/std/sumtype.d b/libphobos/src/std/sumtype.d index 4e76156..80ce73d 100644 --- a/libphobos/src/std/sumtype.d +++ b/libphobos/src/std/sumtype.d @@ -1988,7 +1988,7 @@ private template matchImpl(Flag!"exhaustive" exhaustive, handlers...) ? "template" : typeof(handler).stringof ) ~ "` " ~ - "never matches" + "never matches. Perhaps the handler failed to compile" ); } diff --git a/libphobos/src/std/traits.d b/libphobos/src/std/traits.d index 2e7a4f6..5ed37a1 100644 --- a/libphobos/src/std/traits.d +++ b/libphobos/src/std/traits.d @@ -2181,7 +2181,7 @@ if (isCallable!func) /** -Get the function type from a callable object `func`. +Get the function type from a callable object `func`, or from a function pointer/delegate type. Using builtin `typeof` on a property function yields the types of the property value, not of the property function itself. Still, @@ -2229,10 +2229,17 @@ if (isCallable!func) { class C { - int value() @property { return 0; } + int value() @property => 0; + static string opCall() => "hi"; } static assert(is( typeof(C.value) == int )); static assert(is( FunctionTypeOf!(C.value) == function )); + static assert(is( FunctionTypeOf!C == typeof(C.opCall) )); + + int function() fp; + alias IntFn = int(); + static assert(is( typeof(fp) == IntFn* )); + static assert(is( FunctionTypeOf!fp == IntFn )); } @system unittest diff --git a/libphobos/src/std/typecons.d b/libphobos/src/std/typecons.d index 460cd42..f5b4846 100644 --- a/libphobos/src/std/typecons.d +++ b/libphobos/src/std/typecons.d @@ -980,7 +980,7 @@ if (distinctFieldNames!(Specs)) { import std.algorithm.mutation : swap; - static if (is(R : Tuple!Types) && !__traits(isRef, rhs) && isTuple!R) + static if (is(R == Tuple!Types) && !__traits(isRef, rhs) && isTuple!R) { if (__ctfe) { diff --git a/libphobos/src/std/utf.d b/libphobos/src/std/utf.d index 3eef5cb..c0cd386 100644 --- a/libphobos/src/std/utf.d +++ b/libphobos/src/std/utf.d @@ -328,7 +328,7 @@ Returns: bool isValidCodepoint(Char)(Char c) if (isSomeChar!Char) { - alias UChar = Unqual!Char; + alias UChar = typeof(cast() c); static if (is(UChar == char)) { return c <= 0x7F; @@ -1418,8 +1418,8 @@ do } else { - alias Char = Unqual!(ElementType!S); - Char[4] codeUnits; + alias Char = typeof(cast() ElementType!S.init); + Char[4] codeUnits = void; S tmp = str.save; for (size_t i = numCodeUnits; i > 0; ) { @@ -2821,7 +2821,7 @@ if (isSomeChar!C) size_t codeLength(C, InputRange)(InputRange input) if (isSomeFiniteCharInputRange!InputRange) { - alias EncType = Unqual!(ElementEncodingType!InputRange); + alias EncType = typeof(cast() ElementEncodingType!InputRange.init); static if (isSomeString!InputRange && is(EncType == C) && is(typeof(input.length))) return input.length; else @@ -3089,7 +3089,8 @@ private T toUTFImpl(T, S)(scope S s) static if (is(S == C[], C) || hasLength!S) app.reserve(s.length); - foreach (c; s.byUTF!(Unqual!(ElementEncodingType!T))) + ElementEncodingType!T e = void; + foreach (c; s.byUTF!(typeof(cast() ElementEncodingType!T.init))) app.put(c); return app.data; @@ -3168,10 +3169,10 @@ if (is(immutable typeof(*P.init) == typeof(str[0]))) return trustedPtr(); } - alias C = Unqual!(ElementEncodingType!S); + alias C = typeof(cast() ElementEncodingType!S.init); //If the P is mutable, then we have to make a copy. - static if (is(Unqual!(typeof(*P.init)) == typeof(*P.init))) + static if (is(typeof(cast() *P.init) == typeof(*P.init))) { return toUTFzImpl!(P, const(C)[])(cast(const(C)[])str); } @@ -3203,13 +3204,15 @@ private P toUTFzImpl(P, S)(return scope S str) @safe pure if (is(typeof(str[0]) C) && is(immutable typeof(*P.init) == immutable C) && !is(C == immutable)) //C[] or const(C)[] -> C*, const(C)*, or immutable(C)* { - alias InChar = typeof(str[0]); - alias OutChar = typeof(*P.init); + alias InChar = typeof(str[0]); + alias UInChar = typeof(cast() str[0]); // unqualified version of InChar + alias OutChar = typeof(*P.init); + alias UOutChar = typeof(cast() *P.init); // unqualified version //const(C)[] -> const(C)* or //C[] -> C* or const(C)* - static if (( is(const(Unqual!InChar) == InChar) && is(const(Unqual!OutChar) == OutChar)) || - (!is(const(Unqual!InChar) == InChar) && !is(immutable(Unqual!OutChar) == OutChar))) + static if (( is(const(UInChar) == InChar) && is( const(UOutChar) == OutChar)) || + (!is(const(UInChar) == InChar) && !is(immutable(UOutChar) == OutChar))) { if (!__ctfe) { @@ -3228,7 +3231,7 @@ if (is(typeof(str[0]) C) && is(immutable typeof(*P.init) == immutable C) && !is( else { import std.array : uninitializedArray; - auto copy = uninitializedArray!(Unqual!OutChar[])(str.length + 1); + auto copy = uninitializedArray!(UOutChar[])(str.length + 1); copy[0 .. $ - 1] = str[]; copy[$ - 1] = '\0'; diff --git a/libphobos/src/std/uuid.d b/libphobos/src/std/uuid.d index dec2a1c..b8cac6e 100644 --- a/libphobos/src/std/uuid.d +++ b/libphobos/src/std/uuid.d @@ -1207,7 +1207,7 @@ public struct UUID * randomGen = uniform RNG * See_Also: $(REF isUniformRNG, std,random) */ -@safe UUID randomUUID() +@nogc nothrow @safe UUID randomUUID() { import std.random : rndGen; // A PRNG with fewer than `n` bytes of state cannot produce diff --git a/libphobos/src/std/variant.d b/libphobos/src/std/variant.d index 41cd484..f7832104 100644 --- a/libphobos/src/std/variant.d +++ b/libphobos/src/std/variant.d @@ -382,7 +382,7 @@ private: static if (isStaticArray!A && isDynamicArray!T) { auto this_ = (*src)[]; - emplaceRef(*cast(Unqual!T*) zat, cast(Unqual!T) this_); + emplaceRef(*cast(Unqual!T*) zat, cast() cast(T) this_); } else { diff --git a/libphobos/testsuite/libphobos.exceptions/invalid_memory_operation.d b/libphobos/testsuite/libphobos.exceptions/invalid_memory_operation.d index 79660e9..7763f0a 100644 --- a/libphobos/testsuite/libphobos.exceptions/invalid_memory_operation.d +++ b/libphobos/testsuite/libphobos.exceptions/invalid_memory_operation.d @@ -10,5 +10,6 @@ struct S void main() { - new S; + foreach(i; 0 .. 100) + new S; } |