aboutsummaryrefslogtreecommitdiff
path: root/libphobos
diff options
context:
space:
mode:
Diffstat (limited to 'libphobos')
-rw-r--r--libphobos/ChangeLog98
-rw-r--r--libphobos/Makefile.in1
-rwxr-xr-xlibphobos/configure53
-rw-r--r--libphobos/configure.ac1
-rw-r--r--libphobos/configure.tgt4
-rw-r--r--libphobos/libdruntime/MERGE2
-rw-r--r--libphobos/libdruntime/Makefile.am7
-rw-r--r--libphobos/libdruntime/Makefile.in12
-rw-r--r--libphobos/libdruntime/__importc_builtins.di (renamed from libphobos/libdruntime/__builtins.di)10
-rw-r--r--libphobos/libdruntime/core/stdcpp/xutility.d1
-rw-r--r--libphobos/libdruntime/rt/invariant_.d (renamed from libphobos/libdruntime/rt/invariant.d)9
-rw-r--r--libphobos/m4/druntime/os.m427
-rw-r--r--libphobos/src/MERGE2
-rw-r--r--libphobos/src/Makefile.am20
-rw-r--r--libphobos/src/Makefile.in23
-rw-r--r--libphobos/src/std/experimental/allocator/building_blocks/allocator_list.d18
-rw-r--r--libphobos/src/std/experimental/allocator/common.d3
-rw-r--r--libphobos/src/std/file.d4
-rw-r--r--libphobos/src/std/format/spec.d35
-rw-r--r--libphobos/src/std/format/write.d32
-rw-r--r--libphobos/src/std/getopt.d73
-rw-r--r--libphobos/src/std/internal/windows/bcrypt.d65
-rw-r--r--libphobos/src/std/json.d44
-rw-r--r--libphobos/src/std/numeric.d2
-rw-r--r--libphobos/src/std/random.d84
-rw-r--r--libphobos/testsuite/Makefile.in1
-rw-r--r--libphobos/testsuite/lib/libphobos-dg.exp1
-rwxr-xr-xlibphobos/testsuite/testsuite_flags.in2
28 files changed, 483 insertions, 151 deletions
diff --git a/libphobos/ChangeLog b/libphobos/ChangeLog
index 872d059..dbc769f 100644
--- a/libphobos/ChangeLog
+++ b/libphobos/ChangeLog
@@ -1,3 +1,101 @@
+2025-07-01 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
+
+ * configure.tgt <i?86-*-darwin1[2-7]>: Also consider minor
+ versions supported.
+
+2025-05-09 David Malcolm <dmalcolm@redhat.com>
+
+ PR other/116792
+ * testsuite/lib/libphobos-dg.exp: Add load_lib of scanhtml.exp.
+
+2025-05-06 Sam James <sam@gentoo.org>
+
+ * configure.tgt: Add sparc64-unknown-linux-gnu as a supported target.
+
+2025-04-12 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/119761
+ * libdruntime/MERGE: Merge upstream druntime 09ed02ce56.
+ * libdruntime/Makefile.am (DRUNTIME_DISOURCES): Rename __builtins.di
+ to __importc_builtins.di.
+ * libdruntime/Makefile.in: Regenerate.
+ * libdruntime/__builtins.di: Move to...
+ * libdruntime/__importc_builtins.di: ...here.
+
+2025-04-11 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * src/MERGE: Merge upstream phobos 40ffbb364.
+ * Makefile.in: Regenerate.
+ * configure: Regenerate.
+ * configure.ac: Call DRUNTIME_OS_FEATURES.
+ * libdruntime/Makefile.am (AM_DFLAGS): Add OS_DFLAGS.
+ * libdruntime/Makefile.in: Regenerate.
+ * m4/druntime/os.m4 (DRUNTIME_OS_FEATURES): Define.
+ * src/Makefile.am: Add OS_DFLAGS.
+ * src/Makefile.in: Regenerate.
+ * testsuite/Makefile.in: Regenerate.
+ * testsuite/testsuite_flags.in: Add OS_DFLAGS.
+
+2025-04-08 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * src/MERGE: Merge upstream phobos 35977c802.
+ * src/Makefile.am (PHOBOS_DSOURCES): Add
+ std/internal/windows/bcrypt.d.
+ * src/Makefile.in: Regenerate.
+
+2025-03-31 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * libdruntime/MERGE: Merge upstream druntime c6863be720.
+ * src/MERGE: Merge upstream phobos 60034b56e.
+
+2025-03-22 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * libdruntime/MERGE: Merge upstream druntime 94950cae58.
+
+2025-03-22 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * libdruntime/Makefile.am (DRUNTIME_DSOURCES): Rename rt/invariant.d
+ to rt/invariant_.d.
+ * libdruntime/Makefile.in: Regenerate.
+ * libdruntime/rt/invariant.d: Move to...
+ * libdruntime/rt/invariant_.d: ...here.
+
+2025-03-22 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * src/MERGE: Merge upstream phobos d4c9efef1.
+
+2025-03-18 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * src/MERGE: Merge upstream phobos 79cbde1ab.
+
+2025-03-18 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * src/MERGE: Merge upstream phobos cafe86453.
+
+2025-03-18 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ * libdruntime/MERGE: Merge upstream druntime d2ee11364c.
+ * testsuite/libphobos.aa/test_aa.d: Add new test.
+ * testsuite/libphobos.betterc/test19933.d: Adjust imports.
+ * testsuite/libphobos.config/test22523.d: Likewise.
+ * testsuite/libphobos.exceptions/assert_fail.d: Adjust test.
+ * testsuite/libphobos.exceptions/chain.d: Adjust imports.
+ * testsuite/libphobos.exceptions/future_message.d: Likewise.
+ * testsuite/libphobos.exceptions/line_trace.d: Likewise.
+ * testsuite/libphobos.exceptions/long_backtrace_trunc.d: Likewise.
+ * testsuite/libphobos.exceptions/static_dtor.d: Likewise.
+ * testsuite/libphobos.gc/forkgc.d: Likewise.
+ * testsuite/libphobos.gc/precisegc.d: Likewise.
+ * testsuite/libphobos.gc/recoverfree.d: Likewise.
+ * testsuite/libphobos.hash/test_hash.d: Likewise.
+ * testsuite/libphobos.init_fini/custom_gc.d: Likewise.
+ * testsuite/libphobos.init_fini/thread_join.d: Likewise.
+ * testsuite/libphobos.thread/external_threads.d: Likewise.
+ * testsuite/libphobos.thread/fiber_guard_page.d: Likewise.
+ * testsuite/libphobos.thread/tlsgc_sections.d: Likewise.
+ * testsuite/libphobos.thread/tlsstack.d: Likewise.
+ * testsuite/libphobos.unittest/customhandler.d: Likewise.
+
2025-03-17 Iain Buclaw <ibuclaw@gdcproject.org>
* src/Makefile.am (PHOBOS_DSOURCES): Add etc/c/odbc/odbc32.d,
diff --git a/libphobos/Makefile.in b/libphobos/Makefile.in
index 162e83b..cd64fd5 100644
--- a/libphobos/Makefile.in
+++ b/libphobos/Makefile.in
@@ -258,6 +258,7 @@ NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OS_DFLAGS = @OS_DFLAGS@
OS_LINK_SPEC = @OS_LINK_SPEC@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
diff --git a/libphobos/configure b/libphobos/configure
index df48a6b..4f5be7d 100755
--- a/libphobos/configure
+++ b/libphobos/configure
@@ -655,6 +655,7 @@ DCFG_HAVE_LIBATOMIC
DCFG_HAVE_64BIT_ATOMICS
DCFG_HAVE_ATOMIC_BUILTINS
DCFG_HAVE_QSORT_R
+OS_DFLAGS
OS_LINK_SPEC
DCFG_DLPI_TLS_MODID
DRUNTIME_OS_MINFO_BRACKETING_FALSE
@@ -11863,7 +11864,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11866 "configure"
+#line 11867 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11969,7 +11970,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11972 "configure"
+#line 11973 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -14717,6 +14718,54 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ OS_DFLAGS=
+
+ case "$druntime_cv_target_os" in
+ linux*) druntime_target_os_parsed="linux"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getrandom" >&5
+$as_echo_n "checking for getrandom... " >&6; }
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/syscall.h>
+#include <unistd.h>
+int
+main ()
+{
+
+ syscall (__NR_getrandom);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ OS_DFLAGS=-fversion=linux_legacy_emulate_getrandom
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ ;;
+ esac
+
+
+
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
diff --git a/libphobos/configure.ac b/libphobos/configure.ac
index 3b2ec2c..406373b 100644
--- a/libphobos/configure.ac
+++ b/libphobos/configure.ac
@@ -143,6 +143,7 @@ DRUNTIME_OS_ARM_EABI_UNWINDER
DRUNTIME_OS_MINFO_BRACKETING
DRUNTIME_OS_DLPI_TLS_MODID
DRUNTIME_OS_LINK_SPEC
+DRUNTIME_OS_FEATURES
DRUNTIME_LIBRARIES_CLIB
WITH_LOCAL_DRUNTIME([
diff --git a/libphobos/configure.tgt b/libphobos/configure.tgt
index b32300b..fb67183 100644
--- a/libphobos/configure.tgt
+++ b/libphobos/configure.tgt
@@ -58,13 +58,13 @@ case "${target}" in
s390*-linux*)
LIBPHOBOS_SUPPORTED=yes
;;
- sparc*-*-solaris2.11*)
+ sparc64-*-linux* | sparc*-*-solaris2.11*)
LIBPHOBOS_SUPPORTED=yes
;;
*-*-darwin9* | *-*-darwin1[01]*)
LIBDRUNTIME_ONLY=yes
;;
- x86_64-*-darwin1[2-9]* | x86_64-*-darwin2* | i?86-*-darwin1[2-7])
+ x86_64-*-darwin1[2-9]* | x86_64-*-darwin2* | i?86-*-darwin1[2-7]*)
LIBPHOBOS_SUPPORTED=yes
;;
x86_64-*-freebsd* | i?86-*-freebsd*)
diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE
index 18c9d11..840f8dd 100644
--- a/libphobos/libdruntime/MERGE
+++ b/libphobos/libdruntime/MERGE
@@ -1,4 +1,4 @@
-d2ee11364c25ca8865eb0acb9596a6147532ef41
+09ed02ce56ea5bf3e59f21ee0390cd85eb8bfaa7
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 595e3f9..4098310 100644
--- a/libphobos/libdruntime/Makefile.am
+++ b/libphobos/libdruntime/Makefile.am
@@ -25,7 +25,8 @@ D_EXTRA_DFLAGS=-fpreview=dip1000 -fpreview=fieldwise -fpreview=dtorfields \
# D flags for compilation
AM_DFLAGS= \
$(phobos_lt_pic_flag) $(phobos_compiler_shared_flag) \
- $(WARN_DFLAGS) $(CHECKING_DFLAGS) $(SECTION_FLAGS) $(CET_FLAGS)
+ $(WARN_DFLAGS) $(CHECKING_DFLAGS) $(SECTION_FLAGS) $(CET_FLAGS) \
+ $(OS_DFLAGS)
# Flags for other kinds of sources
AM_CFLAGS=$(CET_FLAGS)
@@ -222,7 +223,7 @@ DRUNTIME_DSOURCES = core/atomic.d core/attribute.d core/bitop.d \
gcc/unwind/generic.d gcc/unwind/package.d gcc/unwind/pe.d object.d \
rt/aApply.d rt/aApplyR.d rt/aaA.d rt/adi.d rt/arraycat.d rt/cast_.d \
rt/config.d rt/critical_.d rt/deh.d rt/dmain2.d rt/ehalloc.d \
- rt/invariant.d rt/lifetime.d rt/memory.d rt/minfo.d rt/monitor_.d \
+ rt/invariant_.d rt/lifetime.d rt/memory.d rt/minfo.d rt/monitor_.d \
rt/profilegc.d rt/sections.d rt/tlsgc.d rt/util/typeinfo.d \
rt/util/utility.d
@@ -444,4 +445,4 @@ DRUNTIME_DSOURCES_WINDOWS = core/sys/windows/accctrl.d \
core/sys/windows/winuser.d core/sys/windows/winver.d \
core/sys/windows/wtsapi32.d core/sys/windows/wtypes.d
-DRUNTIME_DISOURCES = __builtins.di __main.di
+DRUNTIME_DISOURCES = __importc_builtins.di __main.di
diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in
index 4832fd1..1c0fa54 100644
--- a/libphobos/libdruntime/Makefile.in
+++ b/libphobos/libdruntime/Makefile.in
@@ -248,7 +248,7 @@ am__objects_1 = core/atomic.lo core/attribute.lo core/bitop.lo \
gcc/unwind/generic.lo gcc/unwind/package.lo gcc/unwind/pe.lo \
object.lo rt/aApply.lo rt/aApplyR.lo rt/aaA.lo rt/adi.lo \
rt/arraycat.lo rt/cast_.lo rt/config.lo rt/critical_.lo \
- rt/deh.lo rt/dmain2.lo rt/ehalloc.lo rt/invariant.lo \
+ rt/deh.lo rt/dmain2.lo rt/ehalloc.lo rt/invariant_.lo \
rt/lifetime.lo rt/memory.lo rt/minfo.lo rt/monitor_.lo \
rt/profilegc.lo rt/sections.lo rt/tlsgc.lo rt/util/typeinfo.lo \
rt/util/utility.lo
@@ -676,6 +676,7 @@ NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OS_DFLAGS = @OS_DFLAGS@
OS_LINK_SPEC = @OS_LINK_SPEC@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
@@ -783,7 +784,8 @@ D_EXTRA_DFLAGS = -fpreview=dip1000 -fpreview=fieldwise -fpreview=dtorfields \
# D flags for compilation
AM_DFLAGS = \
$(phobos_lt_pic_flag) $(phobos_compiler_shared_flag) \
- $(WARN_DFLAGS) $(CHECKING_DFLAGS) $(SECTION_FLAGS) $(CET_FLAGS)
+ $(WARN_DFLAGS) $(CHECKING_DFLAGS) $(SECTION_FLAGS) $(CET_FLAGS) \
+ $(OS_DFLAGS)
# Flags for other kinds of sources
@@ -903,7 +905,7 @@ DRUNTIME_DSOURCES = core/atomic.d core/attribute.d core/bitop.d \
gcc/unwind/generic.d gcc/unwind/package.d gcc/unwind/pe.d object.d \
rt/aApply.d rt/aApplyR.d rt/aaA.d rt/adi.d rt/arraycat.d rt/cast_.d \
rt/config.d rt/critical_.d rt/deh.d rt/dmain2.d rt/ehalloc.d \
- rt/invariant.d rt/lifetime.d rt/memory.d rt/minfo.d rt/monitor_.d \
+ rt/invariant_.d rt/lifetime.d rt/memory.d rt/minfo.d rt/monitor_.d \
rt/profilegc.d rt/sections.d rt/tlsgc.d rt/util/typeinfo.d \
rt/util/utility.d
@@ -1124,7 +1126,7 @@ DRUNTIME_DSOURCES_WINDOWS = core/sys/windows/accctrl.d \
core/sys/windows/winuser.d core/sys/windows/winver.d \
core/sys/windows/wtsapi32.d core/sys/windows/wtypes.d
-DRUNTIME_DISOURCES = __builtins.di __main.di
+DRUNTIME_DISOURCES = __importc_builtins.di __main.di
all: all-am
.SUFFIXES:
@@ -1413,7 +1415,7 @@ rt/critical_.lo: rt/$(am__dirstamp)
rt/deh.lo: rt/$(am__dirstamp)
rt/dmain2.lo: rt/$(am__dirstamp)
rt/ehalloc.lo: rt/$(am__dirstamp)
-rt/invariant.lo: rt/$(am__dirstamp)
+rt/invariant_.lo: rt/$(am__dirstamp)
rt/lifetime.lo: rt/$(am__dirstamp)
rt/memory.lo: rt/$(am__dirstamp)
rt/minfo.lo: rt/$(am__dirstamp)
diff --git a/libphobos/libdruntime/__builtins.di b/libphobos/libdruntime/__importc_builtins.di
index b4fef09..9493962 100644
--- a/libphobos/libdruntime/__builtins.di
+++ b/libphobos/libdruntime/__importc_builtins.di
@@ -3,10 +3,10 @@
* The purpose is to make it unnecessary to hardwire them into the compiler.
* As the leading double underscore suggests, this is for internal use only.
*
- * Copyright: Copyright Digital Mars 2022
+ * Copyright: Copyright D Language Foundation 2022-2025
* License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
* Authors: Walter Bright
- * Source: $(DRUNTIMESRC __builtins.d)
+ * Source: $(DRUNTIMESRC __importc_builtins.di)
*/
@@ -86,6 +86,12 @@ version (DigitalMars)
return core.bitop.bswap(value);
}
+ uint __builtin__popcount()(ulong value)
+ {
+ import core.bitop;
+ return core.bitop._popcnt(value);
+ }
+
// Lazily imported on first use
private alias c_long = imported!"core.stdc.config".c_long;
diff --git a/libphobos/libdruntime/core/stdcpp/xutility.d b/libphobos/libdruntime/core/stdcpp/xutility.d
index 5e2e711..f93df68 100644
--- a/libphobos/libdruntime/core/stdcpp/xutility.d
+++ b/libphobos/libdruntime/core/stdcpp/xutility.d
@@ -35,6 +35,7 @@ enum CppStdRevision : uint
cpp14 = 201402,
cpp17 = 201703,
cpp20 = 202002,
+ cpp23 = 202302,
}
/**
diff --git a/libphobos/libdruntime/rt/invariant.d b/libphobos/libdruntime/rt/invariant_.d
index e536196..2a64dc8 100644
--- a/libphobos/libdruntime/rt/invariant.d
+++ b/libphobos/libdruntime/rt/invariant_.d
@@ -4,15 +4,10 @@
* Copyright: Copyright Digital Mars 2007 - 2010.
* License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
* Authors: Walter Bright
- * Source: $(DRUNTIMESRC rt/_invariant.d)
- */
-
-/* Copyright Digital Mars 2007 - 2010.
- * Distributed under the Boost Software License, Version 1.0.
- * (See accompanying file LICENSE or copy at
- * http://www.boost.org/LICENSE_1_0.txt)
+ * Source: $(DRUNTIMESRC rt/_invariant_.d)
*/
+module rt.invariant_;
/**
*
diff --git a/libphobos/m4/druntime/os.m4 b/libphobos/m4/druntime/os.m4
index 15cde3b..ef8ca43 100644
--- a/libphobos/m4/druntime/os.m4
+++ b/libphobos/m4/druntime/os.m4
@@ -121,6 +121,33 @@ AC_DEFUN([DRUNTIME_OS_SOURCES],
])
+# DRUNTIME_OS_FEATURES
+# -----------------------
+# Perform various feature checks on the target platform.
+AC_DEFUN([DRUNTIME_OS_FEATURES],
+[
+ AC_REQUIRE([DRUNTIME_OS_DETECT])
+ OS_DFLAGS=
+
+ case "$druntime_cv_target_os" in
+ linux*) druntime_target_os_parsed="linux"
+ AC_MSG_CHECKING([for getrandom])
+ AC_LANG_PUSH([C])
+ AC_TRY_COMPILE([#include <sys/syscall.h>
+#include <unistd.h>],[
+ syscall (__NR_getrandom);
+ ],
+ [AC_MSG_RESULT([yes])],
+ [AC_MSG_RESULT([no])
+ OS_DFLAGS=-fversion=linux_legacy_emulate_getrandom])
+ AC_LANG_POP([C])
+ ;;
+ esac
+
+ AC_SUBST(OS_DFLAGS)
+])
+
+
# DRUNTIME_OS_ARM_EABI_UNWINDER
# ------------------------
# Check if using ARM unwinder and substitute DCFG_ARM_EABI_UNWINDER
diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE
index a5a685d..a28116a 100644
--- a/libphobos/src/MERGE
+++ b/libphobos/src/MERGE
@@ -1,4 +1,4 @@
-0faae92d62bdc1cc1982f0e9c65830ece1677289
+40ffbb3641495b02815891ee004d4c6e173b1089
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/Makefile.am b/libphobos/src/Makefile.am
index 94e28f3..a84fc4d 100644
--- a/libphobos/src/Makefile.am
+++ b/libphobos/src/Makefile.am
@@ -26,7 +26,8 @@ D_EXTRA_DFLAGS=-fpreview=dip1000 -fpreview=dtorfields -fpreview=fieldwise \
# D flags for compilation
AM_DFLAGS= \
$(phobos_lt_pic_flag) $(phobos_compiler_shared_flag) \
- $(WARN_DFLAGS) $(CHECKING_DFLAGS) $(SECTION_FLAGS) $(CET_FLAGS)
+ $(WARN_DFLAGS) $(CHECKING_DFLAGS) $(SECTION_FLAGS) $(CET_FLAGS) \
+ $(OS_DFLAGS)
# Flags for other kinds of sources
AM_CFLAGS=$(CET_FLAGS)
@@ -144,14 +145,15 @@ PHOBOS_DSOURCES = etc/c/curl.d etc/c/odbc/odbc32.d etc/c/odbc/odbc64.d \
std/internal/unicode_comp.d std/internal/unicode_decomp.d \
std/internal/unicode_grapheme.d std/internal/unicode_norm.d \
std/internal/unicode_tables.d std/internal/windows/advapi32.d \
- std/json.d std/logger/core.d std/logger/filelogger.d \
- std/logger/multilogger.d std/logger/nulllogger.d std/logger/package.d \
- std/math/algebraic.d std/math/constants.d std/math/exponential.d \
- std/math/hardware.d std/math/operations.d std/math/package.d \
- std/math/remainder.d std/math/rounding.d std/math/traits.d \
- std/math/trigonometry.d std/mathspecial.d std/meta.d std/mmfile.d \
- std/net/curl.d std/net/isemail.d std/numeric.d std/outbuffer.d \
- std/package.d std/parallelism.d std/path.d std/process.d std/random.d \
+ std/internal/windows/bcrypt.d std/json.d std/logger/core.d \
+ std/logger/filelogger.d std/logger/multilogger.d \
+ std/logger/nulllogger.d std/logger/package.d std/math/algebraic.d \
+ std/math/constants.d std/math/exponential.d std/math/hardware.d \
+ std/math/operations.d std/math/package.d std/math/remainder.d \
+ std/math/rounding.d std/math/traits.d std/math/trigonometry.d \
+ std/mathspecial.d std/meta.d std/mmfile.d std/net/curl.d \
+ std/net/isemail.d std/numeric.d std/outbuffer.d std/package.d \
+ std/parallelism.d std/path.d std/process.d std/random.d \
std/range/interfaces.d std/range/package.d std/range/primitives.d \
std/regex/internal/backtracking.d std/regex/internal/generator.d \
std/regex/internal/ir.d std/regex/internal/kickstart.d \
diff --git a/libphobos/src/Makefile.in b/libphobos/src/Makefile.in
index d052aa8..64cc9c3 100644
--- a/libphobos/src/Makefile.in
+++ b/libphobos/src/Makefile.in
@@ -252,6 +252,7 @@ am__dirstamp = $(am__leading_dot)dirstamp
@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/internal/unicode_norm.lo \
@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/internal/unicode_tables.lo \
@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/internal/windows/advapi32.lo \
+@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/internal/windows/bcrypt.lo \
@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/json.lo std/logger/core.lo \
@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/logger/filelogger.lo \
@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/logger/multilogger.lo \
@@ -410,6 +411,7 @@ NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OS_DFLAGS = @OS_DFLAGS@
OS_LINK_SPEC = @OS_LINK_SPEC@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
@@ -518,7 +520,8 @@ D_EXTRA_DFLAGS = -fpreview=dip1000 -fpreview=dtorfields -fpreview=fieldwise \
# D flags for compilation
AM_DFLAGS = \
$(phobos_lt_pic_flag) $(phobos_compiler_shared_flag) \
- $(WARN_DFLAGS) $(CHECKING_DFLAGS) $(SECTION_FLAGS) $(CET_FLAGS)
+ $(WARN_DFLAGS) $(CHECKING_DFLAGS) $(SECTION_FLAGS) $(CET_FLAGS) \
+ $(OS_DFLAGS)
# Flags for other kinds of sources
@@ -612,14 +615,15 @@ libgphobos_la_LINK = $(LIBTOOL) --tag=D $(libgphobos_la_LIBTOOLFLAGS) \
@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/internal/unicode_comp.d std/internal/unicode_decomp.d \
@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/internal/unicode_grapheme.d std/internal/unicode_norm.d \
@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/internal/unicode_tables.d std/internal/windows/advapi32.d \
-@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/json.d std/logger/core.d std/logger/filelogger.d \
-@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/logger/multilogger.d std/logger/nulllogger.d std/logger/package.d \
-@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/math/algebraic.d std/math/constants.d std/math/exponential.d \
-@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/math/hardware.d std/math/operations.d std/math/package.d \
-@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/math/remainder.d std/math/rounding.d std/math/traits.d \
-@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/math/trigonometry.d std/mathspecial.d std/meta.d std/mmfile.d \
-@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/net/curl.d std/net/isemail.d std/numeric.d std/outbuffer.d \
-@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/package.d std/parallelism.d std/path.d std/process.d std/random.d \
+@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/internal/windows/bcrypt.d std/json.d std/logger/core.d \
+@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/logger/filelogger.d std/logger/multilogger.d \
+@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/logger/nulllogger.d std/logger/package.d std/math/algebraic.d \
+@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/math/constants.d std/math/exponential.d std/math/hardware.d \
+@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/math/operations.d std/math/package.d std/math/remainder.d \
+@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/math/rounding.d std/math/traits.d std/math/trigonometry.d \
+@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/mathspecial.d std/meta.d std/mmfile.d std/net/curl.d \
+@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/net/isemail.d std/numeric.d std/outbuffer.d std/package.d \
+@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/parallelism.d std/path.d std/process.d std/random.d \
@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/range/interfaces.d std/range/package.d std/range/primitives.d \
@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/regex/internal/backtracking.d std/regex/internal/generator.d \
@ENABLE_LIBDRUNTIME_ONLY_FALSE@ std/regex/internal/ir.d std/regex/internal/kickstart.d \
@@ -901,6 +905,7 @@ std/internal/windows/$(am__dirstamp):
@: > std/internal/windows/$(am__dirstamp)
std/internal/windows/advapi32.lo: \
std/internal/windows/$(am__dirstamp)
+std/internal/windows/bcrypt.lo: std/internal/windows/$(am__dirstamp)
std/json.lo: std/$(am__dirstamp)
std/logger/$(am__dirstamp):
@$(MKDIR_P) std/logger
diff --git a/libphobos/src/std/experimental/allocator/building_blocks/allocator_list.d b/libphobos/src/std/experimental/allocator/building_blocks/allocator_list.d
index c6d5fca..9d30b5e 100644
--- a/libphobos/src/std/experimental/allocator/building_blocks/allocator_list.d
+++ b/libphobos/src/std/experimental/allocator/building_blocks/allocator_list.d
@@ -1140,7 +1140,6 @@ template SharedAllocatorList(alias factoryFunction,
import std.algorithm.comparison : max;
import std.typecons : Ternary;
- enum pageSize = 4096;
enum numPages = 2;
static void testrw(void[] b)
@@ -1269,8 +1268,6 @@ template SharedAllocatorList(alias factoryFunction,
import std.algorithm.comparison : max;
import std.typecons : Ternary;
- enum pageSize = 4096;
-
static void testrw(void[] b)
{
ubyte* buf = cast(ubyte*) b.ptr;
@@ -1283,17 +1280,17 @@ template SharedAllocatorList(alias factoryFunction,
enum numPages = 5;
AllocatorList!((n) => AscendingPageAllocator(max(n, numPages * pageSize)), NullAllocator) a;
- auto b = a.alignedAllocate(1, pageSize * 2);
+ auto b = a.alignedAllocate(1, cast(uint) (pageSize * 2));
assert(b.length == 1);
- assert(a.expand(b, 4095));
- assert(b.ptr.alignedAt(2 * 4096));
- assert(b.length == 4096);
+ assert(a.expand(b, pageSize - 1));
+ assert(b.ptr.alignedAt(cast(uint) (pageSize * 2)));
+ assert(b.length == pageSize);
- b = a.allocate(4096);
- assert(b.length == 4096);
+ b = a.allocate(pageSize);
+ assert(b.length == pageSize);
assert(a.allocators.length == 1);
- assert(a.allocate(4096 * 5).length == 4096 * 5);
+ assert(a.allocate(pageSize * 5).length == pageSize * 5);
assert(a.allocators.length == 2);
assert(a.deallocateAll());
@@ -1339,7 +1336,6 @@ template SharedAllocatorList(alias factoryFunction,
import std.algorithm.comparison : max;
enum numThreads = 100;
- enum pageSize = 4096;
enum numPages = 10;
SharedAllocatorList!((n) => SharedAscendingPageAllocator(max(n, pageSize * numPages)), Mallocator) a;
diff --git a/libphobos/src/std/experimental/allocator/common.d b/libphobos/src/std/experimental/allocator/common.d
index b06fb62..2451572 100644
--- a/libphobos/src/std/experimental/allocator/common.d
+++ b/libphobos/src/std/experimental/allocator/common.d
@@ -63,7 +63,8 @@ unittest
class C2 { char c; }
static assert(stateSize!C2 == 4 * size_t.sizeof);
static class C3 { char c; }
- static assert(stateSize!C3 == 2 * size_t.sizeof + char.sizeof);
+ // Uncomment test after dmd issue closed https://github.com/dlang/dmd/issues/21065
+ //static assert(stateSize!C3 == 3 * size_t.sizeof);
}
/**
diff --git a/libphobos/src/std/file.d b/libphobos/src/std/file.d
index c3466ac..0b8da50 100644
--- a/libphobos/src/std/file.d
+++ b/libphobos/src/std/file.d
@@ -983,10 +983,10 @@ private void renameImpl(scope const(char)[] f, scope const(char)[] t,
import std.conv : to, text;
if (!f)
- f = to!(typeof(f))(fromz[0 .. wcslen(fromz)]);
+ f = fromz ? to!(typeof(f))(fromz[0 .. wcslen(fromz)]) : "(null)";
if (!t)
- t = to!(typeof(t))(toz[0 .. wcslen(toz)]);
+ t = toz ? to!(typeof(t))(toz[0 .. wcslen(toz)]) : "(null)";
enforce(false,
new FileException(
diff --git a/libphobos/src/std/format/spec.d b/libphobos/src/std/format/spec.d
index e5564c9..b828bb6 100644
--- a/libphobos/src/std/format/spec.d
+++ b/libphobos/src/std/format/spec.d
@@ -127,14 +127,16 @@ if (is(Unqual!Char == Char))
Counting starts with `1`. Set to `0` if not used. Default: `0`.
*/
- ubyte indexStart;
+ ushort indexStart;
/**
Index of the last argument for positional parameter ranges.
Counting starts with `1`. Set to `0` if not used. Default: `0`.
+
+ The maximum value of this field is used as a sentinel to indicate the arguments' length.
*/
- ubyte indexEnd;
+ ushort indexEnd;
version (StdDdoc)
{
@@ -296,6 +298,8 @@ if (is(Unqual!Char == Char))
}
width = 0;
+ indexStart = 0;
+ indexEnd = 0;
precision = UNSPECIFIED;
nested = null;
// Parse the spec (we assume we're past '%' already)
@@ -834,6 +838,33 @@ if (is(Unqual!Char == Char))
== "$ expected after '*10' in format string");
}
+// https://github.com/dlang/phobos/issues/10713
+@safe pure unittest
+{
+ import std.array : appender;
+ auto f = FormatSpec!char("%3$d%d");
+
+ auto w = appender!(char[])();
+ f.writeUpToNextSpec(w);
+ assert(f.indexStart == 3);
+
+ f.writeUpToNextSpec(w);
+ assert(w.data.length == 0);
+ assert(f.indexStart == 0);
+}
+
+// https://github.com/dlang/phobos/issues/10699
+@safe pure unittest
+{
+ import std.array : appender;
+ auto f = FormatSpec!char("%1:$d");
+ auto w = appender!(char[])();
+
+ f.writeUpToNextSpec(w);
+ assert(f.indexStart == 1);
+ assert(f.indexEnd == ushort.max);
+}
+
/**
Helper function that returns a `FormatSpec` for a single format specifier.
diff --git a/libphobos/src/std/format/write.d b/libphobos/src/std/format/write.d
index 078fa78..68a96d4 100644
--- a/libphobos/src/std/format/write.d
+++ b/libphobos/src/std/format/write.d
@@ -534,6 +534,8 @@ uint formattedWrite(Writer, Char, Args...)(auto ref Writer w, const scope Char[]
// Are we already done with formats? Then just dump each parameter in turn
uint currentArg = 0;
+ bool lastWasConsumeAll;
+
while (spec.writeUpToNextSpec(w))
{
if (currentArg == Args.length && !spec.indexStart)
@@ -648,12 +650,23 @@ uint formattedWrite(Writer, Char, Args...)(auto ref Writer w, const scope Char[]
break SWITCH;
}
default:
- throw new FormatException(
- text("Positional specifier %", spec.indexStart, '$', spec.spec,
- " index exceeds ", Args.length));
+ if (spec.indexEnd == spec.indexEnd.max)
+ {
+ lastWasConsumeAll = true;
+ break;
+ }
+ else if (spec.indexEnd == spec.indexStart)
+ throw new FormatException(
+ text("Positional specifier %", spec.indexStart, '$', spec.spec,
+ " index exceeds ", Args.length));
+ else
+ throw new FormatException(
+ text("Positional specifier %", spec.indexStart, ":", spec.indexEnd, '$', spec.spec,
+ " index exceeds ", Args.length));
}
}
- return currentArg;
+
+ return lastWasConsumeAll ? Args.length : currentArg;
}
///
@@ -1199,6 +1212,17 @@ if (isSomeString!(typeof(fmt)))
formattedWrite(stream, "%s", aa);
}
+// https://github.com/dlang/phobos/issues/10699
+@safe pure unittest
+{
+ import std.array : appender;
+ auto w = appender!(char[])();
+
+ uint count = formattedWrite(w, "%1:$d", 1, 2, 3);
+ assert(count == 3);
+ assert(w.data == "123");
+}
+
/**
Formats a value of any type according to a format specifier and
writes the result to an output range.
diff --git a/libphobos/src/std/getopt.d b/libphobos/src/std/getopt.d
index 1a90722..fc5cdac 100644
--- a/libphobos/src/std/getopt.d
+++ b/libphobos/src/std/getopt.d
@@ -610,14 +610,14 @@ private template optionValidator(A...)
alias optionValidator = message;
}
-private void handleConversion(R)(string option, string value, R* receiver,
+private auto getoptTo(R)(string option, string value,
size_t idx, string file = __FILE__, size_t line = __LINE__)
{
import std.conv : to, ConvException;
import std.format : format;
try
{
- *receiver = to!(typeof(*receiver))(value);
+ return to!R(value);
}
catch (ConvException e)
{
@@ -876,12 +876,18 @@ private bool handleOption(R)(string option, R receiver, ref string[] args,
// (and potentially args[i + 1] too, but that comes later)
args = args[0 .. i] ~ args[i + 1 .. $];
- static if (is(typeof(*receiver) == bool))
+ static if (is(typeof(*receiver)))
+ alias Target = typeof(*receiver);
+ else
+ // delegate
+ alias Target = void;
+
+ static if (is(Target == bool))
{
if (val.length)
{
// parse '--b=true/false'
- handleConversion(option, val, receiver, i);
+ *receiver = getoptTo!(Target)(option, val, i);
}
else
{
@@ -894,23 +900,23 @@ private bool handleOption(R)(string option, R receiver, ref string[] args,
import std.exception : enforce;
// non-boolean option, which might include an argument
enum isCallbackWithLessThanTwoParameters =
- (is(typeof(receiver) == delegate) || is(typeof(*receiver) == function)) &&
+ (is(R == delegate) || is(Target == function)) &&
!is(typeof(receiver("", "")));
if (!isCallbackWithLessThanTwoParameters && !(val.length) && !incremental)
{
// Eat the next argument too. Check to make sure there's one
// to be eaten first, though.
enforce!GetOptException(i < args.length,
- "Missing value for argument " ~ a ~ ".");
+ "Missing value for argument " ~ a ~ ".");
val = args[i];
args = args[0 .. i] ~ args[i + 1 .. $];
}
- static if (is(typeof(*receiver) == enum) ||
- is(typeof(*receiver) == string))
+ static if (is(Target == enum) ||
+ is(Target == string))
{
- handleConversion(option, val, receiver, i);
+ *receiver = getoptTo!Target(option, val, i);
}
- else static if (is(typeof(*receiver) : real))
+ else static if (is(Target : real))
{
// numeric receiver
if (incremental)
@@ -919,16 +925,16 @@ private bool handleOption(R)(string option, R receiver, ref string[] args,
}
else
{
- handleConversion(option, val, receiver, i);
+ *receiver = getoptTo!Target(option, val, i);
}
}
- else static if (is(typeof(*receiver) == string))
+ else static if (is(Target == string))
{
// string receiver
- *receiver = to!(typeof(*receiver))(val);
+ *receiver = getoptTo!(Target)(option, val, i);
}
- else static if (is(typeof(receiver) == delegate) ||
- is(typeof(*receiver) == function))
+ else static if (is(R == delegate) ||
+ is(Target == function))
{
static if (is(typeof(receiver("", "")) : void))
{
@@ -952,29 +958,25 @@ private bool handleOption(R)(string option, R receiver, ref string[] args,
receiver();
}
}
- else static if (isArray!(typeof(*receiver)))
+ else static if (isArray!(Target))
{
// array receiver
import std.range : ElementEncodingType;
- alias E = ElementEncodingType!(typeof(*receiver));
+ alias E = ElementEncodingType!(Target);
if (arraySep == "")
{
- E tmp;
- handleConversion(option, val, &tmp, i);
- *receiver ~= tmp;
+ *receiver ~= getoptTo!E(option, val, i);
}
else
{
foreach (elem; val.splitter(arraySep))
{
- E tmp;
- handleConversion(option, elem, &tmp, i);
- *receiver ~= tmp;
+ *receiver ~= getoptTo!E(option, elem, i);
}
}
}
- else static if (isAssociativeArray!(typeof(*receiver)))
+ else static if (isAssociativeArray!(Target))
{
// hash receiver
alias K = typeof(receiver.keys[0]);
@@ -991,14 +993,7 @@ private bool handleOption(R)(string option, R receiver, ref string[] args,
~ to!string(assignChar) ~ "' in argument '" ~ input ~ "'.");
auto key = input[0 .. j];
auto value = input[j + 1 .. $];
-
- K k;
- handleConversion("", key, &k, 0);
-
- V v;
- handleConversion("", value, &v, 0);
-
- return tuple(k,v);
+ return tuple(getoptTo!K("", key, 0), getoptTo!V("", value, 0));
}
static void setHash(Range)(R receiver, Range range)
@@ -1013,7 +1008,7 @@ private bool handleOption(R)(string option, R receiver, ref string[] args,
setHash(receiver, val.splitter(arraySep));
}
else
- static assert(false, "getopt does not know how to handle the type " ~ typeof(receiver).stringof);
+ static assert(false, "getopt does not know how to handle the type " ~ R.stringof);
}
}
@@ -1099,6 +1094,18 @@ private bool handleOption(R)(string option, R receiver, ref string[] args,
assert(values == ["foo":0, "bar":1, "baz":2], to!string(values));
}
+// https://github.com/dlang/phobos/issues/10680
+@safe unittest
+{
+ arraySep = ",";
+ scope(exit) arraySep = "";
+ const(string)[] s;
+ string[] args = ["program.name", "-s", "a", "-s", "b", "-s", "c,d,e"];
+ getopt(args, "values|s", &s);
+ assert(s == ["a", "b", "c", "d", "e"]);
+}
+
+
/**
The option character (default '-').
diff --git a/libphobos/src/std/internal/windows/bcrypt.d b/libphobos/src/std/internal/windows/bcrypt.d
new file mode 100644
index 0000000..239dcd5
--- /dev/null
+++ b/libphobos/src/std/internal/windows/bcrypt.d
@@ -0,0 +1,65 @@
+module std.internal.windows.bcrypt;
+
+version (Windows):
+
+import core.sys.windows.bcrypt : BCryptGenRandom, BCRYPT_USE_SYSTEM_PREFERRED_RNG;
+import core.sys.windows.windef : HMODULE, PUCHAR, ULONG;
+import core.sys.windows.ntdef : NT_SUCCESS;
+
+pragma(lib, "Bcrypt.lib");
+
+package(std) bool bcryptGenRandom(T)(out T result) @trusted
+{
+ loadBcrypt();
+
+ const gotRandom = ptrBCryptGenRandom(
+ null,
+ cast(PUCHAR) &result,
+ ULONG(T.sizeof),
+ BCRYPT_USE_SYSTEM_PREFERRED_RNG,
+ );
+
+ return NT_SUCCESS(gotRandom);
+}
+
+private
+{
+ HMODULE hBcrypt = null;
+ typeof(BCryptGenRandom)* ptrBCryptGenRandom;
+}
+
+private void loadBcrypt() @nogc nothrow
+{
+ import core.sys.windows.winbase : GetProcAddress, LoadLibraryA;
+
+ if (!hBcrypt)
+ {
+ hBcrypt = LoadLibraryA("Bcrypt.dll");
+ if (!hBcrypt)
+ assert(false, `LoadLibraryA("Bcrypt.dll") failed.`); // `@nogc`
+
+ ptrBCryptGenRandom = cast(typeof(ptrBCryptGenRandom)) GetProcAddress(hBcrypt , "BCryptGenRandom");
+ if (!ptrBCryptGenRandom)
+ assert(false, `GetProcAddress(hBcrypt , "BCryptGenRandom") failed.`); // `@nogc`
+ }
+}
+
+// Will free `Bcrypt.dll`.
+private void freeBcrypt() @nogc nothrow
+{
+ import core.sys.windows.winbase : FreeLibrary;
+
+ if (hBcrypt)
+ {
+ if (!FreeLibrary(hBcrypt))
+ assert(false, `FreeLibrary("Bcrypt.dll") failed.`); // `@nogc`
+
+ hBcrypt = null;
+ ptrBCryptGenRandom = null;
+ }
+}
+
+static ~this()
+{
+ freeBcrypt();
+}
diff --git a/libphobos/src/std/json.d b/libphobos/src/std/json.d
index 7182f6e..eb08de8 100644
--- a/libphobos/src/std/json.d
+++ b/libphobos/src/std/json.d
@@ -562,8 +562,7 @@ struct JSONValue
else static if (is(T : string))
{
type_tag = JSONType.string;
- string t = arg;
- () @trusted { store.str = t; }();
+ store = Store(str: arg);
}
// https://issues.dlang.org/show_bug.cgi?id=15884
else static if (isSomeString!T)
@@ -572,7 +571,7 @@ struct JSONValue
// FIXME: std.Array.Array(Range) is not deduced as 'pure'
() @trusted {
import std.utf : byUTF;
- store.str = cast(immutable)(arg.byUTF!char.array);
+ store = Store(str: cast(immutable)(arg.byUTF!char.array));
}();
}
else static if (is(T : bool))
@@ -582,17 +581,17 @@ struct JSONValue
else static if (is(T : ulong) && isUnsigned!T)
{
type_tag = JSONType.uinteger;
- store.uinteger = arg;
+ store = Store(uinteger: arg);
}
else static if (is(T : long))
{
type_tag = JSONType.integer;
- store.integer = arg;
+ store = Store(integer: arg);
}
else static if (isFloatingPoint!T)
{
type_tag = JSONType.float_;
- store.floating = arg;
+ store = Store(floating: arg);
}
else static if (is(T : Value[Key], Key, Value))
{
@@ -600,45 +599,34 @@ struct JSONValue
type_tag = JSONType.object;
static if (is(Value : JSONValue))
{
- JSONValue[string] t = arg;
- () @trusted {
- store.object.isOrdered = false;
- store.object.unordered = t;
- }();
+ store = Store(object: Store.Object(false, unordered: arg));
}
else
{
JSONValue[string] aa;
foreach (key, value; arg)
aa[key] = JSONValue(value);
- () @trusted {
- store.object.isOrdered = false;
- store.object.unordered = aa;
- }();
+ store = Store(object: Store.Object(false, unordered: aa));
}
}
else static if (is(T : OrderedObjectMember[]))
{
type_tag = JSONType.object;
- () @trusted {
- store.object.isOrdered = true;
- store.object.ordered = arg;
- }();
+ store = Store(object: Store.Object(true, ordered: arg));
}
else static if (isArray!T)
{
type_tag = JSONType.array;
static if (is(ElementEncodingType!T : JSONValue))
{
- JSONValue[] t = arg;
- () @trusted { store.array = t; }();
+ store = Store(array: arg);
}
else
{
JSONValue[] new_arg = new JSONValue[arg.length];
foreach (i, e; arg)
new_arg[i] = JSONValue(e);
- () @trusted { store.array = new_arg; }();
+ store = Store(array: new_arg);
}
}
else static if (is(T : JSONValue))
@@ -658,14 +646,14 @@ struct JSONValue
type_tag = JSONType.array;
static if (is(ElementEncodingType!T : JSONValue))
{
- store.array = arg;
+ store = Store(array: arg);
}
else
{
JSONValue[] new_arg = new JSONValue[arg.length];
foreach (i, e; arg)
new_arg[i] = JSONValue(e);
- store.array = new_arg;
+ store = Store(array: new_arg);
}
}
@@ -1616,13 +1604,13 @@ if (isSomeFiniteCharInputRange!T)
if (isFloat)
{
value.type_tag = JSONType.float_;
- value.store.floating = parse!double(data);
+ value.store = JSONValue.Store(floating: parse!double(data));
}
else
{
if (isNegative)
{
- value.store.integer = parse!long(data);
+ value.store = JSONValue.Store(integer: parse!long(data));
value.type_tag = JSONType.integer;
}
else
@@ -1631,12 +1619,12 @@ if (isSomeFiniteCharInputRange!T)
ulong u = parse!ulong(data);
if (u & (1UL << 63))
{
- value.store.uinteger = u;
+ value.store = JSONValue.Store(uinteger: u);
value.type_tag = JSONType.uinteger;
}
else
{
- value.store.integer = u;
+ value.store = JSONValue.Store(integer: u);
value.type_tag = JSONType.integer;
}
}
diff --git a/libphobos/src/std/numeric.d b/libphobos/src/std/numeric.d
index 9966b1c..918984f 100644
--- a/libphobos/src/std/numeric.d
+++ b/libphobos/src/std/numeric.d
@@ -37,7 +37,7 @@ public enum CustomFloatFlags
* Store values in normalized form by default. The actual precision of the
* significand is extended by 1 bit by assuming an implicit leading bit of 1
* instead of 0. i.e. `1.nnnn` instead of `0.nnnn`.
- * True for all $(LINK2 https://en.wikipedia.org/wiki/IEEE_floating_point, IEE754) types
+ * True for all $(LINK2 https://en.wikipedia.org/wiki/IEEE_floating_point, IEEE754) types
*/
storeNormalized = 2,
diff --git a/libphobos/src/std/random.d b/libphobos/src/std/random.d
index fb4e546..edb8902c 100644
--- a/libphobos/src/std/random.d
+++ b/libphobos/src/std/random.d
@@ -1774,41 +1774,71 @@ else
version (linux)
{
- // `getrandom()` was introduced in Linux 3.17.
+ version (linux_legacy_emulate_getrandom)
+ {
+ /+
+ Emulates `getrandom()` for backwards compatibility
+ with outdated kernels and legacy libc versions.
+
+ `getrandom()` was added to the GNU C Library in v2.25.
+ +/
+ pragma(msg, "`getrandom()` emulation for legacy Linux targets is enabled.");
+
+ /+
+ On modern kernels (5.6+), `/dev/random` would behave more similar
+ to `getrandom()`.
+ However, this emulator was specifically written for systems older
+ than that. Hence, `/dev/urandom` is the CSPRNG of choice.
+
+ <https://web.archive.org/web/20200914181930/https://www.2uo.de/myths-about-urandom/>
+ +/
+ private static immutable _pathLinuxSystemCSPRNG = "/dev/urandom";
+
+ import core.sys.posix.sys.types : ssize_t;
+
+ /+
+ Linux `getrandom()` emulation built upon `/dev/urandom`.
+ The fourth parameter (`uint flags`) is happily ignored.
+ +/
+ private ssize_t getrandom(
+ void* buf,
+ size_t buflen,
+ uint,
+ ) @system nothrow @nogc
+ {
+ import core.stdc.stdio : fclose, fopen, fread;
- // Shim for missing bindings in druntime
- version (none)
- import core.sys.linux.sys.random : getrandom;
+ auto blockDev = fopen(_pathLinuxSystemCSPRNG.ptr, "r");
+ if (blockDev is null)
+ assert(false, "System CSPRNG unavailable: `fopen(\"" ~ _pathLinuxSystemCSPRNG ~ "\")` failed.");
+ scope (exit) fclose(blockDev);
+
+ const bytesRead = fread(buf, 1, buflen, blockDev);
+ return bytesRead;
+ }
+ }
else
{
- import core.sys.posix.sys.types : ssize_t;
- extern extern(C) ssize_t getrandom(
- void* buf,
- size_t buflen,
- uint flags,
- ) @system nothrow @nogc;
+ // `getrandom()` was introduced in Linux 3.17.
+
+ // Shim for missing bindings in druntime
+ version (none)
+ import core.sys.linux.sys.random : getrandom;
+ else
+ {
+ import core.sys.posix.sys.types : ssize_t;
+ private extern extern(C) ssize_t getrandom(
+ void* buf,
+ size_t buflen,
+ uint flags,
+ ) @system nothrow @nogc;
+ }
}
}
version (Windows)
{
- pragma(lib, "Bcrypt.lib");
-
- private bool bcryptGenRandom(T)(out T result) @trusted
- {
- import core.sys.windows.windef : PUCHAR, ULONG;
- import core.sys.windows.ntdef : NT_SUCCESS;
- import core.sys.windows.bcrypt : BCryptGenRandom, BCRYPT_USE_SYSTEM_PREFERRED_RNG;
-
- const gotRandom = BCryptGenRandom(
- null,
- cast(PUCHAR) &result,
- ULONG(T.sizeof),
- BCRYPT_USE_SYSTEM_PREFERRED_RNG,
- );
-
- return NT_SUCCESS(gotRandom);
- }
+ import std.internal.windows.bcrypt : bcryptGenRandom;
}
/**
diff --git a/libphobos/testsuite/Makefile.in b/libphobos/testsuite/Makefile.in
index b410f17..3df0815 100644
--- a/libphobos/testsuite/Makefile.in
+++ b/libphobos/testsuite/Makefile.in
@@ -202,6 +202,7 @@ NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OS_DFLAGS = @OS_DFLAGS@
OS_LINK_SPEC = @OS_LINK_SPEC@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
diff --git a/libphobos/testsuite/lib/libphobos-dg.exp b/libphobos/testsuite/lib/libphobos-dg.exp
index 2cac87f..f2c38a2 100644
--- a/libphobos/testsuite/lib/libphobos-dg.exp
+++ b/libphobos/testsuite/lib/libphobos-dg.exp
@@ -24,6 +24,7 @@ load_gcc_lib scanasm.exp
load_gcc_lib scanlang.exp
load_gcc_lib scanrtl.exp
load_gcc_lib scansarif.exp
+load_gcc_lib scanhtml.exp
load_gcc_lib scantree.exp
load_gcc_lib scanipa.exp
load_gcc_lib torture-options.exp
diff --git a/libphobos/testsuite/testsuite_flags.in b/libphobos/testsuite/testsuite_flags.in
index 9933667..d691272 100755
--- a/libphobos/testsuite/testsuite_flags.in
+++ b/libphobos/testsuite/testsuite_flags.in
@@ -28,7 +28,7 @@ case ${query} in
;;
--gdcflags)
GDCFLAGS_default="-fmessage-length=0 -fno-show-column"
- GDCFLAGS_config="@WARN_DFLAGS@ @GDCFLAGS@ @CET_FLAGS@
+ GDCFLAGS_config="@WARN_DFLAGS@ @GDCFLAGS@ @CET_FLAGS@ @OS_DFLAGS@
@phobos_compiler_shared_flag@
-fall-instantiations -fpreview=dip1000
-fno-release -funittest"