aboutsummaryrefslogtreecommitdiff
path: root/libphobos
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2021-12-05 17:11:12 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2021-12-09 00:58:58 +0100
commit0fb57034770aa20adced4d176f34ca611c2945bf (patch)
tree1f5735c8b4f25aa4a290e5ae8124713c24f98359 /libphobos
parentc15aa46cca0649b68613d3292cf71c7cc57ef78f (diff)
downloadgcc-0fb57034770aa20adced4d176f34ca611c2945bf.zip
gcc-0fb57034770aa20adced4d176f34ca611c2945bf.tar.gz
gcc-0fb57034770aa20adced4d176f34ca611c2945bf.tar.bz2
d: Merge upstream dmd 568496d5b, druntime 178c44ff, phobos 574bf883b.
D front-end changes: - Import dmd v2.098.0 - New ImportC module for compiling preprocessed C11 code into D. - New -ftransition=in switch. - Improved handling of new 'noreturn' type. Druntime changes: - Import druntime v2.098.0 - Fix broken import in core.sys.linux.perf_event module (PR103558). Phobos changes: - Import phobos v2.098.0 - All sources are now compiled with -fpreview=fieldwise. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 568496d5b. * Make-lang.in (D_FRONTEND_OBJS): Add d/common-file.o, d/common-outbuffer.o, d/common-string.o, d/file_manager.o, d/importc.o. Remove d/root-outbuffer.o. (d/common-%.o): New recipe. * d-builtins.cc (build_frontend_type): Update for new front-end interface. (d_build_d_type_nodes): Set noreturn_type_node. * d-codegen.cc (d_build_call): Don't call function if one of the arguments is type 'noreturn'. (build_vthis_function): Propagate TYPE_QUAL_VOLATILE from original function type. * d-frontend.cc (eval_builtin): Update signature. (getTypeInfoType): Likewise. (toObjFile): New function. * d-gimplify.cc (d_gimplify_call_expr): Always evaluate arguments from left to right. * d-lang.cc (d_handle_option): Handle OPT_ftransition_in. (d_parse_file): Don't generate D main if it is declared in user code. * d-tree.h (CALL_EXPR_ARGS_ORDERED): Remove. (enum d_tree_index): Add DTI_BOTTOM_TYPE. (noreturn_type_node): New. * decl.cc (apply_pragma_crt): Remove. (DeclVisitor::visit): Update for new front-end interface. (DeclVisitor::visit (PragmaDeclaration *)): Don't handle crt_constructor and crt_destructor pragmas. (DeclVisitor::visit (VarDeclaration *)): Don't generate declarations of type 'noreturn'. (DeclVisitor::visit (FuncDeclaration *)): Stop adding parameters when 'noreturn' type has been encountered. (get_symbol_decl): Set DECL_STATIC_CONSTRUCTOR and DECL_STATIC_DESTRUCTOR on decl node if requested. (aggregate_initializer_decl): Update for new front-end interface. * expr.cc (ExprVisitor::visit (CallExp *)): Always use the 'this' object as the result of calling any constructor function. (ExprVisitor::visit): Update for new front-end interface. * gdc.texi (Runtime Options): Document -fmain and -ftransition=in. * lang.opt (ftransition=in): New option. * modules.cc (get_internal_fn): Update for new front-end interface. * types.cc (TypeVisitor::visit): Likewise. (TypeVisitor::visit (TypeNoreturn *)): Return noreturn_type_node. (TypeVisitor::visit (TypeFunction *)): Stop adding parameters when 'notreturn' type has been encountered. Qualify function types that return 'noreturn' as TYPE_QUAL_VOLATILE. libphobos/ChangeLog: PR d/103558 * libdruntime/MERGE: Merge upstream druntime 178c44ff. * libdruntime/Makefile.am (DRUNTIME_DSOURCES_LINUX): Add core/sys/linux/syscalls.d. (DRUNTIME_DSOURCES_OPENBSD): Add core/sys/openbsd/pthread_np.d. * libdruntime/Makefile.in: Regenerate. * src/MERGE: Merge upstream phobos 574bf883b. * src/Makefile.am (D_EXTRA_DFLAGS): Add -fpreview=fieldwise. * src/Makefile.in: Regenerate. * testsuite/libphobos.exceptions/assert_fail.d: Update test. * testsuite/libphobos.betterc/test22336.d: New test.
Diffstat (limited to 'libphobos')
-rw-r--r--libphobos/libdruntime/MERGE2
-rw-r--r--libphobos/libdruntime/Makefile.am18
-rw-r--r--libphobos/libdruntime/Makefile.in34
-rw-r--r--libphobos/libdruntime/core/demangle.d98
-rw-r--r--libphobos/libdruntime/core/exception.d19
-rw-r--r--libphobos/libdruntime/core/internal/array/construction.d55
-rw-r--r--libphobos/libdruntime/core/internal/atomic.d24
-rw-r--r--libphobos/libdruntime/core/internal/dassert.d2
-rw-r--r--libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d279
-rw-r--r--libphobos/libdruntime/core/internal/gc/os.d44
-rw-r--r--libphobos/libdruntime/core/internal/hash.d9
-rw-r--r--libphobos/libdruntime/core/internal/parseoptions.d2
-rw-r--r--libphobos/libdruntime/core/internal/traits.d8
-rw-r--r--libphobos/libdruntime/core/internal/util/array.d49
-rw-r--r--libphobos/libdruntime/core/lifetime.d4
-rw-r--r--libphobos/libdruntime/core/runtime.d1
-rw-r--r--libphobos/libdruntime/core/stdc/stdlib.d2
-rw-r--r--libphobos/libdruntime/core/sync/rwmutex.d418
-rw-r--r--libphobos/libdruntime/core/sys/freebsd/config.d4
-rw-r--r--libphobos/libdruntime/core/sys/linux/fs.d63
-rw-r--r--libphobos/libdruntime/core/sys/linux/perf_event.d2
-rw-r--r--libphobos/libdruntime/core/sys/linux/sys/mman.d32
-rw-r--r--libphobos/libdruntime/core/sys/linux/syscalls.d745
-rw-r--r--libphobos/libdruntime/core/sys/linux/unistd.d26
-rw-r--r--libphobos/libdruntime/core/sys/openbsd/dlfcn.d4
-rw-r--r--libphobos/libdruntime/core/sys/openbsd/pthread_np.d23
-rw-r--r--libphobos/libdruntime/core/sys/openbsd/stdlib.d8
-rw-r--r--libphobos/libdruntime/core/sys/openbsd/string.d6
-rw-r--r--libphobos/libdruntime/core/sys/openbsd/sys/mman.d6
-rw-r--r--libphobos/libdruntime/core/sys/openbsd/sys/sysctl.d3
-rw-r--r--libphobos/libdruntime/core/sys/openbsd/unistd.d2
-rw-r--r--libphobos/libdruntime/core/sys/posix/netdb.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/filio.d12
-rwxr-xr-xlibphobos/libdruntime/core/sys/posix/sys/ioccom.d56
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/ioctl.d7
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/mman.d1
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/socket.d3
-rwxr-xr-xlibphobos/libdruntime/core/sys/posix/sys/ttycom.d101
-rw-r--r--libphobos/libdruntime/core/sys/posix/time.d5
-rw-r--r--libphobos/libdruntime/core/sys/windows/accctrl.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/aclapi.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/aclui.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/basetsd.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/basetyps.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/cderr.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/cguid.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/comcat.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/commctrl.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/commdlg.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/core.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/cpl.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/cplext.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/custcntl.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/dbt.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/dde.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/ddeml.d76
-rw-r--r--libphobos/libdruntime/core/sys/windows/dhcpcsdk.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/dlgs.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/dll.d6
-rw-r--r--libphobos/libdruntime/core/sys/windows/docobj.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/errorrep.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/exdisp.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/exdispid.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/httpext.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/idispids.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/imagehlp.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/imm.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/intshcut.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/ipexport.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/iphlpapi.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/ipifcons.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/iprtrmib.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/iptypes.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/isguids.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lm.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmaccess.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmalert.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmapibuf.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmat.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmaudit.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmbrowsr.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmchdev.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmconfig.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmcons.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmerr.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmerrlog.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmmsg.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmremutl.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmrepl.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmserver.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmshare.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmsname.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmstats.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmsvc.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmuse.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmuseflg.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lmwksta.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/lzexpand.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/mapi.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/mciavi.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/mcx.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/mgmtapi.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/mmsystem.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/msacm.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/mshtml.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/mswsock.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/nb30.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/nddeapi.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/nspapi.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/ntdef.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/ntdll.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/ntldap.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/ntsecapi.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/ntsecpkg.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/oaidl.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/objbase.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/objfwd.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/objidl.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/objsafe.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/ocidl.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/odbcinst.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/ole.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/ole2.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/ole2ver.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/oleacc.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/oleauto.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/olectl.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/olectlid.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/oledlg.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/oleidl.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/pbt.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/powrprof.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/prsht.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/psapi.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/rapi.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/ras.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/rasdlg.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/raserror.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/rassapi.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/reason.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/regstr.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/richedit.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/richole.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/rpc.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/rpcdce.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/rpcdce2.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/rpcdcep.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/rpcndr.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/rpcnsi.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/rpcnsip.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/rpcnterr.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/schannel.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/sdkddkver.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/secext.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/security.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/servprov.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/setupapi.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/shellapi.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/shldisp.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/shlguid.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/shlobj.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/shlwapi.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/snmp.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/sql.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/sqlext.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/sqltypes.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/sqlucode.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/sspi.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/stdc/malloc.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/subauth.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/tlhelp32.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/tmschema.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/unknwn.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/vfw.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/w32api.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/winbase.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/winber.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/wincon.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/wincrypt.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/windef.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/windows.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/winerror.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/wingdi.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/winhttp.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/wininet.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/winioctl.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/winldap.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/winnetwk.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/winnls.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/winnt.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/winperf.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/winreg.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/winspool.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/winsvc.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/winuser.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/winver.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/wtsapi32.d2
-rw-r--r--libphobos/libdruntime/core/sys/windows/wtypes.d2
-rw-r--r--libphobos/libdruntime/core/thread/fiber.d8
-rw-r--r--libphobos/libdruntime/core/thread/osthread.d1
-rw-r--r--libphobos/libdruntime/core/time.d34
-rw-r--r--libphobos/libdruntime/object.d78
-rw-r--r--libphobos/libdruntime/rt/aApplyR.d11
-rw-r--r--libphobos/libdruntime/rt/aaA.d6
-rw-r--r--libphobos/libdruntime/rt/dmain2.d4
-rw-r--r--libphobos/src/MERGE2
-rw-r--r--libphobos/src/Makefile.am5
-rw-r--r--libphobos/src/Makefile.in5
-rw-r--r--libphobos/src/etc/c/curl.d43
-rw-r--r--libphobos/src/index.dd (renamed from libphobos/src/index.d)0
-rw-r--r--libphobos/src/std/algorithm/comparison.d401
-rw-r--r--libphobos/src/std/algorithm/iteration.d237
-rw-r--r--libphobos/src/std/algorithm/mutation.d2
-rw-r--r--libphobos/src/std/algorithm/searching.d8
-rw-r--r--libphobos/src/std/algorithm/sorting.d12
-rw-r--r--libphobos/src/std/array.d22
-rw-r--r--libphobos/src/std/bitmanip.d6
-rw-r--r--libphobos/src/std/concurrency.d79
-rw-r--r--libphobos/src/std/container/array.d206
-rw-r--r--libphobos/src/std/datetime/systime.d52
-rw-r--r--libphobos/src/std/datetime/timezone.d1
-rw-r--r--libphobos/src/std/digest/ripemd.d2
-rw-r--r--libphobos/src/std/exception.d50
-rw-r--r--libphobos/src/std/experimental/checkedint.d10
-rw-r--r--libphobos/src/std/file.d75
-rw-r--r--libphobos/src/std/format/internal/floats.d12
-rw-r--r--libphobos/src/std/format/internal/write.d154
-rw-r--r--libphobos/src/std/functional.d31
-rw-r--r--libphobos/src/std/getopt.d13
-rw-r--r--libphobos/src/std/internal/math/biguintcore.d6
-rw-r--r--libphobos/src/std/internal/windows/advapi32.d12
-rw-r--r--libphobos/src/std/json.d6
-rw-r--r--libphobos/src/std/math/algebraic.d89
-rw-r--r--libphobos/src/std/math/operations.d3
-rw-r--r--libphobos/src/std/meta.d384
-rw-r--r--libphobos/src/std/parallelism.d71
-rw-r--r--libphobos/src/std/process.d27
-rw-r--r--libphobos/src/std/random.d24
-rw-r--r--libphobos/src/std/range/interfaces.d51
-rw-r--r--libphobos/src/std/range/package.d102
-rw-r--r--libphobos/src/std/range/primitives.d17
-rw-r--r--libphobos/src/std/socket.d79
-rw-r--r--libphobos/src/std/stdio.d52
-rw-r--r--libphobos/src/std/string.d16
-rw-r--r--libphobos/src/std/system.d2
-rw-r--r--libphobos/src/std/traits.d602
-rw-r--r--libphobos/src/std/typecons.d243
-rw-r--r--libphobos/src/std/uni/package.d38
-rw-r--r--libphobos/src/std/variant.d2
-rw-r--r--libphobos/src/std/windows/registry.d5
-rw-r--r--libphobos/testsuite/libphobos.betterc/test22336.d19
-rw-r--r--libphobos/testsuite/libphobos.exceptions/assert_fail.d12
252 files changed, 4065 insertions, 1941 deletions
diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE
index 11bef0f..d0d3a25 100644
--- a/libphobos/libdruntime/MERGE
+++ b/libphobos/libdruntime/MERGE
@@ -1,4 +1,4 @@
-e6caaab9d359198b760c698dcb6d253afb3f81f6
+178c44ff362902af589603767055cfac89215652
The first line of this file holds the git revision number of the last
merge done from the dlang/druntime repository.
diff --git a/libphobos/libdruntime/Makefile.am b/libphobos/libdruntime/Makefile.am
index 80c7567..44d4fe1 100644
--- a/libphobos/libdruntime/Makefile.am
+++ b/libphobos/libdruntime/Makefile.am
@@ -280,8 +280,9 @@ DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.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/unistd.d
+ core/sys/linux/syscalls.d core/sys/linux/termios.d \
+ core/sys/linux/time.d core/sys/linux/timerfd.d core/sys/linux/tipc.d \
+ core/sys/linux/unistd.d
DRUNTIME_DSOURCES_NETBSD = core/sys/netbsd/dlfcn.d \
core/sys/netbsd/err.d core/sys/netbsd/execinfo.d \
@@ -294,12 +295,13 @@ DRUNTIME_DSOURCES_NETBSD = core/sys/netbsd/dlfcn.d \
DRUNTIME_DSOURCES_OPENBSD = core/sys/openbsd/dlfcn.d \
core/sys/openbsd/err.d core/sys/openbsd/execinfo.d \
- core/sys/openbsd/stdlib.d core/sys/openbsd/string.d \
- core/sys/openbsd/sys/cdefs.d core/sys/openbsd/sys/elf.d \
- core/sys/openbsd/sys/elf32.d core/sys/openbsd/sys/elf64.d \
- core/sys/openbsd/sys/elf_common.d core/sys/openbsd/sys/link_elf.d \
- core/sys/openbsd/sys/mman.d core/sys/openbsd/sys/sysctl.d \
- core/sys/openbsd/time.d core/sys/openbsd/unistd.d
+ core/sys/openbsd/pthread_np.d core/sys/openbsd/stdlib.d \
+ core/sys/openbsd/string.d core/sys/openbsd/sys/cdefs.d \
+ core/sys/openbsd/sys/elf.d core/sys/openbsd/sys/elf32.d \
+ core/sys/openbsd/sys/elf64.d core/sys/openbsd/sys/elf_common.d \
+ core/sys/openbsd/sys/link_elf.d core/sys/openbsd/sys/mman.d \
+ core/sys/openbsd/sys/sysctl.d core/sys/openbsd/time.d \
+ core/sys/openbsd/unistd.d
DRUNTIME_DSOURCES_POSIX = core/sys/posix/aio.d \
core/sys/posix/arpa/inet.d core/sys/posix/config.d \
diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in
index b5f29da..84be808 100644
--- a/libphobos/libdruntime/Makefile.in
+++ b/libphobos/libdruntime/Makefile.in
@@ -343,10 +343,10 @@ am__objects_14 = core/sys/netbsd/dlfcn.lo core/sys/netbsd/err.lo \
core/sys/netbsd/sys/sysctl.lo core/sys/netbsd/time.lo
@DRUNTIME_OS_NETBSD_TRUE@am__objects_15 = $(am__objects_14)
am__objects_16 = core/sys/openbsd/dlfcn.lo core/sys/openbsd/err.lo \
- core/sys/openbsd/execinfo.lo core/sys/openbsd/stdlib.lo \
- core/sys/openbsd/string.lo core/sys/openbsd/sys/cdefs.lo \
- core/sys/openbsd/sys/elf.lo core/sys/openbsd/sys/elf32.lo \
- core/sys/openbsd/sys/elf64.lo \
+ core/sys/openbsd/execinfo.lo core/sys/openbsd/pthread_np.lo \
+ core/sys/openbsd/stdlib.lo core/sys/openbsd/string.lo \
+ core/sys/openbsd/sys/cdefs.lo core/sys/openbsd/sys/elf.lo \
+ core/sys/openbsd/sys/elf32.lo core/sys/openbsd/sys/elf64.lo \
core/sys/openbsd/sys/elf_common.lo \
core/sys/openbsd/sys/link_elf.lo core/sys/openbsd/sys/mman.lo \
core/sys/openbsd/sys/sysctl.lo core/sys/openbsd/time.lo \
@@ -367,9 +367,9 @@ am__objects_18 = core/sys/linux/config.lo core/sys/linux/dlfcn.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/unistd.lo
+ core/sys/linux/syscalls.lo core/sys/linux/termios.lo \
+ core/sys/linux/time.lo core/sys/linux/timerfd.lo \
+ core/sys/linux/tipc.lo core/sys/linux/unistd.lo
@DRUNTIME_OS_LINUX_TRUE@am__objects_19 = $(am__objects_18)
am__objects_20 = core/sys/windows/accctrl.lo \
core/sys/windows/aclapi.lo core/sys/windows/aclui.lo \
@@ -944,8 +944,9 @@ DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.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/unistd.d
+ core/sys/linux/syscalls.d core/sys/linux/termios.d \
+ core/sys/linux/time.d core/sys/linux/timerfd.d core/sys/linux/tipc.d \
+ core/sys/linux/unistd.d
DRUNTIME_DSOURCES_NETBSD = core/sys/netbsd/dlfcn.d \
core/sys/netbsd/err.d core/sys/netbsd/execinfo.d \
@@ -958,12 +959,13 @@ DRUNTIME_DSOURCES_NETBSD = core/sys/netbsd/dlfcn.d \
DRUNTIME_DSOURCES_OPENBSD = core/sys/openbsd/dlfcn.d \
core/sys/openbsd/err.d core/sys/openbsd/execinfo.d \
- core/sys/openbsd/stdlib.d core/sys/openbsd/string.d \
- core/sys/openbsd/sys/cdefs.d core/sys/openbsd/sys/elf.d \
- core/sys/openbsd/sys/elf32.d core/sys/openbsd/sys/elf64.d \
- core/sys/openbsd/sys/elf_common.d core/sys/openbsd/sys/link_elf.d \
- core/sys/openbsd/sys/mman.d core/sys/openbsd/sys/sysctl.d \
- core/sys/openbsd/time.d core/sys/openbsd/unistd.d
+ core/sys/openbsd/pthread_np.d core/sys/openbsd/stdlib.d \
+ core/sys/openbsd/string.d core/sys/openbsd/sys/cdefs.d \
+ core/sys/openbsd/sys/elf.d core/sys/openbsd/sys/elf32.d \
+ core/sys/openbsd/sys/elf64.d core/sys/openbsd/sys/elf_common.d \
+ core/sys/openbsd/sys/link_elf.d core/sys/openbsd/sys/mman.d \
+ core/sys/openbsd/sys/sysctl.d core/sys/openbsd/time.d \
+ core/sys/openbsd/unistd.d
DRUNTIME_DSOURCES_POSIX = core/sys/posix/aio.d \
core/sys/posix/arpa/inet.d core/sys/posix/config.d \
@@ -1616,6 +1618,7 @@ core/sys/openbsd/$(am__dirstamp):
core/sys/openbsd/dlfcn.lo: core/sys/openbsd/$(am__dirstamp)
core/sys/openbsd/err.lo: core/sys/openbsd/$(am__dirstamp)
core/sys/openbsd/execinfo.lo: core/sys/openbsd/$(am__dirstamp)
+core/sys/openbsd/pthread_np.lo: core/sys/openbsd/$(am__dirstamp)
core/sys/openbsd/stdlib.lo: core/sys/openbsd/$(am__dirstamp)
core/sys/openbsd/string.lo: core/sys/openbsd/$(am__dirstamp)
core/sys/openbsd/sys/$(am__dirstamp):
@@ -1672,6 +1675,7 @@ core/sys/linux/sys/socket.lo: core/sys/linux/sys/$(am__dirstamp)
core/sys/linux/sys/sysinfo.lo: core/sys/linux/sys/$(am__dirstamp)
core/sys/linux/sys/time.lo: core/sys/linux/sys/$(am__dirstamp)
core/sys/linux/sys/xattr.lo: core/sys/linux/sys/$(am__dirstamp)
+core/sys/linux/syscalls.lo: core/sys/linux/$(am__dirstamp)
core/sys/linux/termios.lo: core/sys/linux/$(am__dirstamp)
core/sys/linux/time.lo: core/sys/linux/$(am__dirstamp)
core/sys/linux/timerfd.lo: core/sys/linux/$(am__dirstamp)
diff --git a/libphobos/libdruntime/core/demangle.d b/libphobos/libdruntime/core/demangle.d
index ad9b44a..33ca0ddc 100644
--- a/libphobos/libdruntime/core/demangle.d
+++ b/libphobos/libdruntime/core/demangle.d
@@ -346,6 +346,13 @@ pure @safe:
}
+ void popFront(int i)
+ {
+ while (i--)
+ popFront();
+ }
+
+
void match( char val )
{
test( val );
@@ -636,6 +643,7 @@ pure @safe:
TypeDelegate
TypeNone
TypeVoid
+ TypeNoreturn
TypeByte
TypeUbyte
TypeShort
@@ -715,6 +723,9 @@ pure @safe:
TypeVoid:
v
+ TypeNoreturn
+ Nn
+
TypeByte:
g
@@ -873,6 +884,10 @@ pure @safe:
popFront();
switch ( front )
{
+ case 'n': // Noreturn
+ popFront();
+ put("noreturn");
+ return dst[beg .. len];
case 'g': // Wild (Ng Type)
popFront();
// TODO: Anything needed here?
@@ -1164,9 +1179,11 @@ pure @safe:
case 'g':
case 'h':
case 'k':
+ case 'n':
// NOTE: The inout parameter type is represented as "Ng".
// The vector parameter type is represented as "Nh".
// The return parameter type is represented as "Nk".
+ // The noreturn parameter type is represented as "Nn".
// These make it look like a FuncAttr, but infact
// if we see these, then we know we're really in
// the parameter list. Rewind and break.
@@ -1217,6 +1234,59 @@ pure @safe:
break;
}
putComma(n);
+
+ /* Do special return, scope, ref, out combinations
+ */
+ int npops;
+ if ( 'M' == front && peek(1) == 'N' && peek(2) == 'k')
+ {
+ const c3 = peek(3);
+ if (c3 == 'J')
+ {
+ put("scope return out "); // MNkJ
+ npops = 4;
+ }
+ else if (c3 == 'K')
+ {
+ put("scope return ref "); // MNkK
+ npops = 4;
+ }
+ }
+ else if ('N' == front && peek(1) == 'k')
+ {
+ const c2 = peek(2);
+ if (c2 == 'J')
+ {
+ put("return out "); // NkJ
+ npops = 3;
+ }
+ else if (c2 == 'K')
+ {
+ put("return ref "); // NkK
+ npops = 3;
+ }
+ else if (c2 == 'M')
+ {
+ const c3 = peek(3);
+ if (c3 == 'J')
+ {
+ put("return scope out "); // NkMJ
+ npops = 4;
+ }
+ else if (c3 == 'K')
+ {
+ put("return scope ref "); // NkMK
+ npops = 4;
+ }
+ else
+ {
+ put("return scope "); // NkM
+ npops = 3;
+ }
+ }
+ }
+ popFront(npops);
+
if ( 'M' == front )
{
popFront();
@@ -2558,6 +2628,15 @@ else
`nothrow @trusted ulong std.algorithm.iteration.FilterResult!(std.typecons.Tuple!(int, "a", int, "b", int, "c").`
~`Tuple.rename!([0:"c", 2:"a"]).rename().__lambda1, int[]).FilterResult.__xtoHash(ref const(std.algorithm.iteration.`
~`FilterResult!(std.typecons.Tuple!(int, "a", int, "b", int, "c").Tuple.rename!([0:"c", 2:"a"]).rename().__lambda1, int[]).FilterResult))`],
+
+ ["_D4test4rrs1FKPiZv", "void test.rrs1(ref int*)"],
+ ["_D4test4rrs1FMNkJPiZv", "void test.rrs1(scope return out int*)"],
+ ["_D4test4rrs1FMNkKPiZv", "void test.rrs1(scope return ref int*)"],
+ ["_D4test4rrs1FNkJPiZv", "void test.rrs1(return out int*)"],
+ ["_D4test4rrs1FNkKPiZv", "void test.rrs1(return ref int*)"],
+ ["_D4test4rrs1FNkMJPiZv", "void test.rrs1(return scope out int*)"],
+ ["_D4test4rrs1FNkMKPiZv", "void test.rrs1(return scope ref int*)"],
+ ["_D4test4rrs1FNkMPiZv", "void test.rrs1(return scope int*)"],
];
@@ -2621,6 +2700,25 @@ unittest
assert(s.demangle == expected);
}
+// https://issues.dlang.org/show_bug.cgi?id=22235
+unittest
+{
+ enum parent = __MODULE__ ~ '.' ~ __traits(identifier, __traits(parent, {}));
+
+ static noreturn abort() { assert(false); }
+ assert(demangle(abort.mangleof) == "pure nothrow @nogc @safe noreturn " ~ parent ~ "().abort()");
+
+ static void accept(noreturn) {}
+ assert(demangle(accept.mangleof) == "pure nothrow @nogc @safe void " ~ parent ~ "().accept(noreturn)");
+
+ static void templ(T)(T, T) {}
+ assert(demangle(templ!noreturn.mangleof) == "pure nothrow @nogc @safe void " ~ parent ~ "().templ!(noreturn).templ(noreturn, noreturn)");
+
+ static struct S(T) {}
+ static void aggr(S!noreturn) { assert(0); }
+ assert(demangle(aggr.mangleof) == "pure nothrow @nogc @safe void " ~ parent ~ "().aggr(" ~ parent ~ "().S!(noreturn).S)");
+}
+
/*
*
*/
diff --git a/libphobos/libdruntime/core/exception.d b/libphobos/libdruntime/core/exception.d
index fe298d4..a692866 100644
--- a/libphobos/libdruntime/core/exception.d
+++ b/libphobos/libdruntime/core/exception.d
@@ -97,7 +97,7 @@ class ArrayIndexError : RangeError
this.length = length;
// Constructing the message is a bit clumsy:
- // It's essentially `printf("index [%zu] exceeds array of length [%zu]", index, length)`,
+ // It's essentially `printf("index [%zu] is out of bounds for array of length [%zu]", index, length)`,
// but even `snprintf` isn't `pure`.
// Also string concatenation isn't `@nogc`, and casting to/from immutable isn't `@safe`
import core.internal.string : unsignedToTempString;
@@ -106,8 +106,7 @@ class ArrayIndexError : RangeError
char[] sink = buf[];
sink.rangeMsgPut("index [");
sink.rangeMsgPut(unsignedToTempString!10(index, tmpBuf));
- sink.rangeMsgPut("]");
- sink.rangeMsgPut(" exceeds array of length ");
+ sink.rangeMsgPut("] is out of bounds for array of length ");
sink.rangeMsgPut(unsignedToTempString!10(length, tmpBuf));
this.msgBuf = buf;
super(msgBuf[0..$-sink.length], file, line, next);
@@ -116,7 +115,7 @@ class ArrayIndexError : RangeError
@safe pure unittest
{
- assert(new ArrayIndexError(900, 700).msg == "index [900] exceeds array of length 700");
+ assert(new ArrayIndexError(900, 700).msg == "index [900] is out of bounds for array of length 700");
// Ensure msg buffer doesn't overflow on large numbers
assert(new ArrayIndexError(size_t.max, size_t.max-1).msg);
}
@@ -836,12 +835,24 @@ extern (C)
onArraySliceError(lower, upper, length, file[0 .. strlen(file)], line);
}
+ /// ditto
+ void _d_arraybounds_slice(string file, uint line, size_t lower, size_t upper, size_t length)
+ {
+ onArraySliceError(lower, upper, length, file, line);
+ }
+
/// Called when an out of range array index is accessed
void _d_arraybounds_indexp(immutable(char*) file, uint line, size_t index, size_t length)
{
import core.stdc.string : strlen;
onArrayIndexError(index, length, file[0 .. strlen(file)], line);
}
+
+ /// ditto
+ void _d_arraybounds_index(string file, uint line, size_t index, size_t length)
+ {
+ onArrayIndexError(index, length, file, line);
+ }
}
// TLS storage shared for all errors, chaining might create circular reference
diff --git a/libphobos/libdruntime/core/internal/array/construction.d b/libphobos/libdruntime/core/internal/array/construction.d
index b58ed51..9c82237 100644
--- a/libphobos/libdruntime/core/internal/array/construction.d
+++ b/libphobos/libdruntime/core/internal/array/construction.d
@@ -9,44 +9,50 @@
*/
module core.internal.array.construction;
+import core.internal.traits : Unqual;
+
/**
* Does array initialization (not assignment) from another array of the same element type.
* Params:
- * to = what array to initialize
* from = what data the array should be initialized with
* Returns:
- * The constructed `to`
+ * The created and initialized array `to`
* Bugs:
* This function template was ported from a much older runtime hook that bypassed safety,
* purity, and throwabilty checks. To prevent breaking existing code, this function template
* is temporarily declared `@trusted` until the implementation can be brought up to modern D expectations.
*/
-Tarr _d_arrayctor(Tarr : T[], T)(return scope Tarr to, scope Tarr from) @trusted
+Tarr1 _d_arrayctor(Tarr1 : T1[], Tarr2 : T2[], T1, T2)(scope Tarr2 from) @trusted
+ if (is(Unqual!T1 == Unqual!T2))
{
pragma(inline, false);
- import core.internal.traits : hasElaborateCopyConstructor, Unqual;
+ import core.internal.traits : hasElaborateCopyConstructor;
import core.lifetime : copyEmplace;
import core.stdc.string : memcpy;
- debug(PRINTF) import core.stdc.stdio;
+ import core.stdc.stdint : uintptr_t;
+ debug(PRINTF) import core.stdc.stdio : printf;
+
+ debug(PRINTF) printf("_d_arrayctor(to = %p,%d, from = %p,%d) size = %d\n", from.ptr, from.length, to.ptr, to.length, T1.tsize);
+
+ Tarr1 to = void;
+
+ void[] vFrom = (cast(void*)from.ptr)[0..from.length];
+ void[] vTo = (cast(void*)to.ptr)[0..to.length];
// Force `enforceRawArraysConformable` to be `pure`
- void enforceRawArraysConformable(const char[] action, const size_t elementSize, const void[] a1, const void[] a2, in bool allowOverlap = false) @trusted
+ void enforceRawArraysConformable(const char[] action, const size_t elementSize,
+ const void[] a1, const void[] a2) @trusted
{
- import core.internal.util.array : enforceRawArraysConformable;
+ import core.internal.util.array : enforceRawArraysConformableNogc;
- alias Type = void function(const char[] action, const size_t elementSize, const void[] a1, const void[] a2, in bool allowOverlap = false) pure nothrow;
- (cast(Type)&enforceRawArraysConformable)(action, elementSize, a1, a2, allowOverlap);
+ alias Type = void function(const char[] action, const size_t elementSize,
+ const void[] a1, const void[] a2, in bool allowOverlap = false) @nogc pure nothrow;
+ (cast(Type)&enforceRawArraysConformableNogc)(action, elementSize, a1, a2, false);
}
- debug(PRINTF) printf("_d_arrayctor(to = %p,%d, from = %p,%d) size = %d\n", from.ptr, from.length, to.ptr, to.length, T.tsize);
-
- auto element_size = T.sizeof;
-
- void[] vFrom = (cast(void*)from.ptr)[0..from.length];
- void[] vTo = (cast(void*)to.ptr)[0..to.length];
- enforceRawArraysConformable("initialization", element_size, vFrom, vTo, false);
+ enforceRawArraysConformable("initialization", T1.sizeof, vFrom, vTo);
- static if (hasElaborateCopyConstructor!T)
+ static if (hasElaborateCopyConstructor!T1)
{
size_t i;
try
@@ -60,7 +66,7 @@ Tarr _d_arrayctor(Tarr : T[], T)(return scope Tarr to, scope Tarr from) @trusted
*/
while (i--)
{
- auto elem = cast(Unqual!T*)&to[i];
+ auto elem = cast(Unqual!T1*)&to[i];
destroy(*elem);
}
@@ -70,7 +76,7 @@ Tarr _d_arrayctor(Tarr : T[], T)(return scope Tarr to, scope Tarr from) @trusted
else
{
// blit all elements at once
- memcpy(cast(void*) to.ptr, from.ptr, to.length * T.sizeof);
+ memcpy(cast(void*) to.ptr, from.ptr, to.length * T1.sizeof);
}
return to;
@@ -88,7 +94,7 @@ Tarr _d_arrayctor(Tarr : T[], T)(return scope Tarr to, scope Tarr from) @trusted
S[4] arr1;
S[4] arr2 = [S(0), S(1), S(2), S(3)];
- _d_arrayctor(arr1[], arr2[]);
+ arr1 = _d_arrayctor!(typeof(arr1))(arr2[]);
assert(counter == 4);
assert(arr1 == arr2);
@@ -111,7 +117,7 @@ Tarr _d_arrayctor(Tarr : T[], T)(return scope Tarr to, scope Tarr from) @trusted
S[4] arr1;
S[4] arr2 = [S(0), S(1), S(2), S(3)];
- _d_arrayctor(arr1[], arr2[]);
+ arr1 = _d_arrayctor!(typeof(arr1))(arr2[]);
assert(counter == 4);
assert(arr1 == arr2);
@@ -137,7 +143,7 @@ Tarr _d_arrayctor(Tarr : T[], T)(return scope Tarr to, scope Tarr from) @trusted
{
Throw[4] a;
Throw[4] b = [Throw(1), Throw(2), Throw(3), Throw(4)];
- _d_arrayctor(a[], b[]);
+ a = _d_arrayctor!(typeof(a))(b[]);
}
catch (Exception)
{
@@ -162,7 +168,7 @@ Tarr _d_arrayctor(Tarr : T[], T)(return scope Tarr to, scope Tarr from) @trusted
{
NoThrow[4] a;
NoThrow[4] b = [NoThrow(1), NoThrow(2), NoThrow(3), NoThrow(4)];
- _d_arrayctor(a[], b[]);
+ a = _d_arrayctor!(typeof(a))(b[]);
}
catch (Exception)
{
@@ -186,7 +192,6 @@ Tarr _d_arrayctor(Tarr : T[], T)(return scope Tarr to, scope Tarr from) @trusted
void _d_arraysetctor(Tarr : T[], T)(scope Tarr p, scope ref T value) @trusted
{
pragma(inline, false);
- import core.internal.traits : Unqual;
import core.lifetime : copyEmplace;
size_t i;
@@ -269,7 +274,7 @@ void _d_arraysetctor(Tarr : T[], T)(scope Tarr p, scope ref T value) @trusted
{
Throw[4] a;
Throw[4] b = [Throw(1), Throw(2), Throw(3), Throw(4)];
- _d_arrayctor(a[], b[]);
+ a = _d_arrayctor!(typeof(a))(b[]);
}
catch (Exception)
{
diff --git a/libphobos/libdruntime/core/internal/atomic.d b/libphobos/libdruntime/core/internal/atomic.d
index 3036ea7..5daab89 100644
--- a/libphobos/libdruntime/core/internal/atomic.d
+++ b/libphobos/libdruntime/core/internal/atomic.d
@@ -104,7 +104,7 @@ version (DigitalMars)
pop RBX;
ret;
}
- }, SrcPtr, RetPtr));
+ }, [SrcPtr, RetPtr]));
}
else
{
@@ -139,7 +139,7 @@ version (DigitalMars)
mov %0, src;
lock; cmpxchg [%0], %1;
}
- }, SrcReg, ZeroReg, ResReg));
+ }, [SrcReg, ZeroReg, ResReg]));
}
else version (D_InlineAsm_X86_64)
{
@@ -159,7 +159,7 @@ version (DigitalMars)
lock; cmpxchg [%0], %1;
ret;
}
- }, SrcReg, ZeroReg, ResReg));
+ }, [SrcReg, ZeroReg, ResReg]));
}
}
else
@@ -252,7 +252,7 @@ version (DigitalMars)
mov %0, dest;
lock; xadd[%0], %1;
}
- }, DestReg, ValReg));
+ }, [DestReg, ValReg]));
}
else version (D_InlineAsm_X86_64)
{
@@ -276,7 +276,7 @@ version (DigitalMars)
?2 mov %2, %1;
ret;
}
- }, DestReg, ValReg, ResReg));
+ }, [DestReg, ValReg, ResReg]));
}
else
static assert (false, "Unsupported architecture.");
@@ -305,7 +305,7 @@ version (DigitalMars)
mov %0, dest;
xchg [%0], %1;
}
- }, DestReg, ValReg));
+ }, [DestReg, ValReg]));
}
else version (D_InlineAsm_X86_64)
{
@@ -329,7 +329,7 @@ version (DigitalMars)
?2 mov %2, %1;
ret;
}
- }, DestReg, ValReg, ResReg));
+ }, [DestReg, ValReg, ResReg]));
}
else
static assert (false, "Unsupported architecture.");
@@ -362,7 +362,7 @@ version (DigitalMars)
setz AL;
pop %1;
}
- }, DestAddr, CmpAddr, Val, Cmp));
+ }, [DestAddr, CmpAddr, Val, Cmp]));
}
else static if (T.sizeof == 8)
{
@@ -421,7 +421,7 @@ version (DigitalMars)
xor AL, AL;
ret;
}
- }, DestAddr, CmpAddr, Val, Res));
+ }, [DestAddr, CmpAddr, Val, Res]));
}
else
{
@@ -500,7 +500,7 @@ version (DigitalMars)
lock; cmpxchg [%0], %2;
setz AL;
}
- }, DestAddr, Cmp, Val));
+ }, [DestAddr, Cmp, Val]));
}
else static if (T.sizeof == 8)
{
@@ -551,7 +551,7 @@ version (DigitalMars)
setz AL;
ret;
}
- }, DestAddr, Cmp, Val, AXReg));
+ }, [DestAddr, Cmp, Val, AXReg]));
}
else
{
@@ -1094,7 +1094,7 @@ template needsStoreBarrier( MemoryOrder ms )
}
// this is a helper to build asm blocks
-string simpleFormat(string format, string[] args...)
+string simpleFormat(string format, scope string[] args)
{
string result;
outer: while (format.length)
diff --git a/libphobos/libdruntime/core/internal/dassert.d b/libphobos/libdruntime/core/internal/dassert.d
index ac7600f..2c51b86 100644
--- a/libphobos/libdruntime/core/internal/dassert.d
+++ b/libphobos/libdruntime/core/internal/dassert.d
@@ -191,7 +191,7 @@ private string miniFormat(V)(const scope ref V v)
}
// Fall back to a simple cast - we're violating the type system anyways
- return miniFormat(__ctfe ? cast(const T) v : *cast(const T*) &v);
+ return miniFormat(*cast(const T*) &v);
}
// Format enum members using their name
else static if (is(V BaseType == enum))
diff --git a/libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d b/libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d
index 0c49955..a731d6f 100644
--- a/libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d
+++ b/libphobos/libdruntime/core/internal/gc/impl/conservative/gc.d
@@ -150,7 +150,11 @@ class ConservativeGC : GC
static bool _inFinalizer;
__gshared bool isPrecise = false;
- // lock GC, throw InvalidMemoryOperationError on recursive locking during finalization
+ /*
+ * Lock the GC.
+ *
+ * Throws: InvalidMemoryOperationError on recursive locking during finalization.
+ */
static void lockNR() @nogc nothrow
{
if (_inFinalizer)
@@ -158,6 +162,12 @@ class ConservativeGC : GC
gcLock.lock();
}
+ /*
+ * Initialize the GC based on command line configuration.
+ *
+ * Throws:
+ * OutOfMemoryError if failed to initialize GC due to not enough memory.
+ */
this()
{
//config is assumed to have already been initialized
@@ -194,6 +204,10 @@ class ConservativeGC : GC
}
+ /**
+ * Enables the GC if disable() was previously called. Must be called
+ * for each time disable was called in order to enable the GC again.
+ */
void enable()
{
static void go(Gcx* gcx) nothrow
@@ -205,6 +219,9 @@ class ConservativeGC : GC
}
+ /**
+ * Disable the GC. The GC may still run if it deems necessary.
+ */
void disable()
{
static void go(Gcx* gcx) nothrow
@@ -216,6 +233,13 @@ class ConservativeGC : GC
debug (GC_RECURSIVE_LOCK) static bool lockedOnThisThread;
+ /**
+ * Run a function inside a lock/unlock set.
+ *
+ * Params:
+ * func = The function to run.
+ * args = The function arguments.
+ */
auto runLocked(alias func, Args...)(auto ref Args args)
{
debug(PROFILE_API) immutable tm = (config.profile > 1 ? currTime.ticks : 0);
@@ -248,7 +272,17 @@ class ConservativeGC : GC
return res;
}
-
+ /**
+ * Run a function in an lock/unlock set that keeps track of
+ * how much time was spend inside this function (in ticks)
+ * and how many times this fuction was called.
+ *
+ * Params:
+ * func = The function to run.
+ * time = The variable keeping track of the time (in ticks).
+ * count = The variable keeping track of how many times this fuction was called.
+ * args = The function arguments.
+ */
auto runLocked(alias func, alias time, alias count, Args...)(auto ref Args args)
{
debug(PROFILE_API) immutable tm = (config.profile > 1 ? currTime.ticks : 0);
@@ -287,6 +321,17 @@ class ConservativeGC : GC
}
+ /**
+ * Returns a bit field representing all block attributes set for the memory
+ * referenced by p.
+ *
+ * Params:
+ * p = A pointer to the base of a valid memory block or to null.
+ *
+ * Returns:
+ * A bit field containing any bits set for the memory block referenced by
+ * p or zero on error.
+ */
uint getAttr(void* p) nothrow
{
if (!p)
@@ -314,7 +359,20 @@ class ConservativeGC : GC
return runLocked!(go, otherTime, numOthers)(gcx, p);
}
-
+ /**
+ * Sets the specified bits for the memory references by p.
+ *
+ * If p was not allocated by the GC, points inside a block, or is null, no
+ * action will be taken.
+ *
+ * Params:
+ * p = A pointer to the base of a valid memory block or to null.
+ * mask = A bit field containing any bits to set for this memory block.
+ *
+ * Returns:
+ * The result of a call to getAttr after the specified bits have been
+ * set.
+ */
uint setAttr(void* p, uint mask) nothrow
{
if (!p)
@@ -344,6 +402,20 @@ class ConservativeGC : GC
}
+ /**
+ * Clears the specified bits for the memory references by p.
+ *
+ * If p was not allocated by the GC, points inside a block, or is null, no
+ * action will be taken.
+ *
+ * Params:
+ * p = A pointer to the base of a valid memory block or to null.
+ * mask = A bit field containing any bits to clear for this memory block.
+ *
+ * Returns:
+ * The result of a call to getAttr after the specified bits have been
+ * cleared
+ */
uint clrAttr(void* p, uint mask) nothrow
{
if (!p)
@@ -372,8 +444,21 @@ class ConservativeGC : GC
return runLocked!(go, otherTime, numOthers)(gcx, p, mask);
}
-
- void *malloc(size_t size, uint bits, const TypeInfo ti) nothrow
+ /**
+ * Requests an aligned block of managed memory from the garbage collector.
+ *
+ * Params:
+ * size = The desired allocation size in bytes.
+ * bits = A bitmask of the attributes to set on this block.
+ * ti = TypeInfo to describe the memory.
+ *
+ * Returns:
+ * A reference to the allocated memory or null if no memory was requested.
+ *
+ * Throws:
+ * OutOfMemoryError on allocation failure
+ */
+ void *malloc(size_t size, uint bits = 0, const TypeInfo ti = null) nothrow
{
if (!size)
{
@@ -394,7 +479,7 @@ class ConservativeGC : GC
//
- //
+ // Implementation for malloc and calloc.
//
private void *mallocNoSync(size_t size, uint bits, ref size_t alloc_size, const TypeInfo ti = null) nothrow
{
@@ -423,7 +508,6 @@ class ConservativeGC : GC
return p;
}
-
BlkInfo qalloc( size_t size, uint bits, const scope TypeInfo ti) nothrow
{
@@ -446,7 +530,22 @@ class ConservativeGC : GC
}
- void *calloc(size_t size, uint bits, const TypeInfo ti) nothrow
+ /**
+ * Requests an aligned block of managed memory from the garbage collector,
+ * which is initialized with all bits set to zero.
+ *
+ * Params:
+ * size = The desired allocation size in bytes.
+ * bits = A bitmask of the attributes to set on this block.
+ * ti = TypeInfo to describe the memory.
+ *
+ * Returns:
+ * A reference to the allocated memory or null if no memory was requested.
+ *
+ * Throws:
+ * OutOfMemoryError on allocation failure.
+ */
+ void *calloc(size_t size, uint bits = 0, const TypeInfo ti = null) nothrow
{
if (!size)
{
@@ -466,8 +565,27 @@ class ConservativeGC : GC
return p;
}
-
- void *realloc(void *p, size_t size, uint bits, const TypeInfo ti) nothrow
+ /**
+ * Request that the GC reallocate a block of memory, attempting to adjust
+ * the size in place if possible. If size is 0, the memory will be freed.
+ *
+ * If p was not allocated by the GC, points inside a block, or is null, no
+ * action will be taken.
+ *
+ * Params:
+ * p = A pointer to the root of a valid memory block or to null.
+ * size = The desired allocation size in bytes.
+ * bits = A bitmask of the attributes to set on this block.
+ * ti = TypeInfo to describe the memory.
+ *
+ * Returns:
+ * A reference to the allocated memory on success or null if size is
+ * zero.
+ *
+ * Throws:
+ * OutOfMemoryError on allocation failure.
+ */
+ void *realloc(void *p, size_t size, uint bits = 0, const TypeInfo ti = null) nothrow
{
size_t localAllocSize = void;
auto oldp = p;
@@ -484,6 +602,8 @@ class ConservativeGC : GC
//
+ // The implementation of realloc.
+ //
// bits will be set to the resulting bits of the new block
//
private void *reallocNoSync(void *p, size_t size, ref uint bits, ref size_t alloc_size, const TypeInfo ti = null) nothrow
@@ -624,7 +744,7 @@ class ConservativeGC : GC
//
- //
+ // Implementation of extend.
//
private size_t extendNoSync(void* p, size_t minsize, size_t maxsize, const TypeInfo ti = null) nothrow
in
@@ -678,6 +798,16 @@ class ConservativeGC : GC
}
+ /**
+ * Requests that at least size bytes of memory be obtained from the operating
+ * system and marked as free.
+ *
+ * Params:
+ * size = The desired size in bytes.
+ *
+ * Returns:
+ * The actual number of bytes reserved or zero on error.
+ */
size_t reserve(size_t size) nothrow
{
if (!size)
@@ -690,7 +820,7 @@ class ConservativeGC : GC
//
- //
+ // Implementation of reserve
//
private size_t reserveNoSync(size_t size) nothrow
{
@@ -701,7 +831,16 @@ class ConservativeGC : GC
}
- void free(void *p) nothrow @nogc
+ /**
+ * Deallocates the memory referenced by p.
+ *
+ * If p was not allocated by the GC, points inside a block, is null, or
+ * if free is called from a finalizer, no action will be taken.
+ *
+ * Params:
+ * p = A pointer to the root of a valid memory block or to null.
+ */
+ void free(void *p) nothrow
{
if (!p || _inFinalizer)
{
@@ -713,7 +852,7 @@ class ConservativeGC : GC
//
- //
+ // Implementation of free.
//
private void freeNoSync(void *p) nothrow @nogc
{
@@ -792,7 +931,18 @@ class ConservativeGC : GC
}
- void* addrOf(void *p) nothrow @nogc
+ /**
+ * Determine the base address of the block containing p. If p is not a gc
+ * allocated pointer, return null.
+ *
+ * Params:
+ * p = A pointer to the root or the interior of a valid memory block or to
+ * null.
+ *
+ * Returns:
+ * The base address of the memory block referenced by p or null on error.
+ */
+ void* addrOf(void *p) nothrow
{
if (!p)
{
@@ -804,7 +954,7 @@ class ConservativeGC : GC
//
- //
+ // Implementation of addrOf.
//
void* addrOfNoSync(void *p) nothrow @nogc
{
@@ -820,7 +970,17 @@ class ConservativeGC : GC
}
- size_t sizeOf(void *p) nothrow @nogc
+ /**
+ * Determine the allocated size of pointer p. If p is an interior pointer
+ * or not a gc allocated pointer, return 0.
+ *
+ * Params:
+ * p = A pointer to the root of a valid memory block or to null.
+ *
+ * Returns:
+ * The size in bytes of the memory block referenced by p or zero on error.
+ */
+ size_t sizeOf(void *p) nothrow
{
if (!p)
{
@@ -832,7 +992,7 @@ class ConservativeGC : GC
//
- //
+ // Implementation of sizeOf.
//
private size_t sizeOfNoSync(void *p) nothrow @nogc
{
@@ -852,6 +1012,18 @@ class ConservativeGC : GC
}
+ /**
+ * Determine the base address of the block containing p. If p is not a gc
+ * allocated pointer, return null.
+ *
+ * Params:
+ * p = A pointer to the root or the interior of a valid memory block or to
+ * null.
+ *
+ * Returns:
+ * Information regarding the memory block referenced by p or BlkInfo.init
+ * on error.
+ */
BlkInfo query(void *p) nothrow
{
if (!p)
@@ -864,7 +1036,7 @@ class ConservativeGC : GC
}
//
- //
+ // Implementation of query
//
BlkInfo queryNoSync(void *p) nothrow
{
@@ -884,10 +1056,14 @@ class ConservativeGC : GC
/**
- * Verify that pointer p:
- * 1) belongs to this memory pool
- * 2) points to the start of an allocated piece of memory
- * 3) is not on a free list
+ * Performs certain checks on a pointer. These checks will cause asserts to
+ * fail unless the following conditions are met:
+ * 1) The poiinter belongs to this memory pool.
+ * 2) The pointer points to the start of an allocated piece of memory.
+ * 3) The pointer is not on a free list.
+ *
+ * Params:
+ * p = The pointer to be checked.
*/
void check(void *p) nothrow
{
@@ -901,7 +1077,7 @@ class ConservativeGC : GC
//
- //
+ // Implementation of check
//
private void checkNoSync(void *p) nothrow
{
@@ -939,6 +1115,12 @@ class ConservativeGC : GC
}
+ /**
+ * Add p to list of roots. If p is null, no operation is performed.
+ *
+ * Params:
+ * p = A pointer into a GC-managed memory block or null.
+ */
void addRoot(void *p) nothrow @nogc
{
if (!p)
@@ -950,6 +1132,13 @@ class ConservativeGC : GC
}
+ /**
+ * Remove p from list of roots. If p is null or is not a value
+ * previously passed to addRoot() then no operation is performed.
+ *
+ * Params:
+ * p = A pointer into a GC-managed memory block or null.
+ */
void removeRoot(void *p) nothrow @nogc
{
if (!p)
@@ -960,13 +1149,23 @@ class ConservativeGC : GC
gcx.removeRoot(p);
}
-
+ /**
+ * Returns an iterator allowing roots to be traversed via a foreach loop.
+ */
@property RootIterator rootIter() @nogc
{
return &gcx.rootsApply;
}
+ /**
+ * Add range to scan for roots. If p is null or sz is 0, no operation is performed.
+ *
+ * Params:
+ * p = A pointer to a valid memory address or to null.
+ * sz = The size in bytes of the block to add.
+ * ti = TypeInfo to describe the memory.
+ */
void addRange(void *p, size_t sz, const TypeInfo ti = null) nothrow @nogc
{
if (!p || !sz)
@@ -978,6 +1177,14 @@ class ConservativeGC : GC
}
+ /**
+ * Remove range from list of ranges. If p is null or does not represent
+ * a value previously passed to addRange() then no operation is
+ * performed.
+ *
+ * Params:
+ * p = A pointer to a valid memory address or to null.
+ */
void removeRange(void *p) nothrow @nogc
{
if (!p)
@@ -989,12 +1196,21 @@ class ConservativeGC : GC
}
+ /**
+ * Returns an iterator allowing ranges to be traversed via a foreach loop.
+ */
@property RangeIterator rangeIter() @nogc
{
return &gcx.rangesApply;
}
+ /**
+ * Run all finalizers in the code segment.
+ *
+ * Params:
+ * segment = address range of a code segment
+ */
void runFinalizers(const scope void[] segment) nothrow
{
static void go(Gcx* gcx, const scope void[] segment) nothrow
@@ -1024,8 +1240,10 @@ class ConservativeGC : GC
/**
- * Do full garbage collection.
- * Return number of pages free'd.
+ * Begins a full collection, scanning all stack segments for roots.
+ *
+ * Returns:
+ * The number of pages freed.
*/
size_t fullCollect() nothrow
{
@@ -1054,7 +1272,7 @@ class ConservativeGC : GC
/**
- * do full garbage collection ignoring roots
+ * Begins a full collection while ignoring all stack segments for roots.
*/
void fullCollectNoStack() nothrow
{
@@ -1068,6 +1286,9 @@ class ConservativeGC : GC
}
+ /**
+ * Minimize free space usage.
+ */
void minimize() nothrow
{
static void go(Gcx* gcx) nothrow
@@ -1109,7 +1330,7 @@ class ConservativeGC : GC
//
- //
+ // Implementation of getStats
//
private void getStatsNoSync(out core.memory.GC.Stats stats) nothrow
{
diff --git a/libphobos/libdruntime/core/internal/gc/os.d b/libphobos/libdruntime/core/internal/gc/os.d
index ca4cbe2..64f1203 100644
--- a/libphobos/libdruntime/core/internal/gc/os.d
+++ b/libphobos/libdruntime/core/internal/gc/os.d
@@ -213,46 +213,38 @@ else
Returns:
true if memory is scarce
*/
-// TOOD: get virtual mem sizes and current usage from OS
+// TODO: get virtual mem sizes and current usage from OS
// TODO: compare current RSS and avail. physical memory
-version (Windows)
+bool isLowOnMem(size_t mapped) nothrow @nogc
{
- bool isLowOnMem(size_t mapped) nothrow @nogc
+ version (Windows)
{
- version (D_LP64)
+ import core.sys.windows.winbase : GlobalMemoryStatusEx, MEMORYSTATUSEX;
+
+ MEMORYSTATUSEX stat;
+ stat.dwLength = stat.sizeof;
+ const success = GlobalMemoryStatusEx(&stat) != 0;
+ assert(success, "GlobalMemoryStatusEx() failed");
+ if (!success)
return false;
- else
- {
- import core.sys.windows.winbase : GlobalMemoryStatus, MEMORYSTATUS;
- MEMORYSTATUS stat;
- GlobalMemoryStatus(&stat);
- // Less than 5 % of virtual address space available
- return stat.dwAvailVirtual < stat.dwTotalVirtual / 20;
- }
+
+ // dwMemoryLoad is the 'approximate percentage of physical memory that is in use'
+ // https://docs.microsoft.com/en-us/windows/win32/api/sysinfoapi/ns-sysinfoapi-memorystatusex
+ const percentPhysicalRAM = stat.ullTotalPhys / 100;
+ return (stat.dwMemoryLoad >= 95 && mapped > percentPhysicalRAM)
+ || (stat.dwMemoryLoad >= 90 && mapped > 10 * percentPhysicalRAM);
}
-}
-else version (Darwin)
-{
- bool isLowOnMem(size_t mapped) nothrow @nogc
+ else
{
enum GB = 2 ^^ 30;
version (D_LP64)
return false;
- else
+ else version (Darwin)
{
// 80 % of available 4GB is used for GC (excluding malloc and mmap)
enum size_t limit = 4UL * GB * 8 / 10;
return mapped > limit;
}
- }
-}
-else
-{
- bool isLowOnMem(size_t mapped) nothrow @nogc
- {
- enum GB = 2 ^^ 30;
- version (D_LP64)
- return false;
else
{
// be conservative and assume 3GB
diff --git a/libphobos/libdruntime/core/internal/hash.d b/libphobos/libdruntime/core/internal/hash.d
index e999f0c..ef9f1e5 100644
--- a/libphobos/libdruntime/core/internal/hash.d
+++ b/libphobos/libdruntime/core/internal/hash.d
@@ -646,13 +646,8 @@ size_t hashOf(T)(T aa) if (!is(T == enum) && __traits(isAssociativeArray, T))
size_t h = 0;
// The computed hash is independent of the foreach traversal order.
- foreach (key, ref val; aa)
- {
- size_t[2] hpair;
- hpair[0] = key.hashOf();
- hpair[1] = val.hashOf();
- h += hpair.hashOf();
- }
+ foreach (ref key, ref val; aa)
+ h += hashOf(hashOf(val), hashOf(key));
return h;
}
diff --git a/libphobos/libdruntime/core/internal/parseoptions.d b/libphobos/libdruntime/core/internal/parseoptions.d
index 4e5105d..9920443 100644
--- a/libphobos/libdruntime/core/internal/parseoptions.d
+++ b/libphobos/libdruntime/core/internal/parseoptions.d
@@ -4,7 +4,7 @@
* Copyright: Copyright Digital Mars 2017
* License: $(HTTP www.boost.org/LICENSE_1_0.txt, Boost License 1.0).
*
-* Source: $(DRUNTIMESRC src/core/internal/parseoptions.d)
+* Source: $(DRUNTIMESRC core/internal/parseoptions.d)
*/
module core.internal.parseoptions;
diff --git a/libphobos/libdruntime/core/internal/traits.d b/libphobos/libdruntime/core/internal/traits.d
index 1856eb8..60d9be3 100644
--- a/libphobos/libdruntime/core/internal/traits.d
+++ b/libphobos/libdruntime/core/internal/traits.d
@@ -14,7 +14,7 @@ template Fields(T)
{
static if (is(T == struct) || is(T == union))
alias Fields = typeof(T.tupleof[0 .. $ - __traits(isNested, T)]);
- else static if (is(T == class))
+ else static if (is(T == class) || is(T == interface))
alias Fields = typeof(T.tupleof);
else
alias Fields = AliasSeq!T;
@@ -326,7 +326,7 @@ template hasElaborateAssign(S)
template hasIndirections(T)
{
static if (is(T == struct) || is(T == union))
- enum hasIndirections = anySatisfy!(.hasIndirections, Fields!T);
+ enum hasIndirections = anySatisfy!(.hasIndirections, typeof(T.tupleof));
else static if (is(T == E[N], E, size_t N))
enum hasIndirections = T.sizeof && is(E == void) ? true : hasIndirections!(BaseElemOf!E);
else static if (isFunctionPointer!T)
@@ -367,6 +367,10 @@ unittest
static assert( hasUnsharedIndirections!(Foo*));
static assert(!hasUnsharedIndirections!(shared(Foo)*));
static assert(!hasUnsharedIndirections!(immutable(Foo)*));
+
+ int local;
+ struct HasContextPointer { int opCall() { return ++local; } }
+ static assert(hasIndirections!HasContextPointer);
}
enum bool isAggregateType(T) = is(T == struct) || is(T == union) ||
diff --git a/libphobos/libdruntime/core/internal/util/array.d b/libphobos/libdruntime/core/internal/util/array.d
index bc9b72c..6136cfe 100644
--- a/libphobos/libdruntime/core/internal/util/array.d
+++ b/libphobos/libdruntime/core/internal/util/array.d
@@ -13,6 +13,17 @@ import core.internal.string;
import core.stdc.stdint;
+// TLS storage shared for all error messages.
+private align(2 * size_t.sizeof) char[256] _store;
+
+private char[] errorMessage(Args...)(scope const(char*) format,
+ const char[] action, Args args) @trusted
+{
+ import core.stdc.stdio : snprintf;
+ snprintf(&_store[0], _store.sizeof, format, &action[0], args);
+ return _store;
+}
+
@safe /* pure dmd @@@BUG11461@@@ */ nothrow:
void enforceTypedArraysConformable(T)(const char[] action,
@@ -65,6 +76,44 @@ private void _enforceNoOverlap(const char[] action,
assert(0, msg);
}
+void enforceTypedArraysConformableNogc(T)(const char[] action,
+ const T[] a1, const T[] a2, const bool allowOverlap = false)
+{
+ _enforceSameLengthNogc(action, a1.length, a2.length);
+ if (!allowOverlap)
+ _enforceNoOverlapNogc(action, arrayToPtr(a1), arrayToPtr(a2), T.sizeof * a1.length);
+}
+
+void enforceRawArraysConformableNogc(const char[] action, const size_t elementSize,
+ const void[] a1, const void[] a2, const bool allowOverlap = false)
+{
+ _enforceSameLengthNogc(action, a1.length, a2.length);
+ if (!allowOverlap)
+ _enforceNoOverlapNogc(action, arrayToPtr(a1), arrayToPtr(a2), elementSize * a1.length);
+}
+
+private void _enforceNoOverlapNogc(const ref char[] action,
+ uintptr_t ptr1, uintptr_t ptr2, const size_t bytes)
+{
+ const d = ptr1 > ptr2 ? ptr1 - ptr2 : ptr2 - ptr1;
+ if (d >= bytes)
+ return;
+ const overlappedBytes = bytes - d;
+
+ assert(0, errorMessage("Overlapping arrays in %s: %zu byte(s) overlap of %zu",
+ action, overlappedBytes, bytes));
+}
+
+private void _enforceSameLengthNogc(const ref char[] action,
+ const size_t length1, const size_t length2)
+{
+ if (length1 == length2)
+ return;
+
+ assert(0, errorMessage("Array lengths don't match for %s: %zu != %zu",
+ action, length1, length2));
+}
+
private uintptr_t arrayToPtr(const void[] array) @trusted
{
// Ok because the user will never dereference the pointer
diff --git a/libphobos/libdruntime/core/lifetime.d b/libphobos/libdruntime/core/lifetime.d
index fc47b1d..d93b891 100644
--- a/libphobos/libdruntime/core/lifetime.d
+++ b/libphobos/libdruntime/core/lifetime.d
@@ -2124,7 +2124,9 @@ private void moveEmplaceImpl(T)(scope ref T target, return scope ref T source)
() @trusted { memset(&source, 0, sz); }();
else
{
- auto init = typeid(T).initializer();
+ import core.internal.lifetime : emplaceInitializer;
+ ubyte[T.sizeof] init = void;
+ emplaceInitializer(*(() @trusted { return cast(T*)init.ptr; }()));
() @trusted { memcpy(&source, init.ptr, sz); }();
}
}
diff --git a/libphobos/libdruntime/core/runtime.d b/libphobos/libdruntime/core/runtime.d
index bfb72e0..b08ec52 100644
--- a/libphobos/libdruntime/core/runtime.d
+++ b/libphobos/libdruntime/core/runtime.d
@@ -848,6 +848,7 @@ else static if (hasExecinfo) private class DefaultTraceInfo : Throwable.TraceInf
version (linux) enum enableDwarf = true;
else version (FreeBSD) enum enableDwarf = true;
else version (DragonFlyBSD) enum enableDwarf = true;
+ else version (OpenBSD) enum enableDwarf = true;
else version (Darwin) enum enableDwarf = true;
else enum enableDwarf = false;
diff --git a/libphobos/libdruntime/core/stdc/stdlib.d b/libphobos/libdruntime/core/stdc/stdlib.d
index 35e81a2..2f11a66 100644
--- a/libphobos/libdruntime/core/stdc/stdlib.d
+++ b/libphobos/libdruntime/core/stdc/stdlib.d
@@ -9,7 +9,7 @@
* (See accompanying file LICENSE)
* Authors: Sean Kelly
* Standards: ISO/IEC 9899:1999 (E)
- * Source: $(DRUNTIMESRC src/core/stdc/_stdlib.d)
+ * Source: $(DRUNTIMESRC core/stdc/_stdlib.d)
*/
module core.stdc.stdlib;
diff --git a/libphobos/libdruntime/core/sync/rwmutex.d b/libphobos/libdruntime/core/sync/rwmutex.d
index 89ef667..07c5bdb 100644
--- a/libphobos/libdruntime/core/sync/rwmutex.d
+++ b/libphobos/libdruntime/core/sync/rwmutex.d
@@ -86,7 +86,7 @@ class ReadWriteMutex
* Throws:
* SyncError on error.
*/
- this( Policy policy = Policy.PREFER_WRITERS )
+ this( Policy policy = Policy.PREFER_WRITERS ) @safe nothrow
{
m_commonMutex = new Mutex;
if ( !m_commonMutex )
@@ -105,6 +105,26 @@ class ReadWriteMutex
m_writer = new Writer;
}
+ /// ditto
+ shared this( Policy policy = Policy.PREFER_WRITERS ) @safe nothrow
+ {
+ m_commonMutex = new shared Mutex;
+ if ( !m_commonMutex )
+ throw new SyncError( "Unable to initialize mutex" );
+
+ m_readerQueue = new shared Condition( m_commonMutex );
+ if ( !m_readerQueue )
+ throw new SyncError( "Unable to initialize mutex" );
+
+ m_writerQueue = new shared Condition( m_commonMutex );
+ if ( !m_writerQueue )
+ throw new SyncError( "Unable to initialize mutex" );
+
+ m_policy = policy;
+ m_reader = new shared Reader;
+ m_writer = new shared Writer;
+ }
+
////////////////////////////////////////////////////////////////////////////
// General Properties
////////////////////////////////////////////////////////////////////////////
@@ -116,11 +136,16 @@ class ReadWriteMutex
* Returns:
* The policy used by this mutex.
*/
- @property Policy policy()
+ @property Policy policy() @safe nothrow
{
return m_policy;
}
+ ///ditto
+ @property Policy policy() shared @safe nothrow
+ {
+ return m_policy;
+ }
////////////////////////////////////////////////////////////////////////////
// Reader/Writer Handles
@@ -133,11 +158,16 @@ class ReadWriteMutex
* Returns:
* A reader sub-mutex.
*/
- @property Reader reader()
+ @property Reader reader() @safe nothrow
{
return m_reader;
}
+ ///ditto
+ @property shared(Reader) reader() shared @safe nothrow
+ {
+ return m_reader;
+ }
/**
* Gets an object representing the writer lock for the associated mutex.
@@ -145,7 +175,13 @@ class ReadWriteMutex
* Returns:
* A writer sub-mutex.
*/
- @property Writer writer()
+ @property Writer writer() @safe nothrow
+ {
+ return m_writer;
+ }
+
+ ///ditto
+ @property shared(Writer) writer() shared @safe nothrow
{
return m_writer;
}
@@ -166,13 +202,13 @@ class ReadWriteMutex
/**
* Initializes a read/write mutex reader proxy object.
*/
- this()
+ this(this Q)() @trusted nothrow
+ if (is(Q == Reader) || is(Q == shared Reader))
{
m_proxy.link = this;
- this.__monitor = &m_proxy;
+ this.__monitor = cast(void*) &m_proxy;
}
-
/**
* Acquires a read lock on the enclosing mutex.
*/
@@ -189,6 +225,19 @@ class ReadWriteMutex
}
}
+ /// ditto
+ @trusted void lock() shared
+ {
+ synchronized( m_commonMutex )
+ {
+ ++(cast()m_numQueuedReaders);
+ scope(exit) --(cast()m_numQueuedReaders);
+
+ while ( shouldQueueReader )
+ m_readerQueue.wait();
+ ++(cast()m_numActiveReaders);
+ }
+ }
/**
* Releases a read lock on the enclosing mutex.
@@ -205,6 +254,18 @@ class ReadWriteMutex
}
}
+ /// ditto
+ @trusted void unlock() shared
+ {
+ synchronized( m_commonMutex )
+ {
+ if ( --(cast()m_numActiveReaders) < 1 )
+ {
+ if ( m_numQueuedWriters > 0 )
+ m_writerQueue.notify();
+ }
+ }
+ }
/**
* Attempts to acquire a read lock on the enclosing mutex. If one can
@@ -214,7 +275,7 @@ class ReadWriteMutex
* Returns:
* true if the lock was acquired and false if not.
*/
- bool tryLock()
+ @trusted bool tryLock()
{
synchronized( m_commonMutex )
{
@@ -225,6 +286,18 @@ class ReadWriteMutex
}
}
+ /// ditto
+ @trusted bool tryLock() shared
+ {
+ synchronized( m_commonMutex )
+ {
+ if ( shouldQueueReader )
+ return false;
+ ++(cast()m_numActiveReaders);
+ return true;
+ }
+ }
+
/**
* Attempts to acquire a read lock on the enclosing mutex. If one can
* be obtained without blocking, the lock is acquired and true is
@@ -237,7 +310,7 @@ class ReadWriteMutex
* Returns:
* true if the lock was acquired and false if not.
*/
- bool tryLock(Duration timeout)
+ @trusted bool tryLock(Duration timeout)
{
synchronized( m_commonMutex )
{
@@ -270,9 +343,34 @@ class ReadWriteMutex
}
}
+ /// ditto
+ @trusted bool tryLock(Duration timeout) shared
+ {
+ const initialTime = MonoTime.currTime;
+ synchronized( m_commonMutex )
+ {
+ ++(cast()m_numQueuedReaders);
+ scope(exit) --(cast()m_numQueuedReaders);
+
+ while (shouldQueueReader)
+ {
+ const timeElapsed = MonoTime.currTime - initialTime;
+ if (timeElapsed >= timeout)
+ return false;
+ auto nextWait = timeout - timeElapsed;
+ // Avoid problems calling wait(Duration) with huge arguments.
+ enum maxWaitPerCall = dur!"hours"(24 * 365);
+ m_readerQueue.wait(nextWait < maxWaitPerCall ? nextWait : maxWaitPerCall);
+ }
+ ++(cast()m_numActiveReaders);
+ return true;
+ }
+ }
+
private:
- @property bool shouldQueueReader()
+ @property bool shouldQueueReader(this Q)() nothrow @safe @nogc
+ if (is(Q == Reader) || is(Q == shared Reader))
{
if ( m_numActiveWriters > 0 )
return true;
@@ -314,10 +412,11 @@ class ReadWriteMutex
/**
* Initializes a read/write mutex writer proxy object.
*/
- this()
+ this(this Q)() @trusted nothrow
+ if (is(Q == Writer) || is(Q == shared Writer))
{
m_proxy.link = this;
- this.__monitor = &m_proxy;
+ this.__monitor = cast(void*) &m_proxy;
}
@@ -337,6 +436,20 @@ class ReadWriteMutex
}
}
+ /// ditto
+ @trusted void lock() shared
+ {
+ synchronized( m_commonMutex )
+ {
+ ++(cast()m_numQueuedWriters);
+ scope(exit) --(cast()m_numQueuedWriters);
+
+ while ( shouldQueueWriter )
+ m_writerQueue.wait();
+ ++(cast()m_numActiveWriters);
+ }
+ }
+
/**
* Releases a write lock on the enclosing mutex.
@@ -366,6 +479,32 @@ class ReadWriteMutex
}
}
+ /// ditto
+ @trusted void unlock() shared
+ {
+ synchronized( m_commonMutex )
+ {
+ if ( --(cast()m_numActiveWriters) < 1 )
+ {
+ switch ( m_policy )
+ {
+ default:
+ case Policy.PREFER_READERS:
+ if ( m_numQueuedReaders > 0 )
+ m_readerQueue.notifyAll();
+ else if ( m_numQueuedWriters > 0 )
+ m_writerQueue.notify();
+ break;
+ case Policy.PREFER_WRITERS:
+ if ( m_numQueuedWriters > 0 )
+ m_writerQueue.notify();
+ else if ( m_numQueuedReaders > 0 )
+ m_readerQueue.notifyAll();
+ }
+ }
+ }
+ }
+
/**
* Attempts to acquire a write lock on the enclosing mutex. If one can
@@ -375,7 +514,7 @@ class ReadWriteMutex
* Returns:
* true if the lock was acquired and false if not.
*/
- bool tryLock()
+ @trusted bool tryLock()
{
synchronized( m_commonMutex )
{
@@ -386,6 +525,18 @@ class ReadWriteMutex
}
}
+ /// ditto
+ @trusted bool tryLock() shared
+ {
+ synchronized( m_commonMutex )
+ {
+ if ( shouldQueueWriter )
+ return false;
+ ++(cast()m_numActiveWriters);
+ return true;
+ }
+ }
+
/**
* Attempts to acquire a write lock on the enclosing mutex. If one can
* be obtained without blocking, the lock is acquired and true is
@@ -398,7 +549,7 @@ class ReadWriteMutex
* Returns:
* true if the lock was acquired and false if not.
*/
- bool tryLock(Duration timeout)
+ @trusted bool tryLock(Duration timeout)
{
synchronized( m_commonMutex )
{
@@ -431,8 +582,33 @@ class ReadWriteMutex
}
}
+ /// ditto
+ @trusted bool tryLock(Duration timeout) shared
+ {
+ const initialTime = MonoTime.currTime;
+ synchronized( m_commonMutex )
+ {
+ ++(cast()m_numQueuedWriters);
+ scope(exit) --(cast()m_numQueuedWriters);
+
+ while (shouldQueueWriter)
+ {
+ const timeElapsed = MonoTime.currTime - initialTime;
+ if (timeElapsed >= timeout)
+ return false;
+ auto nextWait = timeout - timeElapsed;
+ // Avoid problems calling wait(Duration) with huge arguments.
+ enum maxWaitPerCall = dur!"hours"(24 * 365);
+ m_writerQueue.wait(nextWait < maxWaitPerCall ? nextWait : maxWaitPerCall);
+ }
+ ++(cast()m_numActiveWriters);
+ return true;
+ }
+ }
+
private:
- @property bool shouldQueueWriter()
+ @property bool shouldQueueWriter(this Q)()
+ if (is(Q == Writer) || is(Q == shared Writer))
{
if ( m_numActiveWriters > 0 ||
m_numActiveReaders > 0 )
@@ -691,3 +867,215 @@ unittest
otherThread.join;
}
}
+
+unittest
+{
+ import core.atomic, core.thread, core.sync.semaphore;
+
+ static void runTest(ReadWriteMutex.Policy policy)
+ {
+ shared scope mutex = new shared ReadWriteMutex(policy);
+ scope rdSemA = new Semaphore, rdSemB = new Semaphore,
+ wrSemA = new Semaphore, wrSemB = new Semaphore;
+ shared size_t numReaders, numWriters;
+
+ void readerFn()
+ {
+ synchronized (mutex.reader)
+ {
+ atomicOp!"+="(numReaders, 1);
+ rdSemA.notify();
+ rdSemB.wait();
+ atomicOp!"-="(numReaders, 1);
+ }
+ }
+
+ void writerFn()
+ {
+ synchronized (mutex.writer)
+ {
+ atomicOp!"+="(numWriters, 1);
+ wrSemA.notify();
+ wrSemB.wait();
+ atomicOp!"-="(numWriters, 1);
+ }
+ }
+
+ void waitQueued(size_t queuedReaders, size_t queuedWriters)
+ {
+ for (;;)
+ {
+ synchronized (mutex.m_commonMutex)
+ {
+ if (mutex.m_numQueuedReaders == queuedReaders &&
+ mutex.m_numQueuedWriters == queuedWriters)
+ break;
+ }
+ Thread.yield();
+ }
+ }
+
+ scope group = new ThreadGroup;
+
+ // 2 simultaneous readers
+ group.create(&readerFn); group.create(&readerFn);
+ rdSemA.wait(); rdSemA.wait();
+ assert(numReaders == 2);
+ rdSemB.notify(); rdSemB.notify();
+ group.joinAll();
+ assert(numReaders == 0);
+ foreach (t; group) group.remove(t);
+
+ // 1 writer at a time
+ group.create(&writerFn); group.create(&writerFn);
+ wrSemA.wait();
+ assert(!wrSemA.tryWait());
+ assert(numWriters == 1);
+ wrSemB.notify();
+ wrSemA.wait();
+ assert(numWriters == 1);
+ wrSemB.notify();
+ group.joinAll();
+ assert(numWriters == 0);
+ foreach (t; group) group.remove(t);
+
+ // reader and writer are mutually exclusive
+ group.create(&readerFn);
+ rdSemA.wait();
+ group.create(&writerFn);
+ waitQueued(0, 1);
+ assert(!wrSemA.tryWait());
+ assert(numReaders == 1 && numWriters == 0);
+ rdSemB.notify();
+ wrSemA.wait();
+ assert(numReaders == 0 && numWriters == 1);
+ wrSemB.notify();
+ group.joinAll();
+ assert(numReaders == 0 && numWriters == 0);
+ foreach (t; group) group.remove(t);
+
+ // writer and reader are mutually exclusive
+ group.create(&writerFn);
+ wrSemA.wait();
+ group.create(&readerFn);
+ waitQueued(1, 0);
+ assert(!rdSemA.tryWait());
+ assert(numReaders == 0 && numWriters == 1);
+ wrSemB.notify();
+ rdSemA.wait();
+ assert(numReaders == 1 && numWriters == 0);
+ rdSemB.notify();
+ group.joinAll();
+ assert(numReaders == 0 && numWriters == 0);
+ foreach (t; group) group.remove(t);
+
+ // policy determines whether queued reader or writers progress first
+ group.create(&writerFn);
+ wrSemA.wait();
+ group.create(&readerFn);
+ group.create(&writerFn);
+ waitQueued(1, 1);
+ assert(numReaders == 0 && numWriters == 1);
+ wrSemB.notify();
+
+ if (policy == ReadWriteMutex.Policy.PREFER_READERS)
+ {
+ rdSemA.wait();
+ assert(numReaders == 1 && numWriters == 0);
+ rdSemB.notify();
+ wrSemA.wait();
+ assert(numReaders == 0 && numWriters == 1);
+ wrSemB.notify();
+ }
+ else if (policy == ReadWriteMutex.Policy.PREFER_WRITERS)
+ {
+ wrSemA.wait();
+ assert(numReaders == 0 && numWriters == 1);
+ wrSemB.notify();
+ rdSemA.wait();
+ assert(numReaders == 1 && numWriters == 0);
+ rdSemB.notify();
+ }
+ group.joinAll();
+ assert(numReaders == 0 && numWriters == 0);
+ foreach (t; group) group.remove(t);
+ }
+ runTest(ReadWriteMutex.Policy.PREFER_READERS);
+ runTest(ReadWriteMutex.Policy.PREFER_WRITERS);
+}
+
+unittest
+{
+ import core.atomic, core.thread;
+ shared static ReadWriteMutex rwmutex;
+ shared static bool threadTriedOnceToGetLock;
+ shared static bool threadFinallyGotLock;
+
+ rwmutex = new shared ReadWriteMutex();
+ atomicFence;
+ const maxTimeAllowedForTest = dur!"seconds"(20);
+ // Test ReadWriteMutex.Reader.tryLock(Duration).
+ {
+ static void testReaderTryLock()
+ {
+ assert(!rwmutex.reader.tryLock(Duration.min));
+ threadTriedOnceToGetLock.atomicStore(true);
+ assert(rwmutex.reader.tryLock(Duration.max));
+ threadFinallyGotLock.atomicStore(true);
+ rwmutex.reader.unlock;
+ }
+ assert(rwmutex.writer.tryLock(Duration.zero), "should have been able to obtain lock without blocking");
+ auto otherThread = new Thread(&testReaderTryLock).start;
+ const failIfThisTimeisReached = MonoTime.currTime + maxTimeAllowedForTest;
+ Thread.yield;
+ // We started otherThread with the writer lock held so otherThread's
+ // first rwlock.reader.tryLock with timeout Duration.min should fail.
+ while (!threadTriedOnceToGetLock.atomicLoad)
+ {
+ assert(MonoTime.currTime < failIfThisTimeisReached, "timed out");
+ Thread.yield;
+ }
+ rwmutex.writer.unlock;
+ // Soon after we release the writer lock otherThread's second
+ // rwlock.reader.tryLock with timeout Duration.max should succeed.
+ while (!threadFinallyGotLock.atomicLoad)
+ {
+ assert(MonoTime.currTime < failIfThisTimeisReached, "timed out");
+ Thread.yield;
+ }
+ otherThread.join;
+ }
+ threadTriedOnceToGetLock.atomicStore(false); // Reset.
+ threadFinallyGotLock.atomicStore(false); // Reset.
+ // Test ReadWriteMutex.Writer.tryLock(Duration).
+ {
+ static void testWriterTryLock()
+ {
+ assert(!rwmutex.writer.tryLock(Duration.min));
+ threadTriedOnceToGetLock.atomicStore(true);
+ assert(rwmutex.writer.tryLock(Duration.max));
+ threadFinallyGotLock.atomicStore(true);
+ rwmutex.writer.unlock;
+ }
+ assert(rwmutex.reader.tryLock(Duration.zero), "should have been able to obtain lock without blocking");
+ auto otherThread = new Thread(&testWriterTryLock).start;
+ const failIfThisTimeisReached = MonoTime.currTime + maxTimeAllowedForTest;
+ Thread.yield;
+ // We started otherThread with the reader lock held so otherThread's
+ // first rwlock.writer.tryLock with timeout Duration.min should fail.
+ while (!threadTriedOnceToGetLock.atomicLoad)
+ {
+ assert(MonoTime.currTime < failIfThisTimeisReached, "timed out");
+ Thread.yield;
+ }
+ rwmutex.reader.unlock;
+ // Soon after we release the reader lock otherThread's second
+ // rwlock.writer.tryLock with timeout Duration.max should succeed.
+ while (!threadFinallyGotLock.atomicLoad)
+ {
+ assert(MonoTime.currTime < failIfThisTimeisReached, "timed out");
+ Thread.yield;
+ }
+ otherThread.join;
+ }
+}
diff --git a/libphobos/libdruntime/core/sys/freebsd/config.d b/libphobos/libdruntime/core/sys/freebsd/config.d
index 4eda066..5e3129e 100644
--- a/libphobos/libdruntime/core/sys/freebsd/config.d
+++ b/libphobos/libdruntime/core/sys/freebsd/config.d
@@ -13,7 +13,9 @@ public import core.sys.posix.config;
// __FreeBSD_version numbers are documented in the Porter's Handbook.
// NOTE: When adding newer versions of FreeBSD, verify all current versioned
// bindings are still compatible with the release.
- version (FreeBSD_12) enum __FreeBSD_version = 1202000;
+
+ version (FreeBSD_13) enum __FreeBSD_version = 1300000;
+else version (FreeBSD_12) enum __FreeBSD_version = 1202000;
else version (FreeBSD_11) enum __FreeBSD_version = 1104000;
else version (FreeBSD_10) enum __FreeBSD_version = 1004000;
else version (FreeBSD_9) enum __FreeBSD_version = 903000;
diff --git a/libphobos/libdruntime/core/sys/linux/fs.d b/libphobos/libdruntime/core/sys/linux/fs.d
index 5faa756..c5525066 100644
--- a/libphobos/libdruntime/core/sys/linux/fs.d
+++ b/libphobos/libdruntime/core/sys/linux/fs.d
@@ -154,39 +154,42 @@ enum {
S_XFLAG_HASATTR = 0x80000000, /// no DIFLAG for this
}
-enum BLKROSET = _IO(0x12, 93); /// set device read-only
-enum BLKROGET = _IO(0x12, 94); /// get read-only status
-enum BLKRRPART = _IO(0x12, 95); /// re-read partition table
-enum BLKGETSIZE = _IO(0x12, 96); /// return device size
-enum BLKFLSBUF = _IO(0x12, 97); /// flush buffer cache
-enum BLKRASET = _IO(0x12, 98); /// set read ahead for block device
-enum BLKRAGET = _IO(0x12, 99); /// get current read ahead setting
-enum BLKFRASET = _IO(0x12, 100); /// set filesystem
-enum BLKFRAGET = _IO(0x12, 101); /// get filesystem
-enum BLKSECTSET = _IO(0x12, 102); /// set max sectors per request
-enum BLKSECTGET = _IO(0x12, 103); /// get max sectors per request
-enum BLKSSZGET = _IO(0x12, 104); /// get block device sector size
+static if (__traits(compiles, _IO(1, 2)))
+{
+ enum BLKROSET = _IO(0x12, 93); /// set device read-only
+ enum BLKROGET = _IO(0x12, 94); /// get read-only status
+ enum BLKRRPART = _IO(0x12, 95); /// re-read partition table
+ enum BLKGETSIZE = _IO(0x12, 96); /// return device size
+ enum BLKFLSBUF = _IO(0x12, 97); /// flush buffer cache
+ enum BLKRASET = _IO(0x12, 98); /// set read ahead for block device
+ enum BLKRAGET = _IO(0x12, 99); /// get current read ahead setting
+ enum BLKFRASET = _IO(0x12, 100); /// set filesystem
+ enum BLKFRAGET = _IO(0x12, 101); /// get filesystem
+ enum BLKSECTSET = _IO(0x12, 102); /// set max sectors per request
+ enum BLKSECTGET = _IO(0x12, 103); /// get max sectors per request
+ enum BLKSSZGET = _IO(0x12, 104); /// get block device sector size
-enum BLKBSZGET = _IOR!size_t(0x12, 112);
-enum BLKBSZSET = _IOW!size_t(0x12, 113);
-enum BLKGETSIZE64 = _IOR!size_t(0x12, 114);
-enum BLKTRACESTART = _IO(0x12, 116);
-enum BLKTRACESTOP = _IO(0x12, 117);
-enum BLKTRACETEARDOWN = _IO(0x12, 118);
-enum BLKDISCARD = _IO(0x12, 119);
-enum BLKIOMIN = _IO(0x12, 120);
-enum BLKIOOPT = _IO(0x12, 121);
-enum BLKALIGNOFF = _IO(0x12, 122);
-enum BLKPBSZGET = _IO(0x12, 123);
-enum BLKDISCARDZEROES = _IO(0x12, 124);
-enum BLKSECDISCARD = _IO(0x12, 125);
-enum BLKROTATIONAL = _IO(0x12, 126);
-enum BLKZEROOUT = _IO(0x12, 127);
+ enum BLKBSZGET = _IOR!size_t(0x12, 112);
+ enum BLKBSZSET = _IOW!size_t(0x12, 113);
+ enum BLKGETSIZE64 = _IOR!size_t(0x12, 114);
+ enum BLKTRACESTART = _IO(0x12, 116);
+ enum BLKTRACESTOP = _IO(0x12, 117);
+ enum BLKTRACETEARDOWN = _IO(0x12, 118);
+ enum BLKDISCARD = _IO(0x12, 119);
+ enum BLKIOMIN = _IO(0x12, 120);
+ enum BLKIOOPT = _IO(0x12, 121);
+ enum BLKALIGNOFF = _IO(0x12, 122);
+ enum BLKPBSZGET = _IO(0x12, 123);
+ enum BLKDISCARDZEROES = _IO(0x12, 124);
+ enum BLKSECDISCARD = _IO(0x12, 125);
+ enum BLKROTATIONAL = _IO(0x12, 126);
+ enum BLKZEROOUT = _IO(0x12, 127);
-enum BMAP_IOCTL = 1; /// obsolete - kept for compatibility
-enum FIBMAP = _IO(0x00, 1); /// bmap access
-enum FIGETBSZ = _IO(0x00, 2); /// get the block size used for bmap
+ enum BMAP_IOCTL = 1; /// obsolete - kept for compatibility
+ enum FIBMAP = _IO(0x00, 1); /// bmap access
+ enum FIGETBSZ = _IO(0x00, 2); /// get the block size used for bmap
+}
enum FSLABEL_MAX = 256; /// Max chars for the interface; each fs may differ
diff --git a/libphobos/libdruntime/core/sys/linux/perf_event.d b/libphobos/libdruntime/core/sys/linux/perf_event.d
index 805b47e..9e96a7f 100644
--- a/libphobos/libdruntime/core/sys/linux/perf_event.d
+++ b/libphobos/libdruntime/core/sys/linux/perf_event.d
@@ -2073,8 +2073,6 @@ else
struct
{
- import std.bitmanip : bitfields;
-
/* mixin(bitfields!(ulong, "mem_rsvd", 24, ulong, "mem_snoopx", 2, ulong,
"mem_remote", 1, ulong, "mem_lvl_num", 4, ulong, "mem_dtlb", 7, ulong,
"mem_lock", 2, ulong, "mem_snoop", 5, ulong, "mem_lvl",
diff --git a/libphobos/libdruntime/core/sys/linux/sys/mman.d b/libphobos/libdruntime/core/sys/linux/sys/mman.d
index 20e8cf2..a6548a7 100644
--- a/libphobos/libdruntime/core/sys/linux/sys/mman.d
+++ b/libphobos/libdruntime/core/sys/linux/sys/mman.d
@@ -32,7 +32,7 @@ public import core.sys.posix.sys.mman;
import core.sys.linux.config;
// <bits/mman.h>
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/powerpc/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/powerpc/bits/mman.h
version (PPC_Any)
{
enum PROT_SAO = 0x10;
@@ -57,7 +57,7 @@ version (PPC_Any)
// MCL_FUTURE = 0x4000,
// }
}
-// https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/riscv/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/riscv/bits/mman.h
else version (RISCV_Any)
{
static if (__USE_MISC) enum
@@ -82,7 +82,7 @@ else version (RISCV_Any)
// MCL_FUTURE = 0x4000,
// }
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/s390/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/s390/bits/mman.h
else version (IBMZ_Any)
{
static if (__USE_MISC) enum
@@ -98,7 +98,7 @@ else version (IBMZ_Any)
MAP_HUGETLB = 0x40000,
}
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/sh/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sh/bits/mman.h
else version (SH)
{
static if (__USE_MISC) enum
@@ -114,7 +114,7 @@ else version (SH)
MAP_HUGETLB = 0x40000,
}
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/sparc/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sparc/bits/mman.h
else version (SPARC_Any)
{
static if (__USE_MISC) enum
@@ -138,7 +138,7 @@ else version (SPARC_Any)
// MCL_FUTURE = 0x4000,
// }
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/x86/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/x86/bits/mman.h
else version (X86_Any)
{
static if (__USE_MISC) enum MAP_32BIT = 0x40;
@@ -156,7 +156,7 @@ else version (X86_Any)
MAP_HUGETLB = 0x40000,
}
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/aarch64/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/aarch64/bits/mman.h
else version (AArch64)
{
static if (__USE_MISC) enum
@@ -172,7 +172,7 @@ else version (AArch64)
MAP_HUGETLB = 0x40000,
}
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/alpha/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/alpha/bits/mman.h
else version (Alpha)
{
enum
@@ -264,7 +264,7 @@ else version (Alpha)
// POSIX_MADV_DONTNEED = 6,
// }
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/arm/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/arm/bits/mman.h
else version (ARM)
{
static if (__USE_MISC) enum
@@ -280,7 +280,7 @@ else version (ARM)
MAP_HUGETLB = 0x40000,
}
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/hppa/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/hppa/bits/mman.h
else version (HPPA_Any)
{
enum
@@ -384,7 +384,7 @@ else version (HPPA_Any)
// POSIX_MADV_DONTNEED = 4,
// }
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/ia64/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/ia64/bits/mman.h
else version (IA64)
{
static if (__USE_MISC) enum
@@ -401,7 +401,7 @@ else version (IA64)
MAP_HUGETLB = 0x40000,
}
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/m68k/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/m68k/bits/mman.h
else version (M68K)
{
static if (__USE_MISC) enum
@@ -417,7 +417,7 @@ else version (M68K)
MAP_HUGETLB = 0x40000,
}
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/mips/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/mips/bits/mman.h
else version (MIPS_Any)
{
static if (__USE_MISC) enum
@@ -440,7 +440,7 @@ else
// <bits/mman-linux.h>
-// https://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=bits/mman-linux.h
+// https://sourceware.org/git/?p=glibc.git;a=blob;f=bits/mman-linux.h
version (Alpha)
{
}
@@ -527,12 +527,12 @@ else
}
// Workaround https://issues.dlang.org/show_bug.cgi?id=17883
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/sparc/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/sparc/bits/mman.h
version (SPARC_Any)
{
static if (__USE_MISC) enum MAP_RENAME = MAP_ANONYMOUS;
}
-// http://sourceware.org/git/?p=glibc.git;a=blob;hb=51e945a8f950a6695754b11c1e6fba8bb750e100;f=sysdeps/unix/sysv/linux/mips/bits/mman.h
+// http://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/unix/sysv/linux/mips/bits/mman.h
else version (MIPS_Any)
{
static if (__USE_MISC) enum MAP_RENAME = MAP_ANONYMOUS;
diff --git a/libphobos/libdruntime/core/sys/linux/syscalls.d b/libphobos/libdruntime/core/sys/linux/syscalls.d
new file mode 100644
index 0000000..8c65371
--- /dev/null
+++ b/libphobos/libdruntime/core/sys/linux/syscalls.d
@@ -0,0 +1,745 @@
+module core.sys.linux.syscalls;
+
+version (linux):
+extern (C):
+@system:
+nothrow:
+@nogc:
+
+import core.stdc.config : c_long;
+
+version (CoreDdoc)
+{
+ /// Linux system call number from Linux's asm/unistd.h
+ enum SystemCall : c_long;
+}
+else version (X86_64)
+{
+ // https://github.com/torvalds/linux/blob/v4.14/arch/sh/include/uapi/asm/unistd_64.h
+ // https://github.com/torvalds/linux/blob/v4.14/arch/x86/entry/syscalls/syscall_64.tbl
+ enum SystemCall : c_long
+ {
+ read = 0,
+ write = 1,
+ open = 2,
+ close = 3,
+ stat = 4,
+ fstat = 5,
+ lstat = 6,
+ poll = 7,
+ lseek = 8,
+ mmap = 9,
+ mprotect = 10,
+ munmap = 11,
+ brk = 12,
+ rt_sigaction = 13,
+ rt_sigprocmask = 14,
+ rt_sigreturn = 15,
+ ioctl = 16,
+ pread64 = 17,
+ pwrite64 = 18,
+ readv = 19,
+ writev = 20,
+ access = 21,
+ pipe = 22,
+ select = 23,
+ sched_yield = 24,
+ mremap = 25,
+ msync = 26,
+ mincore = 27,
+ madvise = 28,
+ shmget = 29,
+ shmat = 30,
+ shmctl = 31,
+ dup = 32,
+ dup2 = 33,
+ pause = 34,
+ nanosleep = 35,
+ getitimer = 36,
+ alarm = 37,
+ setitimer = 38,
+ getpid = 39,
+ sendfile = 40,
+ socket = 41,
+ connect = 42,
+ accept = 43,
+ sendto = 44,
+ recvfrom = 45,
+ sendmsg = 46,
+ recvmsg = 47,
+ shutdown = 48,
+ bind = 49,
+ listen = 50,
+ getsockname = 51,
+ getpeername = 52,
+ socketpair = 53,
+ setsockopt = 54,
+ getsockopt = 55,
+ clone = 56,
+ fork = 57,
+ vfork = 58,
+ execve = 59,
+ exit = 60,
+ wait4 = 61,
+ kill = 62,
+ uname = 63,
+ semget = 64,
+ semop = 65,
+ semctl = 66,
+ shmdt = 67,
+ msgget = 68,
+ msgsnd = 69,
+ msgrcv = 70,
+ msgctl = 71,
+ fcntl = 72,
+ flock = 73,
+ fsync = 74,
+ fdatasync = 75,
+ truncate = 76,
+ ftruncate = 77,
+ getdents = 78,
+ getcwd = 79,
+ chdir = 80,
+ fchdir = 81,
+ rename = 82,
+ mkdir = 83,
+ rmdir = 84,
+ creat = 85,
+ link = 86,
+ unlink = 87,
+ symlink = 88,
+ readlink = 89,
+ chmod = 90,
+ fchmod = 91,
+ chown = 92,
+ fchown = 93,
+ lchown = 94,
+ umask = 95,
+ gettimeofday = 96,
+ getrlimit = 97,
+ getrusage = 98,
+ sysinfo = 99,
+ times = 100,
+ ptrace = 101,
+ getuid = 102,
+ syslog = 103,
+ getgid = 104,
+ setuid = 105,
+ setgid = 106,
+ geteuid = 107,
+ getegid = 108,
+ setpgid = 109,
+ getppid = 110,
+ getpgrp = 111,
+ setsid = 112,
+ setreuid = 113,
+ setregid = 114,
+ getgroups = 115,
+ setgroups = 116,
+ setresuid = 117,
+ getresuid = 118,
+ setresgid = 119,
+ getresgid = 120,
+ getpgid = 121,
+ setfsuid = 122,
+ setfsgid = 123,
+ getsid = 124,
+ capget = 125,
+ capset = 126,
+ rt_sigpending = 127,
+ rt_sigtimedwait = 128,
+ rt_sigqueueinfo = 129,
+ rt_sigsuspend = 130,
+ sigaltstack = 131,
+ utime = 132,
+ mknod = 133,
+ uselib = 134,
+ personality = 135,
+ ustat = 136,
+ statfs = 137,
+ fstatfs = 138,
+ sysfs = 139,
+ getpriority = 140,
+ setpriority = 141,
+ sched_setparam = 142,
+ sched_getparam = 143,
+ sched_setscheduler = 144,
+ sched_getscheduler = 145,
+ sched_get_priority_max = 146,
+ sched_get_priority_min = 147,
+ sched_rr_get_interval = 148,
+ mlock = 149,
+ munlock = 150,
+ mlockall = 151,
+ munlockall = 152,
+ vhangup = 153,
+ modify_ldt = 154,
+ pivot_root = 155,
+ _sysctl = 156,
+ prctl = 157,
+ arch_prctl = 158,
+ adjtimex = 159,
+ setrlimit = 160,
+ chroot = 161,
+ sync = 162,
+ acct = 163,
+ settimeofday = 164,
+ mount = 165,
+ umount2 = 166,
+ swapon = 167,
+ swapoff = 168,
+ reboot = 169,
+ sethostname = 170,
+ setdomainname = 171,
+ iopl = 172,
+ ioperm = 173,
+ create_module = 174,
+ init_module = 175,
+ delete_module = 176,
+ get_kernel_syms = 177,
+ query_module = 178,
+ quotactl = 179,
+ nfsservctl = 180,
+ getpmsg = 181,
+ putpmsg = 182,
+ afs_syscall = 183,
+ tuxcall = 184,
+ security = 185,
+ gettid = 186,
+ readahead = 187,
+ setxattr = 188,
+ lsetxattr = 189,
+ fsetxattr = 190,
+ getxattr = 191,
+ lgetxattr = 192,
+ fgetxattr = 193,
+ listxattr = 194,
+ llistxattr = 195,
+ flistxattr = 196,
+ removexattr = 197,
+ lremovexattr = 198,
+ fremovexattr = 199,
+ tkill = 200,
+ time = 201,
+ futex = 202,
+ sched_setaffinity = 203,
+ sched_getaffinity = 204,
+ set_thread_area = 205,
+ io_setup = 206,
+ io_destroy = 207,
+ io_getevents = 208,
+ io_submit = 209,
+ io_cancel = 210,
+ get_thread_area = 211,
+ lookup_dcookie = 212,
+ epoll_create = 213,
+ epoll_ctl_old = 214,
+ epoll_wait_old = 215,
+ remap_file_pages = 216,
+ getdents64 = 217,
+ set_tid_address = 218,
+ restart_syscall = 219,
+ semtimedop = 220,
+ fadvise64 = 221,
+ timer_create = 222,
+ timer_settime = 223,
+ timer_gettime = 224,
+ timer_getoverrun = 225,
+ timer_delete = 226,
+ clock_settime = 227,
+ clock_gettime = 228,
+ clock_getres = 229,
+ clock_nanosleep = 230,
+ exit_group = 231,
+ epoll_wait = 232,
+ epoll_ctl = 233,
+ tgkill = 234,
+ utimes = 235,
+ vserver = 236,
+ mbind = 237,
+ set_mempolicy = 238,
+ get_mempolicy = 239,
+ mq_open = 240,
+ mq_unlink = 241,
+ mq_timedsend = 242,
+ mq_timedreceive = 243,
+ mq_notify = 244,
+ mq_getsetattr = 245,
+ kexec_load = 246,
+ waitid = 247,
+ add_key = 248,
+ request_key = 249,
+ keyctl = 250,
+ ioprio_set = 251,
+ ioprio_get = 252,
+ inotify_init = 253,
+ inotify_add_watch = 254,
+ inotify_rm_watch = 255,
+ migrate_pages = 256,
+ openat = 257,
+ mkdirat = 258,
+ mknodat = 259,
+ fchownat = 260,
+ futimesat = 261,
+ newfstatat = 262,
+ unlinkat = 263,
+ renameat = 264,
+ linkat = 265,
+ symlinkat = 266,
+ readlinkat = 267,
+ fchmodat = 268,
+ faccessat = 269,
+ pselect6 = 270,
+ ppoll = 271,
+ unshare = 272,
+ set_robust_list = 273,
+ get_robust_list = 274,
+ splice = 275,
+ tee = 276,
+ sync_file_range = 277,
+ vmsplice = 278,
+ move_pages = 279,
+ utimensat = 280,
+ epoll_pwait = 281,
+ signalfd = 282,
+ timerfd_create = 283,
+ eventfd = 284,
+ fallocate = 285,
+ timerfd_settime = 286,
+ timerfd_gettime = 287,
+ accept4 = 288,
+ signalfd4 = 289,
+ eventfd2 = 290,
+ epoll_create1 = 291,
+ dup3 = 292,
+ pipe2 = 293,
+ inotify_init1 = 294,
+ preadv = 295,
+ pwritev = 296,
+ rt_tgsigqueueinfo = 297,
+ perf_event_open = 298,
+ recvmmsg = 299,
+ fanotify_init = 300,
+ fanotify_mark = 301,
+ prlimit64 = 302,
+ name_to_handle_at = 303,
+ open_by_handle_at = 304,
+ clock_adjtime = 305,
+ syncfs = 306,
+ sendmmsg = 307,
+ setns = 308,
+ getcpu = 309,
+ process_vm_readv = 310,
+ process_vm_writev = 311,
+ kcmp = 312,
+ finit_module = 313,
+ sched_setattr = 314,
+ sched_getattr = 315,
+ renameat2 = 316,
+ seccomp = 317,
+ getrandom = 318,
+ memfd_create = 319,
+ kexec_file_load = 320,
+ bpf = 321,
+ execveat = 322,
+ userfaultfd = 323,
+ membarrier = 324,
+ mlock2 = 325,
+ copy_file_range = 326,
+ preadv2 = 327,
+ pwritev2 = 328,
+ pkey_mprotect = 329,
+ pkey_alloc = 330,
+ pkey_free = 331,
+ statx = 332,
+ }
+}
+else version (X86)
+{
+ // https://github.com/torvalds/linux/blob/master/arch/x86/entry/syscalls/syscall_32.tbl
+ // https://github.com/torvalds/linux/blob/v4.14/arch/sh/include/uapi/asm/unistd_32.h
+ enum SystemCall : c_long
+ {
+ restart_syscall = 0,
+ exit = 1,
+ fork = 2,
+ read = 3,
+ write = 4,
+ open = 5,
+ close = 6,
+ waitpid = 7,
+ creat = 8,
+ link = 9,
+ unlink = 10,
+ execve = 11,
+ chdir = 12,
+ time = 13,
+ mknod = 14,
+ chmod = 15,
+ lchown = 16,
+ break_ = 17,
+ oldstat = 18,
+ lseek = 19,
+ getpid = 20,
+ mount = 21,
+ umount = 22,
+ setuid = 23,
+ getuid = 24,
+ stime = 25,
+ ptrace = 26,
+ alarm = 27,
+ oldfstat = 28,
+ pause = 29,
+ utime = 30,
+ stty = 31,
+ gtty = 32,
+ access = 33,
+ nice = 34,
+ ftime = 35,
+ sync = 36,
+ kill = 37,
+ rename = 38,
+ mkdir = 39,
+ rmdir = 40,
+ dup = 41,
+ pipe = 42,
+ times = 43,
+ prof = 44,
+ brk = 45,
+ setgid = 46,
+ getgid = 47,
+ signal = 48,
+ geteuid = 49,
+ getegid = 50,
+ acct = 51,
+ umount2 = 52,
+ lock = 53,
+ ioctl = 54,
+ fcntl = 55,
+ mpx = 56,
+ setpgid = 57,
+ ulimit = 58,
+ oldolduname = 59,
+ umask = 60,
+ chroot = 61,
+ ustat = 62,
+ dup2 = 63,
+ getppid = 64,
+ getpgrp = 65,
+ setsid = 66,
+ sigaction = 67,
+ sgetmask = 68,
+ ssetmask = 69,
+ setreuid = 70,
+ setregid = 71,
+ sigsuspend = 72,
+ sigpending = 73,
+ sethostname = 74,
+ setrlimit = 75,
+ getrlimit = 76,
+ getrusage = 77,
+ gettimeofday = 78,
+ settimeofday = 79,
+ getgroups = 80,
+ setgroups = 81,
+ select = 82,
+ symlink = 83,
+ oldlstat = 84,
+ readlink = 85,
+ uselib = 86,
+ swapon = 87,
+ reboot = 88,
+ readdir = 89,
+ mmap = 90,
+ munmap = 91,
+ truncate = 92,
+ ftruncate = 93,
+ fchmod = 94,
+ fchown = 95,
+ getpriority = 96,
+ setpriority = 97,
+ profil = 98,
+ statfs = 99,
+ fstatfs = 100,
+ ioperm = 101,
+ socketcall = 102,
+ syslog = 103,
+ setitimer = 104,
+ getitimer = 105,
+ stat = 106,
+ lstat = 107,
+ fstat = 108,
+ olduname = 109,
+ iopl = 110,
+ vhangup = 111,
+ idle = 112,
+ vm86old = 113,
+ wait4 = 114,
+ swapoff = 115,
+ sysinfo = 116,
+ ipc = 117,
+ fsync = 118,
+ sigreturn = 119,
+ clone = 120,
+ setdomainname = 121,
+ uname = 122,
+ modify_ldt = 123,
+ adjtimex = 124,
+ mprotect = 125,
+ sigprocmask = 126,
+ create_module = 127,
+ init_module = 128,
+ delete_module = 129,
+ get_kernel_syms = 130,
+ quotactl = 131,
+ getpgid = 132,
+ fchdir = 133,
+ bdflush = 134,
+ sysfs = 135,
+ personality = 136,
+ afs_syscall = 137,
+ setfsuid = 138,
+ setfsgid = 139,
+ _llseek = 140,
+ getdents = 141,
+ _newselect = 142,
+ flock = 143,
+ msync = 144,
+ readv = 145,
+ writev = 146,
+ getsid = 147,
+ fdatasync = 148,
+ _sysctl = 149,
+ mlock = 150,
+ munlock = 151,
+ mlockall = 152,
+ munlockall = 153,
+ sched_setparam = 154,
+ sched_getparam = 155,
+ sched_setscheduler = 156,
+ sched_getscheduler = 157,
+ sched_yield = 158,
+ sched_get_priority_max = 159,
+ sched_get_priority_min = 160,
+ sched_rr_get_interval = 161,
+ nanosleep = 162,
+ mremap = 163,
+ setresuid = 164,
+ getresuid = 165,
+ vm86 = 166,
+ query_module = 167,
+ poll = 168,
+ nfsservctl = 169,
+ setresgid = 170,
+ getresgid = 171,
+ prctl = 172,
+ rt_sigreturn = 173,
+ rt_sigaction = 174,
+ rt_sigprocmask = 175,
+ rt_sigpending = 176,
+ rt_sigtimedwait = 177,
+ rt_sigqueueinfo = 178,
+ rt_sigsuspend = 179,
+ pread64 = 180,
+ pwrite64 = 181,
+ chown = 182,
+ getcwd = 183,
+ capget = 184,
+ capset = 185,
+ sigaltstack = 186,
+ sendfile = 187,
+ getpmsg = 188,
+ putpmsg = 189,
+ vfork = 190,
+ ugetrlimit = 191,
+ mmap2 = 192,
+ truncate64 = 193,
+ ftruncate64 = 194,
+ stat64 = 195,
+ lstat64 = 196,
+ fstat64 = 197,
+ lchown32 = 198,
+ getuid32 = 199,
+ getgid32 = 200,
+ geteuid32 = 201,
+ getegid32 = 202,
+ setreuid32 = 203,
+ setregid32 = 204,
+ getgroups32 = 205,
+ setgroups32 = 206,
+ fchown32 = 207,
+ setresuid32 = 208,
+ getresuid32 = 209,
+ setresgid32 = 210,
+ getresgid32 = 211,
+ chown32 = 212,
+ setuid32 = 213,
+ setgid32 = 214,
+ setfsuid32 = 215,
+ setfsgid32 = 216,
+ pivot_root = 217,
+ mincore = 218,
+ madvise = 219,
+ getdents64 = 220,
+ fcntl64 = 221,
+ gettid = 224,
+ readahead = 225,
+ setxattr = 226,
+ lsetxattr = 227,
+ fsetxattr = 228,
+ getxattr = 229,
+ lgetxattr = 230,
+ fgetxattr = 231,
+ listxattr = 232,
+ llistxattr = 233,
+ flistxattr = 234,
+ removexattr = 235,
+ lremovexattr = 236,
+ fremovexattr = 237,
+ tkill = 238,
+ sendfile64 = 239,
+ futex = 240,
+ sched_setaffinity = 241,
+ sched_getaffinity = 242,
+ set_thread_area = 243,
+ get_thread_area = 244,
+ io_setup = 245,
+ io_destroy = 246,
+ io_getevents = 247,
+ io_submit = 248,
+ io_cancel = 249,
+ fadvise64 = 250,
+ exit_group = 252,
+ lookup_dcookie = 253,
+ epoll_create = 254,
+ epoll_ctl = 255,
+ epoll_wait = 256,
+ remap_file_pages = 257,
+ set_tid_address = 258,
+ timer_create = 259,
+ timer_settime = 260,
+ timer_gettime = 261,
+ timer_getoverrun = 262,
+ timer_delete = 263,
+ clock_settime = 264,
+ clock_gettime = 265,
+ clock_getres = 266,
+ clock_nanosleep = 267,
+ statfs64 = 268,
+ fstatfs64 = 269,
+ tgkill = 270,
+ utimes = 271,
+ fadvise64_64 = 272,
+ vserver = 273,
+ mbind = 274,
+ get_mempolicy = 275,
+ set_mempolicy = 276,
+ mq_open = 277,
+ mq_unlink = 278,
+ mq_timedsend = 279,
+ mq_timedreceive = 280,
+ mq_notify = 281,
+ mq_getsetattr = 282,
+ kexec_load = 283,
+ waitid = 284,
+ add_key = 286,
+ request_key = 287,
+ keyctl = 288,
+ ioprio_set = 289,
+ ioprio_get = 290,
+ inotify_init = 291,
+ inotify_add_watch = 292,
+ inotify_rm_watch = 293,
+ migrate_pages = 294,
+ openat = 295,
+ mkdirat = 296,
+ mknodat = 297,
+ fchownat = 298,
+ futimesat = 299,
+ fstatat64 = 300,
+ unlinkat = 301,
+ renameat = 302,
+ linkat = 303,
+ symlinkat = 304,
+ readlinkat = 305,
+ fchmodat = 306,
+ faccessat = 307,
+ pselect6 = 308,
+ ppoll = 309,
+ unshare = 310,
+ set_robust_list = 311,
+ get_robust_list = 312,
+ splice = 313,
+ sync_file_range = 314,
+ tee = 315,
+ vmsplice = 316,
+ move_pages = 317,
+ getcpu = 318,
+ epoll_pwait = 319,
+ utimensat = 320,
+ signalfd = 321,
+ timerfd_create = 322,
+ eventfd = 323,
+ fallocate = 324,
+ timerfd_settime = 325,
+ timerfd_gettime = 326,
+ signalfd4 = 327,
+ eventfd2 = 328,
+ epoll_create1 = 329,
+ dup3 = 330,
+ pipe2 = 331,
+ inotify_init1 = 332,
+ preadv = 333,
+ pwritev = 334,
+ rt_tgsigqueueinfo = 335,
+ perf_event_open = 336,
+ recvmmsg = 337,
+ fanotify_init = 338,
+ fanotify_mark = 339,
+ prlimit64 = 340,
+ name_to_handle_at = 341,
+ open_by_handle_at = 342,
+ clock_adjtime = 343,
+ syncfs = 344,
+ sendmmsg = 345,
+ setns = 346,
+ process_vm_readv = 347,
+ process_vm_writev = 348,
+ kcmp = 349,
+ finit_module = 350,
+ sched_setattr = 351,
+ sched_getattr = 352,
+ renameat2 = 353,
+ seccomp = 354,
+ getrandom = 355,
+ memfd_create = 356,
+ bpf = 357,
+ execveat = 358,
+ socket = 359,
+ socketpair = 360,
+ bind = 361,
+ connect = 362,
+ listen = 363,
+ accept4 = 364,
+ getsockopt = 365,
+ setsockopt = 366,
+ getsockname = 367,
+ getpeername = 368,
+ sendto = 369,
+ sendmsg = 370,
+ recvfrom = 371,
+ recvmsg = 372,
+ shutdown = 373,
+ userfaultfd = 374,
+ membarrier = 375,
+ mlock2 = 376,
+ copy_file_range = 377,
+ preadv2 = 378,
+ pwritev2 = 379,
+ pkey_mprotect = 380,
+ pkey_alloc = 381,
+ pkey_free = 382,
+ statx = 383,
+ arch_prctl = 384,
+ }
+}
diff --git a/libphobos/libdruntime/core/sys/linux/unistd.d b/libphobos/libdruntime/core/sys/linux/unistd.d
index 4845746..1ef16c1 100644
--- a/libphobos/libdruntime/core/sys/linux/unistd.d
+++ b/libphobos/libdruntime/core/sys/linux/unistd.d
@@ -1,16 +1,20 @@
module core.sys.linux.unistd;
-public import core.sys.posix.unistd;
-
version (linux):
-extern(C):
+extern (C):
nothrow:
@system:
+@nogc:
+
+public import core.sys.posix.unistd;
+public import core.sys.linux.syscalls : SystemCall;
+import core.stdc.config : c_long;
// Additional seek constants for sparse file handling
// from Linux's unistd.h, stdio.h, and linux/fs.h
// (see http://man7.org/linux/man-pages/man2/lseek.2.html)
-enum {
+enum
+{
/// Offset is relative to the next location containing data
SEEK_DATA = 3,
/// Offset is relative to the next hole (or EOF if file is not sparse)
@@ -22,3 +26,17 @@ char* getpass(const(char)* prompt);
// Exit all threads in a process
void exit_group(int status);
+
+/**
+Invoke system call specified by number, passing it the remaining arguments.
+This is completely system-dependent, and not often useful.
+
+In Unix, `syscall' sets `errno' for all errors and most calls return -1
+for errors; in many systems you cannot pass arguments or get return
+values for all system calls (`pipe', `fork', and `getppid' typically
+among them).
+
+In Mach, all system calls take normal arguments and always return an
+error code (zero for success).
+*/
+c_long syscall(SystemCall number, ...) @nogc nothrow;
diff --git a/libphobos/libdruntime/core/sys/openbsd/dlfcn.d b/libphobos/libdruntime/core/sys/openbsd/dlfcn.d
index a8e8565..b28dc63 100644
--- a/libphobos/libdruntime/core/sys/openbsd/dlfcn.d
+++ b/libphobos/libdruntime/core/sys/openbsd/dlfcn.d
@@ -1,7 +1,7 @@
/**
* D header file for OpenBSD.
*
- * $(LINK2 http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/include/link_elf.h?rev=1.6&content-type=text/x-cvsweb-markup, dlfcn.h)
+ * $(LINK2 https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/include/dlfcn.h?rev=1.15&content-type=text/plain, dlfcn.h)
*/
module core.sys.openbsd.dlfcn;
@@ -16,6 +16,7 @@ static assert(RTLD_NOW == 2);
static assert(RTLD_GLOBAL == 0x100);
static assert(RTLD_LOCAL == 0);
enum RTLD_TRACE = 0x200;
+enum RTLD_NODELETE = 0x400;
enum RTLD_NEXT = cast(void *)-1;
enum RTLD_DEFAULT = cast(void *)-2;
@@ -24,6 +25,7 @@ enum RTLD_SELF = cast(void *)-3;
enum DL_GETERRNO = 1;
enum DL_SETTHREADLCK = 2;
enum DL_SETBINDLCK = 3;
+enum DL_REFERENCE = 4;
enum DL_LAZY = RTLD_LAZY;
diff --git a/libphobos/libdruntime/core/sys/openbsd/pthread_np.d b/libphobos/libdruntime/core/sys/openbsd/pthread_np.d
new file mode 100644
index 0000000..8344df2
--- /dev/null
+++ b/libphobos/libdruntime/core/sys/openbsd/pthread_np.d
@@ -0,0 +1,23 @@
+/**
+ * D header file for OpenBSD pthread_np.h.
+ *
+ * Copyright: Copyright © 2021, The D Language Foundation
+ * License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
+ * Authors: Brian Callahan
+ */
+module core.sys.openbsd.pthread_np;
+
+version (OpenBSD):
+extern (C):
+nothrow:
+@nogc:
+
+public import core.sys.posix.sys.types;
+import core.sys.posix.signal : stack_t;
+
+int pthread_mutexattr_getkind_np(pthread_mutexattr_t);
+int pthread_mutexattr_setkind_np(pthread_mutexattr_t*, int);
+void pthread_get_name_np(pthread_t, char*, size_t);
+void pthread_set_name_np(pthread_t, const(char)*);
+int pthread_stackseg_np(pthread_t, stack_t*);
+int pthread_main_np();
diff --git a/libphobos/libdruntime/core/sys/openbsd/stdlib.d b/libphobos/libdruntime/core/sys/openbsd/stdlib.d
index 2d4d7a9..c8c2b1b 100644
--- a/libphobos/libdruntime/core/sys/openbsd/stdlib.d
+++ b/libphobos/libdruntime/core/sys/openbsd/stdlib.d
@@ -13,5 +13,11 @@ extern (C):
nothrow:
@nogc:
+void freezero(void*, size_t);
+void* calloc_conceal(size_t, size_t);
+void* malloc_conceal(size_t);
+void* reallocarray(void*, size_t, size_t);
+void* recallocarray(void*, size_t, size_t, size_t);
+
const(char)* getprogname();
-void setprogname(scope const char* name);
+void setprogname(scope const char*);
diff --git a/libphobos/libdruntime/core/sys/openbsd/string.d b/libphobos/libdruntime/core/sys/openbsd/string.d
index cb978c8..131e677 100644
--- a/libphobos/libdruntime/core/sys/openbsd/string.d
+++ b/libphobos/libdruntime/core/sys/openbsd/string.d
@@ -17,7 +17,13 @@ nothrow:
static if (__BSD_VISIBLE)
{
+ void explicit_bzero(void*, size_t);
pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
+ void* memrchr(scope const void*, int, size_t);
+ size_t strlcat(char*, scope const char*, size_t);
+ size_t strlcpy(char*, scope const char*, size_t);
+ void strmode(int, char*);
+ char* strsep(char**, scope const char*);
pure int timingsafe_bcmp(scope const void*, scope const void*, size_t);
pure int timingsafe_memcmp(scope const void*, scope const void*, size_t);
}
diff --git a/libphobos/libdruntime/core/sys/openbsd/sys/mman.d b/libphobos/libdruntime/core/sys/openbsd/sys/mman.d
index 0e88207..7654834 100644
--- a/libphobos/libdruntime/core/sys/openbsd/sys/mman.d
+++ b/libphobos/libdruntime/core/sys/openbsd/sys/mman.d
@@ -19,11 +19,12 @@ import core.sys.posix.sys.types;
// enum MAP_PRIVATE = 0x0002;
// enum MAP_FIXED = 0x0010;
// enum MAP_ANON = 0x1000;
+// enum MAP_STACK = 0x4000;
alias MAP_ANONYMOUS = MAP_ANON;
-enum MAP_STACK = 0x4000;
+enum MAP_CONCEAL = 0x8000;
-enum MAP_FLAGMASK = 0x7ff7;
+enum MAP_FLAGMASK = 0xfff7;
alias MAP_COPY = MAP_PRIVATE;
enum MAP_FILE = 0;
@@ -45,7 +46,6 @@ static if (__BSD_VISIBLE)
enum MADV_FREE = 6;
int madvise(void *, size_t, int);
- int mincore(const(void) *, size_t, char *);
int minherit(void *, size_t, int);
void* mquery(void *, size_t, int, int, int, off_t);
}
diff --git a/libphobos/libdruntime/core/sys/openbsd/sys/sysctl.d b/libphobos/libdruntime/core/sys/openbsd/sys/sysctl.d
index c6f9845..3a45242 100644
--- a/libphobos/libdruntime/core/sys/openbsd/sys/sysctl.d
+++ b/libphobos/libdruntime/core/sys/openbsd/sys/sysctl.d
@@ -250,5 +250,4 @@ enum
}
///
-int sysctl(const int* name, uint namelen, void* oldp, size_t* oldlenp,
- const void* newp, size_t newlen);
+int sysctl(const int*, uint, void*, size_t*, void*, size_t);
diff --git a/libphobos/libdruntime/core/sys/openbsd/unistd.d b/libphobos/libdruntime/core/sys/openbsd/unistd.d
index ddd102c..0b8580f 100644
--- a/libphobos/libdruntime/core/sys/openbsd/unistd.d
+++ b/libphobos/libdruntime/core/sys/openbsd/unistd.d
@@ -6,12 +6,12 @@
* Authors: Brian Callahan
*/
module core.sys.openbsd.unistd;
-public import core.sys.posix.unistd;
version (OpenBSD):
extern (C):
nothrow:
@nogc:
+int getentropy(void*, size_t);
int pledge(const scope char*, const scope char*);
int unveil(const scope char*, const scope char*);
diff --git a/libphobos/libdruntime/core/sys/posix/netdb.d b/libphobos/libdruntime/core/sys/posix/netdb.d
index bede638..d1411ea 100644
--- a/libphobos/libdruntime/core/sys/posix/netdb.d
+++ b/libphobos/libdruntime/core/sys/posix/netdb.d
@@ -567,6 +567,7 @@ else version (OpenBSD)
enum AI_NUMERICHOST = 0x4;
enum AI_EXT = 0x8;
enum AI_NUMERICSERV = 0x10;
+ enum AI_V4MAPPED = 0; // Not supported
enum AI_FQDN = 0x20;
enum AI_ADDRCONFIG = 0x40;
enum AI_MASK = AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_NUMERICSERV | AI_FQDN | AI_ADDRCONFIG;
diff --git a/libphobos/libdruntime/core/sys/posix/sys/filio.d b/libphobos/libdruntime/core/sys/posix/sys/filio.d
index afb6f82..a8d837c 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/filio.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/filio.d
@@ -34,3 +34,15 @@ version (Darwin)
enum uint FIOGETOWN = _IOR!(int)('f', 123); // get owner
enum uint FIODTYPE = _IOR!(int)('f', 122); // get d_type
}
+
+version (OpenBSD)
+{
+ // File-descriptor ioctl's
+ enum uint FIOCLEX = _IO('f', 1); // set close on exec on fd
+ enum uint FIONCLEX = _IO('f', 2); // remove close on exec
+ enum uint FIONREAD = _IOR!(int)('f', 127); // get # bytes to read
+ enum uint FIONBIO = _IOW!(int)('f', 126); // set/clear non-blocking i/o
+ enum uint FIOASYNC = _IOW!(int)('f', 125); // set/clear async i/o
+ enum uint FIOSETOWN = _IOW!(int)('f', 124); // set owner
+ enum uint FIOGETOWN = _IOR!(int)('f', 123); // get owner
+}
diff --git a/libphobos/libdruntime/core/sys/posix/sys/ioccom.d b/libphobos/libdruntime/core/sys/posix/sys/ioccom.d
index 4c1a820..4a0e96b 100755
--- a/libphobos/libdruntime/core/sys/posix/sys/ioccom.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/ioccom.d
@@ -137,3 +137,59 @@ else version (FreeBSD)
return _IOC(IOC_INOUT, cast(uint)g, cast(uint)n, T.sizeof);
}
}
+else version (OpenBSD)
+{
+ /* OpenBSD ioctl's encode the command in the lower 16-bits
+ * and the size of any in/out parameters in the lower 13 bits of the upper
+ * 16-bits of a 32 bit unsigned integer. The high 3 bits of the upper
+ * 16-bits encode the in/out status of the parameter.
+ */
+ enum uint IOCPARM_MASK = 0x1fff; // parameter length mask
+ uint IOCPARM_LEN(uint x) // to extract the encoded parameter length
+ {
+ return ((x >> 16) & IOCPARM_MASK);
+ }
+ uint IOCBASECMD(uint x) // to extract the encoded command
+ {
+ return (x & ~(IOCPARM_MASK << 16));
+ }
+ uint IOCGROUP(uint x) // to extract the encoded group
+ {
+ return ((x >> 8) & 0xff);
+ }
+
+ enum uint IOCPARM_MAX = (1 << 12); // max size of ioctl args
+
+ enum uint IOC_VOID = 0x20000000; // no parameters
+ enum uint IOC_OUT = 0x40000000; // copy parameters back
+ enum uint IOC_IN = 0x80000000; // copy parameters into
+ enum uint IOC_INOUT = (IOC_IN | IOC_OUT);
+ enum uint IOC_DIRMASK = 0xe0000000;
+
+ // encode the ioctl info into 32 bits
+ uint _IOC(uint inorout, uint group, uint num, size_t len)
+ {
+ return (inorout | ((len & IOCPARM_MASK) << 16) | (group << 8) | num);
+ }
+
+ // encode a command with no parameters
+ uint _IO(char g, int n)
+ {
+ return _IOC(IOC_VOID, cast(uint)g, cast(uint)n, cast(size_t)0);
+ }
+ // encode a command that returns info
+ uint _IOR(T)(char g, int n)
+ {
+ return _IOC(IOC_OUT, cast(uint)g, cast(uint)n, T.sizeof);
+ }
+ // encode a command that takes info
+ uint _IOW(T)(char g, int n)
+ {
+ return _IOC(IOC_IN, cast(uint)g, cast(uint)n, T.sizeof);
+ }
+ // encode a command that takes info and returns info
+ uint _IOWR(T)(char g, int n)
+ {
+ return _IOC(IOC_INOUT, cast(uint)g, cast(uint)n, T.sizeof);
+ }
+}
diff --git a/libphobos/libdruntime/core/sys/posix/sys/ioctl.d b/libphobos/libdruntime/core/sys/posix/sys/ioctl.d
index 0266200..c6f21d6 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/ioctl.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/ioctl.d
@@ -375,6 +375,11 @@ else version (NetBSD)
}
else version (OpenBSD)
{
+ import core.sys.posix.termios; // termios
+ import core.sys.posix.sys.time; // timeval
+
+ public import core.sys.posix.sys.ttycom; // Terminal related ioctls
+
struct winsize
{
ushort ws_row;
@@ -383,6 +388,8 @@ else version (OpenBSD)
ushort ws_ypixel;
}
+ public import core.sys.posix.sys.filio; // File related ioctls
+
int ioctl(int, c_ulong, ...);
}
else version (DragonFlyBSD)
diff --git a/libphobos/libdruntime/core/sys/posix/sys/mman.d b/libphobos/libdruntime/core/sys/posix/sys/mman.d
index a74a213..18da102 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/mman.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/mman.d
@@ -460,6 +460,7 @@ else version (OpenBSD)
enum MAP_PRIVATE = 0x0002;
enum MAP_FIXED = 0x0010;
enum MAP_ANON = 0x1000;
+ enum MAP_STACK = 0x4000;
enum MAP_FAILED = cast(void*)-1;
diff --git a/libphobos/libdruntime/core/sys/posix/sys/socket.d b/libphobos/libdruntime/core/sys/posix/sys/socket.d
index 430d0c0..de51c6a 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/socket.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/socket.d
@@ -536,7 +536,8 @@ version (CRuntime_Glibc)
enum
{
- SOMAXCONN = 128
+ // https://sourceware.org/git/?p=glibc.git;a=commit;f=sysdeps/unix/sysv/linux/bits/socket.h;h=96958e2700f5b4f4d1183a0606b2b9848a53ea44
+ SOMAXCONN = 4096
}
enum : uint
diff --git a/libphobos/libdruntime/core/sys/posix/sys/ttycom.d b/libphobos/libdruntime/core/sys/posix/sys/ttycom.d
index 1a6c11b..0cc2d9c 100755
--- a/libphobos/libdruntime/core/sys/posix/sys/ttycom.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/ttycom.d
@@ -214,3 +214,104 @@ else version (FreeBSD)
enum uint NETGRAPHDISC = 6; // Netgraph tty node discipline
enum uint H4DISC = 7; // Netgraph Blutooth H4 discipline
}
+else version (OpenBSD)
+{
+ struct winsize {
+ ushort ws_row; // rows, in characters
+ ushort ws_col; // columns, in characters
+ ushort ws_xpixel; // horizontal size, pixels
+ ushort ws_ypixel; // vertical size, pixels
+ }
+
+ struct tstamps {
+ int ts_set; // TIOCM_CAR and/or TIOCM_CTS
+ int ts_clr;
+ }
+
+ // Serial/TTY ioctl's
+ // 0-2 compat
+ // 3-7 unused
+ // 8-10 compat
+ // 11-12 unused
+ enum uint TIOCEXCL = _IO('t', 13); // set exclusive use of tty
+ enum uint TIOCNXCL = _IO('t', 14); // reset exclusive use of tty
+ enum uint TIOCFLUSH = _IOW!(int)('t', 16); // flush buffers
+ // 17-18 compat
+ enum uint TIOCGETA = _IOR!(termios)('t', 19); // get termios struct
+ enum uint TIOCSETA = _IOW!(termios)('t', 20); // set termios struct
+ enum uint TIOCSETAW = _IOW!(termios)('t', 21); // drain output, set
+ enum uint TIOCSETAF = _IOW!(termios)('t', 22); // drn out, fls in, set
+ // 23-25 unused
+ enum uint TIOCGETD = _IOR!(int)('t', 26); // get line discipline
+ enum uint TIOCSETD = _IOW!(int)('t', 27); // set line discipline
+ enum uint TIOCSETVERAUTH = _IOW!(int)('t', 28); // set verified auth
+ enum uint TIOCCLRVERAUTH = _IO('t', 29); // clear verified auth
+ enum uint TIOCCHKVERAUTH = _IO('t', 30); // check verified auth
+ // 31-89 unused
+ enum uint TIOCSTSTAMP = _IOW!(tstamps)('t', 90); // timestamp reasons
+ enum uint TIOCGTSTAMP = _IOR!(timeval)('t', 91); // get timestamp
+ // 92-93 device flags
+ enum uint TIOCSFLAGS = _IOW!(int)('t', 92); // set device flags
+ enum uint TIOCGFLAGS = _IOR!(int)('t', 93); // get device flags
+ // 94-97 conflicts: tun and tap
+ enum uint TIOCDRAIN = _IO('t', 94); // wait till output drained
+ enum uint TIOCSIG = _IOW!(int)('t', 95); // pty: generate signal
+ enum uint TIOCEXT = _IOW!(int)('t', 96); // pty: external processing
+ enum uint TIOCSCTTY = _IO('t', 97); // become controlling tty
+ enum uint TIOCCONS = _IOW!(int)('t', 98); // become virtual console
+ enum uint TIOCGSID = _IOR!(int)('t', 99); // get session id
+ // 100 unused
+ enum uint TIOCSTAT = _IO('t', 101); // simulate ^T status message
+ enum uint TIOCUCNTL = _IOW!(int)('t', 102); // pty: set/clr usr cntl mode
+ enum uint UIOCCMD(n) = _IO('u', n); // usr cntl op "n"
+ enum uint TIOCSWINSZ = _IOW!(winsize)('t', 103); // set window size
+ enum uint TIOCGWINSZ = _IOR!(winsize)('t', 104); // get window size
+ enum uint TIOCREMOTE = _IOW!(int)('t', 105); // remote input editing
+ enum uint TIOCMGET = _IOR!(int)('t', 106); // get all modem bits
+ enum uint TIOCM_LE = 0x01; // line enable
+ enum uint TIOCM_DTR = 0x02; // data terminal ready
+ enum uint TIOCM_RTS = 0x04; // request to send
+ enum uint TIOCM_ST = 0x08; // secondary transmit
+ enum uint TIOCM_SR = 0x10; // secondary receive
+ enum uint TIOCM_CTS = 0x20; // clear to send
+ enum uint TIOCM_CAR = 0x40; // carrier detect
+ enum uint TIOCM_RNG = 0x80; // ring
+ enum uint TIOCM_DSR = 0x100; // data set ready
+ enum uint TIOCM_CD = TIOCM_CAR;
+ enum uint TIOCM_RI = TIOCM_RNG;
+ enum uint TIOCMBIC = _IOW!(int)('t', 107); // bic modem bits
+ enum uint TIOCMBIS = _IOW!(int)('t', 108); // bis modem bits
+ enum uint TIOCMSET = _IOW!(int)('t', 109); // set all modem bits
+ enum uint TIOCSTART = _IO('t', 110); // start output like ^Q
+ enum uint TIOCSTOP = _IO('t', 111); // stop output like ^S
+ enum uint TIOCPKT = _IOW!(int)('t', 112); // pty: set/clr packet mode
+ enum uint TIOCPKT_DATA = 0x00; // data packet
+ enum uint TIOCPKT_FLUSHREAD = 0x01; // flush packet
+ enum uint TIOCPKT_FLUSHWRITE = 0x02; // flush packet
+ enum uint TIOCPKT_STOP = 0x04; // stop output
+ enum uint TIOCPKT_START = 0x08; // start output
+ enum uint TIOCPKT_NOSTOP = 0x10; // no more ^S, ^Q
+ enum uint TIOCPKT_DOSTOP = 0x20; // now do ^S, ^Q
+ enum uint TIOCPKT_IOCTL = 0x40; // state change of pty driver
+ enum uint TIOCNOTTY = _IO('t', 113); // void tty association
+ // 114 unused
+ enum uint TIOCOUTQ = _IOR!(int)('t', 115); // output queue size
+ // 116-117 compat
+ enum uint TIOCSPGRP = _IOW!(int)('t', 118); // set pgrp of tty
+ enum uint TIOCGPGRP = _IOR!(int)('t', 119); // get pgrp of tty
+
+ enum uint TIOCCDTR = _IO('t', 120); // clear data terminal ready
+ enum uint TIOCSDTR = _IO('t', 121); // set data terminal ready
+ enum uint TIOCCBRK = _IO('t', 122); // clear break bit
+ enum uint TIOCSBRK = _IO('t', 123); // set break bit
+ // 124-127 compat
+
+ enum uint TTYDISC = 0; // termios tty line discipline
+ enum uint TABLDISC = 3; // tablet description
+ enum uint SLIPDISC = 4; // serial IP discipline
+ enum uint PPPDISC = 5; // PPP discipline
+ enum uint STRIPDISC = 6; // metricom wireless IP discipline
+ enum uint NMEADISC = 7; // NMEA0183 discipline
+ enum uint MSTSDISC = 8; // Meinberg time string discipline
+ enum uint ENDRUNDISC = 9; // Endrun time format discipline
+}
diff --git a/libphobos/libdruntime/core/sys/posix/time.d b/libphobos/libdruntime/core/sys/posix/time.d
index 52a6f92..a9be87c8 100644
--- a/libphobos/libdruntime/core/sys/posix/time.d
+++ b/libphobos/libdruntime/core/sys/posix/time.d
@@ -341,11 +341,6 @@ else version (OpenBSD)
int clock_gettime(clockid_t, timespec*);
int clock_settime(clockid_t, const scope timespec*);
int nanosleep(const scope timespec*, timespec*);
- int timer_create(clockid_t, sigevent*, timer_t*);
- int timer_delete(timer_t);
- int timer_gettime(timer_t, itimerspec*);
- int timer_getoverrun(timer_t);
- int timer_settime(timer_t, int, const scope itimerspec*, itimerspec*);
}
else version (Solaris)
{
diff --git a/libphobos/libdruntime/core/sys/windows/accctrl.d b/libphobos/libdruntime/core/sys/windows/accctrl.d
index 77bc184..e967da6 100644
--- a/libphobos/libdruntime/core/sys/windows/accctrl.d
+++ b/libphobos/libdruntime/core/sys/windows/accctrl.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_accctrl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_accctrl.d)
*/
module core.sys.windows.accctrl;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/aclapi.d b/libphobos/libdruntime/core/sys/windows/aclapi.d
index 1e75d3f..f145ac2 100644
--- a/libphobos/libdruntime/core/sys/windows/aclapi.d
+++ b/libphobos/libdruntime/core/sys/windows/aclapi.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_aclapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_aclapi.d)
*/
module core.sys.windows.aclapi;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/aclui.d b/libphobos/libdruntime/core/sys/windows/aclui.d
index 6ae37c6..c5a2899 100644
--- a/libphobos/libdruntime/core/sys/windows/aclui.d
+++ b/libphobos/libdruntime/core/sys/windows/aclui.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_aclui.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_aclui.d)
*/
module core.sys.windows.aclui;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/basetsd.d b/libphobos/libdruntime/core/sys/windows/basetsd.d
index 3bcac12..0c68902 100644
--- a/libphobos/libdruntime/core/sys/windows/basetsd.d
+++ b/libphobos/libdruntime/core/sys/windows/basetsd.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_basetsd.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_basetsd.d)
*/
module core.sys.windows.basetsd;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/basetyps.d b/libphobos/libdruntime/core/sys/windows/basetyps.d
index abe312e..086e6ab 100644
--- a/libphobos/libdruntime/core/sys/windows/basetyps.d
+++ b/libphobos/libdruntime/core/sys/windows/basetyps.d
@@ -4,7 +4,7 @@
* Translated from MinGW API for MS-Windows 3.10
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_basetyps.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_basetyps.d)
*/
module core.sys.windows.basetyps;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/cderr.d b/libphobos/libdruntime/core/sys/windows/cderr.d
index 278a11c..afcdf27 100644
--- a/libphobos/libdruntime/core/sys/windows/cderr.d
+++ b/libphobos/libdruntime/core/sys/windows/cderr.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_cderr.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_cderr.d)
*/
module core.sys.windows.cderr;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/cguid.d b/libphobos/libdruntime/core/sys/windows/cguid.d
index 8d67b88..0afbc42 100644
--- a/libphobos/libdruntime/core/sys/windows/cguid.d
+++ b/libphobos/libdruntime/core/sys/windows/cguid.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_cguid.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_cguid.d)
*/
module core.sys.windows.cguid;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/comcat.d b/libphobos/libdruntime/core/sys/windows/comcat.d
index cb45ff5..3018c64 100644
--- a/libphobos/libdruntime/core/sys/windows/comcat.d
+++ b/libphobos/libdruntime/core/sys/windows/comcat.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_comcat.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_comcat.d)
*/
module core.sys.windows.comcat;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/commctrl.d b/libphobos/libdruntime/core/sys/windows/commctrl.d
index f008e75..4bc60b1 100644
--- a/libphobos/libdruntime/core/sys/windows/commctrl.d
+++ b/libphobos/libdruntime/core/sys/windows/commctrl.d
@@ -4,7 +4,7 @@
* Translated from MinGW API for MS-Windows 3.12
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_commctrl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_commctrl.d)
*/
module core.sys.windows.commctrl;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/commdlg.d b/libphobos/libdruntime/core/sys/windows/commdlg.d
index 1e8057c..b49d2fb 100644
--- a/libphobos/libdruntime/core/sys/windows/commdlg.d
+++ b/libphobos/libdruntime/core/sys/windows/commdlg.d
@@ -4,7 +4,7 @@
* Translated from MinGW API for MS-Windows 3.12
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_commdlg.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_commdlg.d)
*/
module core.sys.windows.commdlg;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/core.d b/libphobos/libdruntime/core/sys/windows/core.d
index 8b355b3..e8bc4a7 100644
--- a/libphobos/libdruntime/core/sys/windows/core.d
+++ b/libphobos/libdruntime/core/sys/windows/core.d
@@ -2,7 +2,7 @@
* Helper module for the Windows API
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_core.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_core.d)
*/
module core.sys.windows.core;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/cpl.d b/libphobos/libdruntime/core/sys/windows/cpl.d
index b040aad..49ebb20 100644
--- a/libphobos/libdruntime/core/sys/windows/cpl.d
+++ b/libphobos/libdruntime/core/sys/windows/cpl.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_cpl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_cpl.d)
*/
module core.sys.windows.cpl;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/cplext.d b/libphobos/libdruntime/core/sys/windows/cplext.d
index c9452fa..e13316b 100644
--- a/libphobos/libdruntime/core/sys/windows/cplext.d
+++ b/libphobos/libdruntime/core/sys/windows/cplext.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_cplext.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_cplext.d)
*/
module core.sys.windows.cplext;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/custcntl.d b/libphobos/libdruntime/core/sys/windows/custcntl.d
index ccfc7ca..c736cb3 100644
--- a/libphobos/libdruntime/core/sys/windows/custcntl.d
+++ b/libphobos/libdruntime/core/sys/windows/custcntl.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_custcntl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_custcntl.d)
*/
module core.sys.windows.custcntl;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/dbt.d b/libphobos/libdruntime/core/sys/windows/dbt.d
index a591152..308c609 100644
--- a/libphobos/libdruntime/core/sys/windows/dbt.d
+++ b/libphobos/libdruntime/core/sys/windows/dbt.d
@@ -5,7 +5,7 @@
*
* Authors: Vladimir Vlasov
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_dbt.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_dbt.d)
*/
module core.sys.windows.dbt;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/dde.d b/libphobos/libdruntime/core/sys/windows/dde.d
index 0e06227..bec339c 100644
--- a/libphobos/libdruntime/core/sys/windows/dde.d
+++ b/libphobos/libdruntime/core/sys/windows/dde.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_dde.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_dde.d)
*/
module core.sys.windows.dde;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/ddeml.d b/libphobos/libdruntime/core/sys/windows/ddeml.d
index 209772f..22b330c 100644
--- a/libphobos/libdruntime/core/sys/windows/ddeml.d
+++ b/libphobos/libdruntime/core/sys/windows/ddeml.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ddeml.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ddeml.d)
*/
module core.sys.windows.ddeml;
version (Windows):
@@ -16,6 +16,11 @@ pragma(lib, "user32");
import core.sys.windows.basetsd, core.sys.windows.windef, core.sys.windows.winnt;
+mixin DECLARE_HANDLE!("HCONVLIST");
+mixin DECLARE_HANDLE!("HCONV");
+mixin DECLARE_HANDLE!("HSZ");
+mixin DECLARE_HANDLE!("HDDEDATA");
+
enum : int {
CP_WINANSI = 1004,
CP_WINUNICODE = 1200
@@ -76,10 +81,13 @@ enum : UINT {
XTYP_SHIFT = 4
}
-/+
-#define TIMEOUT_ASYNC 0xFFFFFFFF
-#define QID_SYNC 0xFFFFFFFF
-+/
+enum : UINT {
+ TIMEOUT_ASYNC = 0xFFFFFFFF
+}
+
+enum : UINT {
+ QID_SYNC = 0xFFFFFFFF
+}
enum : UINT {
ST_CONNECTED = 1,
@@ -93,9 +101,9 @@ enum : UINT {
ST_ISSELF = 256
}
-/+
-#define CADV_LATEACK 0xFFFF
-+/
+enum : UINT {
+ CADV_LATEACK = 0xFFFF
+}
enum : UINT {
DMLERR_NO_ERROR = 0,
@@ -121,22 +129,26 @@ enum : UINT {
DMLERR_LAST = DMLERR_UNFOUND_QUEUE_ID
}
-/+
-#define DDE_FACK 0x8000
-#define DDE_FBUSY 0x4000
-#define DDE_FDEFERUPD 0x4000
-#define DDE_FACKREQ 0x8000
-#define DDE_FRELEASE 0x2000
-#define DDE_FREQUESTED 0x1000
-#define DDE_FAPPSTATUS 0x00ff
-#define DDE_FNOTPROCESSED 0
-#define DDE_FACKRESERVED (~(DDE_FACK|DDE_FBUSY|DDE_FAPPSTATUS))
-#define DDE_FADVRESERVED (~(DDE_FACKREQ|DDE_FDEFERUPD))
-#define DDE_FDATRESERVED (~(DDE_FACKREQ|DDE_FRELEASE|DDE_FREQUESTED))
-#define DDE_FPOKRESERVED (~DDE_FRELEASE)
-#define MSGF_DDEMGR 0x8001
-#define CBR_BLOCK ((HDDEDATA)0xffffffff)
-+/
+enum : UINT {
+ DDE_FACK = 0x8000,
+ DDE_FBUSY = 0x4000,
+ DDE_FDEFERUPD = 0x4000,
+ DDE_FACKREQ = 0x8000,
+ DDE_FRELEASE = 0x2000,
+ DDE_FREQUESTED = 0x1000,
+ DDE_FAPPSTATUS = 0x00ff,
+ DDE_FNOTPROCESSED = 0,
+ DDE_FACKRESERVED = (~(DDE_FACK|DDE_FBUSY|DDE_FAPPSTATUS)),
+ DDE_FADVRESERVED = (~(DDE_FACKREQ|DDE_FDEFERUPD)),
+ DDE_FDATRESERVED = (~(DDE_FACKREQ|DDE_FRELEASE|DDE_FREQUESTED)),
+ DDE_FPOKRESERVED = (~DDE_FRELEASE)
+}
+
+enum : UINT {
+ MSGF_DDEMGR = 0x8001
+}
+
+enum CBR_BLOCK = cast(HDDEDATA)-1;
enum DWORD
APPCLASS_STANDARD = 0,
@@ -180,10 +192,13 @@ enum : UINT {
DNS_FILTEROFF = 8
}
-/+
-#define HDATA_APPOWNED 1
-#define MAX_MONITORS 4
-+/
+enum : UINT {
+ HDATA_APPOWNED = 1
+}
+
+enum : UINT {
+ MAX_MONITORS = 4
+}
enum : int {
MH_CREATE = 1,
@@ -192,11 +207,6 @@ enum : int {
MH_CLEANUP = 4
}
-mixin DECLARE_HANDLE!("HCONVLIST");
-mixin DECLARE_HANDLE!("HCONV");
-mixin DECLARE_HANDLE!("HSZ");
-mixin DECLARE_HANDLE!("HDDEDATA");
-
extern (Windows) alias HDDEDATA
function(UINT, UINT, HCONV, HSZ, HSZ, HDDEDATA, ULONG_PTR, ULONG_PTR) PFNCALLBACK;
diff --git a/libphobos/libdruntime/core/sys/windows/dhcpcsdk.d b/libphobos/libdruntime/core/sys/windows/dhcpcsdk.d
index 7b412c1..0d3d716 100644
--- a/libphobos/libdruntime/core/sys/windows/dhcpcsdk.d
+++ b/libphobos/libdruntime/core/sys/windows/dhcpcsdk.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_dhcpcsdk.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_dhcpcsdk.d)
*/
module core.sys.windows.dhcpcsdk;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/dlgs.d b/libphobos/libdruntime/core/sys/windows/dlgs.d
index 796f027..34cab9b 100644
--- a/libphobos/libdruntime/core/sys/windows/dlgs.d
+++ b/libphobos/libdruntime/core/sys/windows/dlgs.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_dlgs.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_dlgs.d)
*/
module core.sys.windows.dlgs;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/dll.d b/libphobos/libdruntime/core/sys/windows/dll.d
index 8e9d7a0..d602347 100644
--- a/libphobos/libdruntime/core/sys/windows/dll.d
+++ b/libphobos/libdruntime/core/sys/windows/dll.d
@@ -6,7 +6,7 @@
* $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0).
* (See accompanying file LICENSE)
* Authors: Rainer Schuetze
- * Source: $(DRUNTIMESRC src/core/sys/windows/_dll.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_dll.d)
*/
/* NOTE: This file has been patched from the original DMD distribution to
@@ -573,10 +573,10 @@ bool dll_thread_detach( bool detach_thread = true, bool exitTls = true )
/// ---
mixin template SimpleDllMain()
{
- import core.sys.windows.windef : HINSTANCE;
+ import core.sys.windows.windef : HINSTANCE, BOOL, DWORD, LPVOID;
extern(Windows)
- bool DllMain(HINSTANCE hInstance, uint ulReason, void* reserved)
+ BOOL DllMain(HINSTANCE hInstance, DWORD ulReason, LPVOID reserved)
{
import core.sys.windows.winnt;
import core.sys.windows.dll :
diff --git a/libphobos/libdruntime/core/sys/windows/docobj.d b/libphobos/libdruntime/core/sys/windows/docobj.d
index 89d5936..4e45693 100644
--- a/libphobos/libdruntime/core/sys/windows/docobj.d
+++ b/libphobos/libdruntime/core/sys/windows/docobj.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_docobj.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_docobj.d)
*/
module core.sys.windows.docobj;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/errorrep.d b/libphobos/libdruntime/core/sys/windows/errorrep.d
index 2b22e37..63ec8d7 100644
--- a/libphobos/libdruntime/core/sys/windows/errorrep.d
+++ b/libphobos/libdruntime/core/sys/windows/errorrep.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_errorrep.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_errorrep.d)
*/
module core.sys.windows.errorrep;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/exdisp.d b/libphobos/libdruntime/core/sys/windows/exdisp.d
index 1153112..8ee3c26 100644
--- a/libphobos/libdruntime/core/sys/windows/exdisp.d
+++ b/libphobos/libdruntime/core/sys/windows/exdisp.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_exdisp.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_exdisp.d)
*/
module core.sys.windows.exdisp;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/exdispid.d b/libphobos/libdruntime/core/sys/windows/exdispid.d
index fcf04f9..8257476 100644
--- a/libphobos/libdruntime/core/sys/windows/exdispid.d
+++ b/libphobos/libdruntime/core/sys/windows/exdispid.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_exdispid.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_exdispid.d)
*/
module core.sys.windows.exdispid;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/httpext.d b/libphobos/libdruntime/core/sys/windows/httpext.d
index 781d7ce..4e07c6a 100644
--- a/libphobos/libdruntime/core/sys/windows/httpext.d
+++ b/libphobos/libdruntime/core/sys/windows/httpext.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_httpext.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_httpext.d)
*/
module core.sys.windows.httpext;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/idispids.d b/libphobos/libdruntime/core/sys/windows/idispids.d
index 074c3fa..c2d5bec 100644
--- a/libphobos/libdruntime/core/sys/windows/idispids.d
+++ b/libphobos/libdruntime/core/sys/windows/idispids.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_idispids.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_idispids.d)
*/
module core.sys.windows.idispids;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/imagehlp.d b/libphobos/libdruntime/core/sys/windows/imagehlp.d
index f9edba1..ed93746 100644
--- a/libphobos/libdruntime/core/sys/windows/imagehlp.d
+++ b/libphobos/libdruntime/core/sys/windows/imagehlp.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_imagehlp.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_imagehlp.d)
*/
module core.sys.windows.imagehlp;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/imm.d b/libphobos/libdruntime/core/sys/windows/imm.d
index 3ebab30..128fd56 100644
--- a/libphobos/libdruntime/core/sys/windows/imm.d
+++ b/libphobos/libdruntime/core/sys/windows/imm.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_imm.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_imm.d)
*/
module core.sys.windows.imm;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/intshcut.d b/libphobos/libdruntime/core/sys/windows/intshcut.d
index f2f44e1..eab7a8d 100644
--- a/libphobos/libdruntime/core/sys/windows/intshcut.d
+++ b/libphobos/libdruntime/core/sys/windows/intshcut.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_intshcut.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_intshcut.d)
*/
module core.sys.windows.intshcut;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/ipexport.d b/libphobos/libdruntime/core/sys/windows/ipexport.d
index b66aa26..dbb4a0e 100644
--- a/libphobos/libdruntime/core/sys/windows/ipexport.d
+++ b/libphobos/libdruntime/core/sys/windows/ipexport.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ipexport.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ipexport.d)
*/
module core.sys.windows.ipexport;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/iphlpapi.d b/libphobos/libdruntime/core/sys/windows/iphlpapi.d
index 313e40b..f95e799 100644
--- a/libphobos/libdruntime/core/sys/windows/iphlpapi.d
+++ b/libphobos/libdruntime/core/sys/windows/iphlpapi.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_iphlpapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_iphlpapi.d)
*/
module core.sys.windows.iphlpapi;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/ipifcons.d b/libphobos/libdruntime/core/sys/windows/ipifcons.d
index b1de472..09606f5 100644
--- a/libphobos/libdruntime/core/sys/windows/ipifcons.d
+++ b/libphobos/libdruntime/core/sys/windows/ipifcons.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ipifcons.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ipifcons.d)
*/
module core.sys.windows.ipifcons;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/iprtrmib.d b/libphobos/libdruntime/core/sys/windows/iprtrmib.d
index 1d23bc1..3db4539 100644
--- a/libphobos/libdruntime/core/sys/windows/iprtrmib.d
+++ b/libphobos/libdruntime/core/sys/windows/iprtrmib.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_iprtrmib.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_iprtrmib.d)
*/
module core.sys.windows.iprtrmib;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/iptypes.d b/libphobos/libdruntime/core/sys/windows/iptypes.d
index f4f9fe8..7cce34b 100644
--- a/libphobos/libdruntime/core/sys/windows/iptypes.d
+++ b/libphobos/libdruntime/core/sys/windows/iptypes.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_iptypes.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_iptypes.d)
*/
module core.sys.windows.iptypes;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/isguids.d b/libphobos/libdruntime/core/sys/windows/isguids.d
index 61e1d1e..b166c39 100644
--- a/libphobos/libdruntime/core/sys/windows/isguids.d
+++ b/libphobos/libdruntime/core/sys/windows/isguids.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_isguids.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_isguids.d)
*/
module core.sys.windows.isguids;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lm.d b/libphobos/libdruntime/core/sys/windows/lm.d
index e12f629..3d48856 100644
--- a/libphobos/libdruntime/core/sys/windows/lm.d
+++ b/libphobos/libdruntime/core/sys/windows/lm.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lm.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lm.d)
*/
module core.sys.windows.lm;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lmaccess.d b/libphobos/libdruntime/core/sys/windows/lmaccess.d
index 3e1370d..b23e52e 100644
--- a/libphobos/libdruntime/core/sys/windows/lmaccess.d
+++ b/libphobos/libdruntime/core/sys/windows/lmaccess.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmaccess.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmaccess.d)
*/
module core.sys.windows.lmaccess;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lmalert.d b/libphobos/libdruntime/core/sys/windows/lmalert.d
index 675dc89..5ddd6d0 100644
--- a/libphobos/libdruntime/core/sys/windows/lmalert.d
+++ b/libphobos/libdruntime/core/sys/windows/lmalert.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmalert.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmalert.d)
*/
module core.sys.windows.lmalert;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lmapibuf.d b/libphobos/libdruntime/core/sys/windows/lmapibuf.d
index f78271a..e855954 100644
--- a/libphobos/libdruntime/core/sys/windows/lmapibuf.d
+++ b/libphobos/libdruntime/core/sys/windows/lmapibuf.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmapibuf.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmapibuf.d)
*/
module core.sys.windows.lmapibuf;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lmat.d b/libphobos/libdruntime/core/sys/windows/lmat.d
index 1862adf..3e1468a 100644
--- a/libphobos/libdruntime/core/sys/windows/lmat.d
+++ b/libphobos/libdruntime/core/sys/windows/lmat.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmat.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmat.d)
*/
module core.sys.windows.lmat;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lmaudit.d b/libphobos/libdruntime/core/sys/windows/lmaudit.d
index 524332a..f4a7ca2 100644
--- a/libphobos/libdruntime/core/sys/windows/lmaudit.d
+++ b/libphobos/libdruntime/core/sys/windows/lmaudit.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmaudit.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmaudit.d)
*/
// COMMENT: This file may be deprecated.
module core.sys.windows.lmaudit;
diff --git a/libphobos/libdruntime/core/sys/windows/lmbrowsr.d b/libphobos/libdruntime/core/sys/windows/lmbrowsr.d
index 971d8cd..ea0e0f3 100644
--- a/libphobos/libdruntime/core/sys/windows/lmbrowsr.d
+++ b/libphobos/libdruntime/core/sys/windows/lmbrowsr.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmbrowsr.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmbrowsr.d)
*/
module core.sys.windows.lmbrowsr;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lmchdev.d b/libphobos/libdruntime/core/sys/windows/lmchdev.d
index 39d9e78..00aaafc 100644
--- a/libphobos/libdruntime/core/sys/windows/lmchdev.d
+++ b/libphobos/libdruntime/core/sys/windows/lmchdev.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmchdev.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmchdev.d)
*/
module core.sys.windows.lmchdev;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lmconfig.d b/libphobos/libdruntime/core/sys/windows/lmconfig.d
index 6bb2472..57d3ed9 100644
--- a/libphobos/libdruntime/core/sys/windows/lmconfig.d
+++ b/libphobos/libdruntime/core/sys/windows/lmconfig.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmconfig.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmconfig.d)
*/
module core.sys.windows.lmconfig;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lmcons.d b/libphobos/libdruntime/core/sys/windows/lmcons.d
index b115cce..69a63df 100644
--- a/libphobos/libdruntime/core/sys/windows/lmcons.d
+++ b/libphobos/libdruntime/core/sys/windows/lmcons.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmcons.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmcons.d)
*/
module core.sys.windows.lmcons;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lmerr.d b/libphobos/libdruntime/core/sys/windows/lmerr.d
index 77e2378..d50ec49 100644
--- a/libphobos/libdruntime/core/sys/windows/lmerr.d
+++ b/libphobos/libdruntime/core/sys/windows/lmerr.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmerr.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmerr.d)
*/
module core.sys.windows.lmerr;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lmerrlog.d b/libphobos/libdruntime/core/sys/windows/lmerrlog.d
index 8e15b4d..a49b498 100644
--- a/libphobos/libdruntime/core/sys/windows/lmerrlog.d
+++ b/libphobos/libdruntime/core/sys/windows/lmerrlog.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmerrlog.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmerrlog.d)
*/
module core.sys.windows.lmerrlog;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lmmsg.d b/libphobos/libdruntime/core/sys/windows/lmmsg.d
index 2a2d60a..c87f1e0 100644
--- a/libphobos/libdruntime/core/sys/windows/lmmsg.d
+++ b/libphobos/libdruntime/core/sys/windows/lmmsg.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmmsg.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmmsg.d)
*/
module core.sys.windows.lmmsg;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lmremutl.d b/libphobos/libdruntime/core/sys/windows/lmremutl.d
index ce7d45a..d0f3b41 100644
--- a/libphobos/libdruntime/core/sys/windows/lmremutl.d
+++ b/libphobos/libdruntime/core/sys/windows/lmremutl.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmremutl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmremutl.d)
*/
module core.sys.windows.lmremutl;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lmrepl.d b/libphobos/libdruntime/core/sys/windows/lmrepl.d
index 02345f8..093588c 100644
--- a/libphobos/libdruntime/core/sys/windows/lmrepl.d
+++ b/libphobos/libdruntime/core/sys/windows/lmrepl.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmrepl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmrepl.d)
*/
module core.sys.windows.lmrepl;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lmserver.d b/libphobos/libdruntime/core/sys/windows/lmserver.d
index 83a9a84..fad5bc5 100644
--- a/libphobos/libdruntime/core/sys/windows/lmserver.d
+++ b/libphobos/libdruntime/core/sys/windows/lmserver.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmserver.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmserver.d)
*/
module core.sys.windows.lmserver;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lmshare.d b/libphobos/libdruntime/core/sys/windows/lmshare.d
index 215fb78..d81080e 100644
--- a/libphobos/libdruntime/core/sys/windows/lmshare.d
+++ b/libphobos/libdruntime/core/sys/windows/lmshare.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmshare.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmshare.d)
*/
module core.sys.windows.lmshare;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lmsname.d b/libphobos/libdruntime/core/sys/windows/lmsname.d
index bdb1a6d..09b1b00 100644
--- a/libphobos/libdruntime/core/sys/windows/lmsname.d
+++ b/libphobos/libdruntime/core/sys/windows/lmsname.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmsname.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmsname.d)
*/
module core.sys.windows.lmsname;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lmstats.d b/libphobos/libdruntime/core/sys/windows/lmstats.d
index 0c6e622..4baa390 100644
--- a/libphobos/libdruntime/core/sys/windows/lmstats.d
+++ b/libphobos/libdruntime/core/sys/windows/lmstats.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmstats.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmstats.d)
*/
module core.sys.windows.lmstats;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lmsvc.d b/libphobos/libdruntime/core/sys/windows/lmsvc.d
index 1743458..c0df699 100644
--- a/libphobos/libdruntime/core/sys/windows/lmsvc.d
+++ b/libphobos/libdruntime/core/sys/windows/lmsvc.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmsvc.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmsvc.d)
*/
module core.sys.windows.lmsvc;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lmuse.d b/libphobos/libdruntime/core/sys/windows/lmuse.d
index a9dbcd4..03e153a 100644
--- a/libphobos/libdruntime/core/sys/windows/lmuse.d
+++ b/libphobos/libdruntime/core/sys/windows/lmuse.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmuse.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmuse.d)
*/
module core.sys.windows.lmuse;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lmuseflg.d b/libphobos/libdruntime/core/sys/windows/lmuseflg.d
index 8157abd..06276c3 100644
--- a/libphobos/libdruntime/core/sys/windows/lmuseflg.d
+++ b/libphobos/libdruntime/core/sys/windows/lmuseflg.d
@@ -4,7 +4,7 @@
* Translated from MinGW API for MS-Windows 3.10
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmuseflg.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmuseflg.d)
*/
module core.sys.windows.lmuseflg;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lmwksta.d b/libphobos/libdruntime/core/sys/windows/lmwksta.d
index f4d85fe..cdd3a07 100644
--- a/libphobos/libdruntime/core/sys/windows/lmwksta.d
+++ b/libphobos/libdruntime/core/sys/windows/lmwksta.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lmwksta.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lmwksta.d)
*/
module core.sys.windows.lmwksta;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/lzexpand.d b/libphobos/libdruntime/core/sys/windows/lzexpand.d
index 32ab141..a01489b 100644
--- a/libphobos/libdruntime/core/sys/windows/lzexpand.d
+++ b/libphobos/libdruntime/core/sys/windows/lzexpand.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_lzexpand.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_lzexpand.d)
*/
module core.sys.windows.lzexpand;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/mapi.d b/libphobos/libdruntime/core/sys/windows/mapi.d
index 194f63b..06fd955 100644
--- a/libphobos/libdruntime/core/sys/windows/mapi.d
+++ b/libphobos/libdruntime/core/sys/windows/mapi.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_mapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_mapi.d)
*/
module core.sys.windows.mapi;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/mciavi.d b/libphobos/libdruntime/core/sys/windows/mciavi.d
index f7367e3..4e3d14e 100644
--- a/libphobos/libdruntime/core/sys/windows/mciavi.d
+++ b/libphobos/libdruntime/core/sys/windows/mciavi.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_mciavi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_mciavi.d)
*/
module core.sys.windows.mciavi;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/mcx.d b/libphobos/libdruntime/core/sys/windows/mcx.d
index 01b28ad..0322413 100644
--- a/libphobos/libdruntime/core/sys/windows/mcx.d
+++ b/libphobos/libdruntime/core/sys/windows/mcx.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_mcx.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_mcx.d)
*/
module core.sys.windows.mcx;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/mgmtapi.d b/libphobos/libdruntime/core/sys/windows/mgmtapi.d
index 673fba8..d9fb6b7 100644
--- a/libphobos/libdruntime/core/sys/windows/mgmtapi.d
+++ b/libphobos/libdruntime/core/sys/windows/mgmtapi.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_mgmtapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_mgmtapi.d)
*/
module core.sys.windows.mgmtapi;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/mmsystem.d b/libphobos/libdruntime/core/sys/windows/mmsystem.d
index 9359afd..5c3d920 100644
--- a/libphobos/libdruntime/core/sys/windows/mmsystem.d
+++ b/libphobos/libdruntime/core/sys/windows/mmsystem.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_mmsystem.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_mmsystem.d)
*/
module core.sys.windows.mmsystem;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/msacm.d b/libphobos/libdruntime/core/sys/windows/msacm.d
index b5d3052..4726328 100644
--- a/libphobos/libdruntime/core/sys/windows/msacm.d
+++ b/libphobos/libdruntime/core/sys/windows/msacm.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_msacm.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_msacm.d)
*/
module core.sys.windows.msacm;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/mshtml.d b/libphobos/libdruntime/core/sys/windows/mshtml.d
index 2c4410d..d5cf7cb 100644
--- a/libphobos/libdruntime/core/sys/windows/mshtml.d
+++ b/libphobos/libdruntime/core/sys/windows/mshtml.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_mshtml.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_mshtml.d)
*/
module core.sys.windows.mshtml;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/mswsock.d b/libphobos/libdruntime/core/sys/windows/mswsock.d
index cd6b63c..27c0cdb 100644
--- a/libphobos/libdruntime/core/sys/windows/mswsock.d
+++ b/libphobos/libdruntime/core/sys/windows/mswsock.d
@@ -5,7 +5,7 @@
*
* Authors: Daniel Keep
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_mswsock.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_mswsock.d)
*/
module core.sys.windows.mswsock;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/nb30.d b/libphobos/libdruntime/core/sys/windows/nb30.d
index 0d250cc..8f92edd 100644
--- a/libphobos/libdruntime/core/sys/windows/nb30.d
+++ b/libphobos/libdruntime/core/sys/windows/nb30.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_nb30.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_nb30.d)
*/
module core.sys.windows.nb30;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/nddeapi.d b/libphobos/libdruntime/core/sys/windows/nddeapi.d
index d4692c9..dc3890c 100644
--- a/libphobos/libdruntime/core/sys/windows/nddeapi.d
+++ b/libphobos/libdruntime/core/sys/windows/nddeapi.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_nddeapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_nddeapi.d)
*/
module core.sys.windows.nddeapi;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/nspapi.d b/libphobos/libdruntime/core/sys/windows/nspapi.d
index a2e7fab..79c9fce 100644
--- a/libphobos/libdruntime/core/sys/windows/nspapi.d
+++ b/libphobos/libdruntime/core/sys/windows/nspapi.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_nspapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_nspapi.d)
*/
module core.sys.windows.nspapi;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/ntdef.d b/libphobos/libdruntime/core/sys/windows/ntdef.d
index 83d668c..78e60e7 100644
--- a/libphobos/libdruntime/core/sys/windows/ntdef.d
+++ b/libphobos/libdruntime/core/sys/windows/ntdef.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ntdef.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ntdef.d)
*/
module core.sys.windows.ntdef;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/ntdll.d b/libphobos/libdruntime/core/sys/windows/ntdll.d
index e8aa3a7..4ac1bcc 100644
--- a/libphobos/libdruntime/core/sys/windows/ntdll.d
+++ b/libphobos/libdruntime/core/sys/windows/ntdll.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ntdll.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ntdll.d)
*/
module core.sys.windows.ntdll;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/ntldap.d b/libphobos/libdruntime/core/sys/windows/ntldap.d
index e7a55dd..52cadde 100644
--- a/libphobos/libdruntime/core/sys/windows/ntldap.d
+++ b/libphobos/libdruntime/core/sys/windows/ntldap.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ntldap.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ntldap.d)
*/
module core.sys.windows.ntldap;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/ntsecapi.d b/libphobos/libdruntime/core/sys/windows/ntsecapi.d
index df9c10a..1118057 100644
--- a/libphobos/libdruntime/core/sys/windows/ntsecapi.d
+++ b/libphobos/libdruntime/core/sys/windows/ntsecapi.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ntsecapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ntsecapi.d)
*/
module core.sys.windows.ntsecapi;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/ntsecpkg.d b/libphobos/libdruntime/core/sys/windows/ntsecpkg.d
index 8625b7a..d4c93d7 100644
--- a/libphobos/libdruntime/core/sys/windows/ntsecpkg.d
+++ b/libphobos/libdruntime/core/sys/windows/ntsecpkg.d
@@ -5,7 +5,7 @@
*
* Authors: Ellery Newcomer
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ntsecpkg.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ntsecpkg.d)
*/
module core.sys.windows.ntsecpkg;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/oaidl.d b/libphobos/libdruntime/core/sys/windows/oaidl.d
index 51d6be9..6c93682 100644
--- a/libphobos/libdruntime/core/sys/windows/oaidl.d
+++ b/libphobos/libdruntime/core/sys/windows/oaidl.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_oaidl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_oaidl.d)
*/
module core.sys.windows.oaidl;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/objbase.d b/libphobos/libdruntime/core/sys/windows/objbase.d
index 961ebcc..3695ea6 100644
--- a/libphobos/libdruntime/core/sys/windows/objbase.d
+++ b/libphobos/libdruntime/core/sys/windows/objbase.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_objbase.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_objbase.d)
*/
module core.sys.windows.objbase;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/objfwd.d b/libphobos/libdruntime/core/sys/windows/objfwd.d
index 76d4f41..89d5cad 100644
--- a/libphobos/libdruntime/core/sys/windows/objfwd.d
+++ b/libphobos/libdruntime/core/sys/windows/objfwd.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_objfwd.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_objfwd.d)
*/
module core.sys.windows.objfwd;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/objidl.d b/libphobos/libdruntime/core/sys/windows/objidl.d
index 5368c29..528c58b 100644
--- a/libphobos/libdruntime/core/sys/windows/objidl.d
+++ b/libphobos/libdruntime/core/sys/windows/objidl.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_objidl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_objidl.d)
*/
// TODO (Don):
// # why is "alias IPSFactoryBuffer* LPPSFACTORYBUFFER;" in this file,
diff --git a/libphobos/libdruntime/core/sys/windows/objsafe.d b/libphobos/libdruntime/core/sys/windows/objsafe.d
index 0bfd19a..449a4c3 100644
--- a/libphobos/libdruntime/core/sys/windows/objsafe.d
+++ b/libphobos/libdruntime/core/sys/windows/objsafe.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_objsafe.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_objsafe.d)
*/
module core.sys.windows.objsafe;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/ocidl.d b/libphobos/libdruntime/core/sys/windows/ocidl.d
index 4b090b0..af42bea 100644
--- a/libphobos/libdruntime/core/sys/windows/ocidl.d
+++ b/libphobos/libdruntime/core/sys/windows/ocidl.d
@@ -6,7 +6,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ocidl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ocidl.d)
*/
module core.sys.windows.ocidl;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/odbcinst.d b/libphobos/libdruntime/core/sys/windows/odbcinst.d
index ee22bc6..b0ca42a 100644
--- a/libphobos/libdruntime/core/sys/windows/odbcinst.d
+++ b/libphobos/libdruntime/core/sys/windows/odbcinst.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_odbcinst.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_odbcinst.d)
*/
module core.sys.windows.odbcinst;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/ole.d b/libphobos/libdruntime/core/sys/windows/ole.d
index 1a49ea5..21218f1 100644
--- a/libphobos/libdruntime/core/sys/windows/ole.d
+++ b/libphobos/libdruntime/core/sys/windows/ole.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ole.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ole.d)
*/
module core.sys.windows.ole;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/ole2.d b/libphobos/libdruntime/core/sys/windows/ole2.d
index 575a8eb..0945fca 100644
--- a/libphobos/libdruntime/core/sys/windows/ole2.d
+++ b/libphobos/libdruntime/core/sys/windows/ole2.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ole2.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ole2.d)
*/
module core.sys.windows.ole2;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/ole2ver.d b/libphobos/libdruntime/core/sys/windows/ole2ver.d
index 9e3badc..6a549e6d 100644
--- a/libphobos/libdruntime/core/sys/windows/ole2ver.d
+++ b/libphobos/libdruntime/core/sys/windows/ole2ver.d
@@ -4,7 +4,7 @@
* Translated from MinGW API for MS-Windows 3.10
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ole2ver.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ole2ver.d)
*/
module core.sys.windows.ole2ver;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/oleacc.d b/libphobos/libdruntime/core/sys/windows/oleacc.d
index 77ced02..77137c6 100644
--- a/libphobos/libdruntime/core/sys/windows/oleacc.d
+++ b/libphobos/libdruntime/core/sys/windows/oleacc.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_oleacc.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_oleacc.d)
*/
module core.sys.windows.oleacc;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/oleauto.d b/libphobos/libdruntime/core/sys/windows/oleauto.d
index 20f34af..f8d76e1 100644
--- a/libphobos/libdruntime/core/sys/windows/oleauto.d
+++ b/libphobos/libdruntime/core/sys/windows/oleauto.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_oleauto.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_oleauto.d)
*/
module core.sys.windows.oleauto;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/olectl.d b/libphobos/libdruntime/core/sys/windows/olectl.d
index e0bc679..f671ce4 100644
--- a/libphobos/libdruntime/core/sys/windows/olectl.d
+++ b/libphobos/libdruntime/core/sys/windows/olectl.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_olectl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_olectl.d)
*/
module core.sys.windows.olectl;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/olectlid.d b/libphobos/libdruntime/core/sys/windows/olectlid.d
index fd3ea89..8bbe657 100644
--- a/libphobos/libdruntime/core/sys/windows/olectlid.d
+++ b/libphobos/libdruntime/core/sys/windows/olectlid.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_olectlid.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_olectlid.d)
*/
module core.sys.windows.olectlid;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/oledlg.d b/libphobos/libdruntime/core/sys/windows/oledlg.d
index e44c029..f1a0510 100644
--- a/libphobos/libdruntime/core/sys/windows/oledlg.d
+++ b/libphobos/libdruntime/core/sys/windows/oledlg.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_oledlg.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_oledlg.d)
*/
module core.sys.windows.oledlg;
@system:
diff --git a/libphobos/libdruntime/core/sys/windows/oleidl.d b/libphobos/libdruntime/core/sys/windows/oleidl.d
index dc0cae8..4ef564d 100644
--- a/libphobos/libdruntime/core/sys/windows/oleidl.d
+++ b/libphobos/libdruntime/core/sys/windows/oleidl.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_oleidl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_oleidl.d)
*/
module core.sys.windows.oleidl;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/pbt.d b/libphobos/libdruntime/core/sys/windows/pbt.d
index aec938e..3b65ba5 100644
--- a/libphobos/libdruntime/core/sys/windows/pbt.d
+++ b/libphobos/libdruntime/core/sys/windows/pbt.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_pbt.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_pbt.d)
*/
module core.sys.windows.pbt;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/powrprof.d b/libphobos/libdruntime/core/sys/windows/powrprof.d
index 75ec73e..275dbea 100644
--- a/libphobos/libdruntime/core/sys/windows/powrprof.d
+++ b/libphobos/libdruntime/core/sys/windows/powrprof.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_powrprof.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_powrprof.d)
*/
module core.sys.windows.powrprof;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/prsht.d b/libphobos/libdruntime/core/sys/windows/prsht.d
index efea4f2..ba04b57 100644
--- a/libphobos/libdruntime/core/sys/windows/prsht.d
+++ b/libphobos/libdruntime/core/sys/windows/prsht.d
@@ -5,7 +5,7 @@
*
* Authors: Vladimir Vlasov
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_prsht.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_prsht.d)
*/
module core.sys.windows.prsht;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/psapi.d b/libphobos/libdruntime/core/sys/windows/psapi.d
index 7e62d9f..585f908 100644
--- a/libphobos/libdruntime/core/sys/windows/psapi.d
+++ b/libphobos/libdruntime/core/sys/windows/psapi.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_psapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_psapi.d)
*/
/* Comment from MinGW
* Process status API (PSAPI)
diff --git a/libphobos/libdruntime/core/sys/windows/rapi.d b/libphobos/libdruntime/core/sys/windows/rapi.d
index 6c48f6b..086b7a6 100644
--- a/libphobos/libdruntime/core/sys/windows/rapi.d
+++ b/libphobos/libdruntime/core/sys/windows/rapi.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_rapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_rapi.d)
*/
module core.sys.windows.rapi;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/ras.d b/libphobos/libdruntime/core/sys/windows/ras.d
index 1004c6b..1f66546 100644
--- a/libphobos/libdruntime/core/sys/windows/ras.d
+++ b/libphobos/libdruntime/core/sys/windows/ras.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_ras.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_ras.d)
*/
module core.sys.windows.ras;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/rasdlg.d b/libphobos/libdruntime/core/sys/windows/rasdlg.d
index 8304a01..1add3ae 100644
--- a/libphobos/libdruntime/core/sys/windows/rasdlg.d
+++ b/libphobos/libdruntime/core/sys/windows/rasdlg.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_rasdlg.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_rasdlg.d)
*/
module core.sys.windows.rasdlg;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/raserror.d b/libphobos/libdruntime/core/sys/windows/raserror.d
index 43bebac..c21409b 100644
--- a/libphobos/libdruntime/core/sys/windows/raserror.d
+++ b/libphobos/libdruntime/core/sys/windows/raserror.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_raserror.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_raserror.d)
*/
module core.sys.windows.raserror;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/rassapi.d b/libphobos/libdruntime/core/sys/windows/rassapi.d
index 0eaa5b2..aed14f1 100644
--- a/libphobos/libdruntime/core/sys/windows/rassapi.d
+++ b/libphobos/libdruntime/core/sys/windows/rassapi.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_rassapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_rassapi.d)
*/
module core.sys.windows.rassapi;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/reason.d b/libphobos/libdruntime/core/sys/windows/reason.d
index b0c4969..4274efa 100644
--- a/libphobos/libdruntime/core/sys/windows/reason.d
+++ b/libphobos/libdruntime/core/sys/windows/reason.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_reason.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_reason.d)
*/
module core.sys.windows.reason;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/regstr.d b/libphobos/libdruntime/core/sys/windows/regstr.d
index 1fa1c7e..71a86ef 100644
--- a/libphobos/libdruntime/core/sys/windows/regstr.d
+++ b/libphobos/libdruntime/core/sys/windows/regstr.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_regstr.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_regstr.d)
*/
module core.sys.windows.regstr;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/richedit.d b/libphobos/libdruntime/core/sys/windows/richedit.d
index 1abc8f3..6760764 100644
--- a/libphobos/libdruntime/core/sys/windows/richedit.d
+++ b/libphobos/libdruntime/core/sys/windows/richedit.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_richedit.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_richedit.d)
*/
module core.sys.windows.richedit;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/richole.d b/libphobos/libdruntime/core/sys/windows/richole.d
index a4e64e83..288ef22 100644
--- a/libphobos/libdruntime/core/sys/windows/richole.d
+++ b/libphobos/libdruntime/core/sys/windows/richole.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_richole.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_richole.d)
*/
module core.sys.windows.richole;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/rpc.d b/libphobos/libdruntime/core/sys/windows/rpc.d
index 5922123..a9640ad 100644
--- a/libphobos/libdruntime/core/sys/windows/rpc.d
+++ b/libphobos/libdruntime/core/sys/windows/rpc.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_rpc.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_rpc.d)
*/
module core.sys.windows.rpc;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/rpcdce.d b/libphobos/libdruntime/core/sys/windows/rpcdce.d
index cdffbcf..1eccb0d 100644
--- a/libphobos/libdruntime/core/sys/windows/rpcdce.d
+++ b/libphobos/libdruntime/core/sys/windows/rpcdce.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_rpcdce.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_rpcdce.d)
*/
module core.sys.windows.rpcdce;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/rpcdce2.d b/libphobos/libdruntime/core/sys/windows/rpcdce2.d
index 10ec910..c8223f6 100644
--- a/libphobos/libdruntime/core/sys/windows/rpcdce2.d
+++ b/libphobos/libdruntime/core/sys/windows/rpcdce2.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_rpcdce2.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_rpcdce2.d)
*/
module core.sys.windows.rpcdce2;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/rpcdcep.d b/libphobos/libdruntime/core/sys/windows/rpcdcep.d
index fe22bf8..1abbb78 100644
--- a/libphobos/libdruntime/core/sys/windows/rpcdcep.d
+++ b/libphobos/libdruntime/core/sys/windows/rpcdcep.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_rpcdcep.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_rpcdcep.d)
*/
module core.sys.windows.rpcdcep;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/rpcndr.d b/libphobos/libdruntime/core/sys/windows/rpcndr.d
index 6720b94..6e9722c 100644
--- a/libphobos/libdruntime/core/sys/windows/rpcndr.d
+++ b/libphobos/libdruntime/core/sys/windows/rpcndr.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_rpcndr.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_rpcndr.d)
*/
module core.sys.windows.rpcndr;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/rpcnsi.d b/libphobos/libdruntime/core/sys/windows/rpcnsi.d
index 2ecae63..608b92c 100644
--- a/libphobos/libdruntime/core/sys/windows/rpcnsi.d
+++ b/libphobos/libdruntime/core/sys/windows/rpcnsi.d
@@ -6,7 +6,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_rpcnsi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_rpcnsi.d)
*/
module core.sys.windows.rpcnsi;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/rpcnsip.d b/libphobos/libdruntime/core/sys/windows/rpcnsip.d
index 1c0f050..219d7b0 100644
--- a/libphobos/libdruntime/core/sys/windows/rpcnsip.d
+++ b/libphobos/libdruntime/core/sys/windows/rpcnsip.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_rpcnsip.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_rpcnsip.d)
*/
module core.sys.windows.rpcnsip;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/rpcnterr.d b/libphobos/libdruntime/core/sys/windows/rpcnterr.d
index dcd63ab..426077a 100644
--- a/libphobos/libdruntime/core/sys/windows/rpcnterr.d
+++ b/libphobos/libdruntime/core/sys/windows/rpcnterr.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_rpcnterr.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_rpcnterr.d)
*/
module core.sys.windows.rpcnterr;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/schannel.d b/libphobos/libdruntime/core/sys/windows/schannel.d
index 1d2fbda..98c5cf8 100644
--- a/libphobos/libdruntime/core/sys/windows/schannel.d
+++ b/libphobos/libdruntime/core/sys/windows/schannel.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_schannel.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_schannel.d)
*/
module core.sys.windows.schannel;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/sdkddkver.d b/libphobos/libdruntime/core/sys/windows/sdkddkver.d
index 3af3c86..4b5bad5 100644
--- a/libphobos/libdruntime/core/sys/windows/sdkddkver.d
+++ b/libphobos/libdruntime/core/sys/windows/sdkddkver.d
@@ -4,7 +4,7 @@
* Translated from Windows SDK API
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/sdkddkver.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/sdkddkver.d)
*/
module core.sys.windows.sdkddkver;
diff --git a/libphobos/libdruntime/core/sys/windows/secext.d b/libphobos/libdruntime/core/sys/windows/secext.d
index dd4ec85..6b92fcd 100644
--- a/libphobos/libdruntime/core/sys/windows/secext.d
+++ b/libphobos/libdruntime/core/sys/windows/secext.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_secext.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_secext.d)
*/
// Don't include this file directly, use core.sys.windows.security instead.
module core.sys.windows.secext;
diff --git a/libphobos/libdruntime/core/sys/windows/security.d b/libphobos/libdruntime/core/sys/windows/security.d
index 2dc7c19..b81abb3 100644
--- a/libphobos/libdruntime/core/sys/windows/security.d
+++ b/libphobos/libdruntime/core/sys/windows/security.d
@@ -5,7 +5,7 @@
*
* Authors: Ellery Newcomer, John Colvin
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_security.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_security.d)
*/
module core.sys.windows.security;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/servprov.d b/libphobos/libdruntime/core/sys/windows/servprov.d
index 1c061dd..89ab47c 100644
--- a/libphobos/libdruntime/core/sys/windows/servprov.d
+++ b/libphobos/libdruntime/core/sys/windows/servprov.d
@@ -4,7 +4,7 @@
* Translated from MinGW API for MS-Windows 3.10
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_servprov.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_servprov.d)
*/
module core.sys.windows.servprov;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/setupapi.d b/libphobos/libdruntime/core/sys/windows/setupapi.d
index 432ff35..80e8dba 100644
--- a/libphobos/libdruntime/core/sys/windows/setupapi.d
+++ b/libphobos/libdruntime/core/sys/windows/setupapi.d
@@ -5,7 +5,7 @@
*
* Authors: Vladimir Vlasov
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_setupapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_setupapi.d)
*/
module core.sys.windows.setupapi;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/shellapi.d b/libphobos/libdruntime/core/sys/windows/shellapi.d
index 2b7f145..f401997 100644
--- a/libphobos/libdruntime/core/sys/windows/shellapi.d
+++ b/libphobos/libdruntime/core/sys/windows/shellapi.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_shellapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_shellapi.d)
*/
module core.sys.windows.shellapi;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/shldisp.d b/libphobos/libdruntime/core/sys/windows/shldisp.d
index 70cf884..ecb0ede 100644
--- a/libphobos/libdruntime/core/sys/windows/shldisp.d
+++ b/libphobos/libdruntime/core/sys/windows/shldisp.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_shldisp.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_shldisp.d)
*/
module core.sys.windows.shldisp;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/shlguid.d b/libphobos/libdruntime/core/sys/windows/shlguid.d
index 15e6138..1c0c98f 100644
--- a/libphobos/libdruntime/core/sys/windows/shlguid.d
+++ b/libphobos/libdruntime/core/sys/windows/shlguid.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_shlguid.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_shlguid.d)
*/
module core.sys.windows.shlguid;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/shlobj.d b/libphobos/libdruntime/core/sys/windows/shlobj.d
index 5f921b3..75ac622 100644
--- a/libphobos/libdruntime/core/sys/windows/shlobj.d
+++ b/libphobos/libdruntime/core/sys/windows/shlobj.d
@@ -4,7 +4,7 @@
* Translated from MinGW API for MS-Windows 4.0
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_shlobj.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_shlobj.d)
*/
module core.sys.windows.shlobj;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/shlwapi.d b/libphobos/libdruntime/core/sys/windows/shlwapi.d
index 8cb21ef..d1a61a3 100644
--- a/libphobos/libdruntime/core/sys/windows/shlwapi.d
+++ b/libphobos/libdruntime/core/sys/windows/shlwapi.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_shlwapi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_shlwapi.d)
*/
module core.sys.windows.shlwapi;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/snmp.d b/libphobos/libdruntime/core/sys/windows/snmp.d
index ea64e0d..bf56b28 100644
--- a/libphobos/libdruntime/core/sys/windows/snmp.d
+++ b/libphobos/libdruntime/core/sys/windows/snmp.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_snmp.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_snmp.d)
*/
module core.sys.windows.snmp;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/sql.d b/libphobos/libdruntime/core/sys/windows/sql.d
index 177a48d..7c8758e 100644
--- a/libphobos/libdruntime/core/sys/windows/sql.d
+++ b/libphobos/libdruntime/core/sys/windows/sql.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_sql.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_sql.d)
*/
module core.sys.windows.sql;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/sqlext.d b/libphobos/libdruntime/core/sys/windows/sqlext.d
index 1f89105..2ddff20 100644
--- a/libphobos/libdruntime/core/sys/windows/sqlext.d
+++ b/libphobos/libdruntime/core/sys/windows/sqlext.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_sqlext.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_sqlext.d)
*/
module core.sys.windows.sqlext;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/sqltypes.d b/libphobos/libdruntime/core/sys/windows/sqltypes.d
index aaffeb2..fd77b81 100644
--- a/libphobos/libdruntime/core/sys/windows/sqltypes.d
+++ b/libphobos/libdruntime/core/sys/windows/sqltypes.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_sqltypes.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_sqltypes.d)
*/
module core.sys.windows.sqltypes;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/sqlucode.d b/libphobos/libdruntime/core/sys/windows/sqlucode.d
index 21f47f6..85f0d06 100644
--- a/libphobos/libdruntime/core/sys/windows/sqlucode.d
+++ b/libphobos/libdruntime/core/sys/windows/sqlucode.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_sqlucode.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_sqlucode.d)
*/
module core.sys.windows.sqlucode;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/sspi.d b/libphobos/libdruntime/core/sys/windows/sspi.d
index cf41298..07a2596 100644
--- a/libphobos/libdruntime/core/sys/windows/sspi.d
+++ b/libphobos/libdruntime/core/sys/windows/sspi.d
@@ -5,7 +5,7 @@
*
* Authors: Ellery Newcomer
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_sspi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_sspi.d)
*/
module core.sys.windows.sspi;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/stdc/malloc.d b/libphobos/libdruntime/core/sys/windows/stdc/malloc.d
index f52ba37..278c9fe 100644
--- a/libphobos/libdruntime/core/sys/windows/stdc/malloc.d
+++ b/libphobos/libdruntime/core/sys/windows/stdc/malloc.d
@@ -5,7 +5,7 @@
*
* Authors: Iain Buclaw
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/stdc/_malloc.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/stdc/_malloc.d)
*/
module core.sys.windows.stdc.malloc;
version (CRuntime_Microsoft):
diff --git a/libphobos/libdruntime/core/sys/windows/subauth.d b/libphobos/libdruntime/core/sys/windows/subauth.d
index 42d2fa7..e0d67ff 100644
--- a/libphobos/libdruntime/core/sys/windows/subauth.d
+++ b/libphobos/libdruntime/core/sys/windows/subauth.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_subauth.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_subauth.d)
*/
module core.sys.windows.subauth;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/tlhelp32.d b/libphobos/libdruntime/core/sys/windows/tlhelp32.d
index 308c5a4..34ed101 100644
--- a/libphobos/libdruntime/core/sys/windows/tlhelp32.d
+++ b/libphobos/libdruntime/core/sys/windows/tlhelp32.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_tlhelp32.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_tlhelp32.d)
*/
module core.sys.windows.tlhelp32;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/tmschema.d b/libphobos/libdruntime/core/sys/windows/tmschema.d
index ea7863a..b82dc5c 100644
--- a/libphobos/libdruntime/core/sys/windows/tmschema.d
+++ b/libphobos/libdruntime/core/sys/windows/tmschema.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_tmschema.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_tmschema.d)
*/
module core.sys.windows.tmschema;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/unknwn.d b/libphobos/libdruntime/core/sys/windows/unknwn.d
index 1c3e453..49d5abf 100644
--- a/libphobos/libdruntime/core/sys/windows/unknwn.d
+++ b/libphobos/libdruntime/core/sys/windows/unknwn.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_unknwn.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_unknwn.d)
*/
module core.sys.windows.unknwn;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/vfw.d b/libphobos/libdruntime/core/sys/windows/vfw.d
index 3ffff20..c67753a 100644
--- a/libphobos/libdruntime/core/sys/windows/vfw.d
+++ b/libphobos/libdruntime/core/sys/windows/vfw.d
@@ -4,7 +4,7 @@
* written in the D programming language
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_vfw.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_vfw.d)
*/
module core.sys.windows.vfw;
diff --git a/libphobos/libdruntime/core/sys/windows/w32api.d b/libphobos/libdruntime/core/sys/windows/w32api.d
index a392d59..2752da1 100644
--- a/libphobos/libdruntime/core/sys/windows/w32api.d
+++ b/libphobos/libdruntime/core/sys/windows/w32api.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_w32api.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_w32api.d)
*/
module core.sys.windows.w32api;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/winbase.d b/libphobos/libdruntime/core/sys/windows/winbase.d
index a9844de..1806796 100644
--- a/libphobos/libdruntime/core/sys/windows/winbase.d
+++ b/libphobos/libdruntime/core/sys/windows/winbase.d
@@ -4,7 +4,7 @@
* Translated from MinGW API for MS-Windows 3.10
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winbase.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winbase.d)
*/
module core.sys.windows.winbase;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/winber.d b/libphobos/libdruntime/core/sys/windows/winber.d
index 2718903..d6a79cd 100644
--- a/libphobos/libdruntime/core/sys/windows/winber.d
+++ b/libphobos/libdruntime/core/sys/windows/winber.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winber.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winber.d)
*/
module core.sys.windows.winber;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/wincon.d b/libphobos/libdruntime/core/sys/windows/wincon.d
index 67bd17e..a404c5c 100644
--- a/libphobos/libdruntime/core/sys/windows/wincon.d
+++ b/libphobos/libdruntime/core/sys/windows/wincon.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_wincon.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_wincon.d)
*/
module core.sys.windows.wincon;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/wincrypt.d b/libphobos/libdruntime/core/sys/windows/wincrypt.d
index 9495105..d6c617d2 100644
--- a/libphobos/libdruntime/core/sys/windows/wincrypt.d
+++ b/libphobos/libdruntime/core/sys/windows/wincrypt.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_wincrypt.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_wincrypt.d)
*/
module core.sys.windows.wincrypt;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/windef.d b/libphobos/libdruntime/core/sys/windows/windef.d
index f79b593..31af66a 100644
--- a/libphobos/libdruntime/core/sys/windows/windef.d
+++ b/libphobos/libdruntime/core/sys/windows/windef.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_windef.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_windef.d)
*/
module core.sys.windows.windef;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/windows.d b/libphobos/libdruntime/core/sys/windows/windows.d
index 8b8c8ab..4a1b02f 100644
--- a/libphobos/libdruntime/core/sys/windows/windows.d
+++ b/libphobos/libdruntime/core/sys/windows/windows.d
@@ -4,7 +4,7 @@
* Translated from MinGW API for MS-Windows 4.0
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_windows.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_windows.d)
*/
module core.sys.windows.windows;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/winerror.d b/libphobos/libdruntime/core/sys/windows/winerror.d
index ab987a3e..a26b05c 100644
--- a/libphobos/libdruntime/core/sys/windows/winerror.d
+++ b/libphobos/libdruntime/core/sys/windows/winerror.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winerror.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winerror.d)
*/
module core.sys.windows.winerror;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/wingdi.d b/libphobos/libdruntime/core/sys/windows/wingdi.d
index 4fc125c..279f6be 100644
--- a/libphobos/libdruntime/core/sys/windows/wingdi.d
+++ b/libphobos/libdruntime/core/sys/windows/wingdi.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_wingdi.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_wingdi.d)
*/
module core.sys.windows.wingdi;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/winhttp.d b/libphobos/libdruntime/core/sys/windows/winhttp.d
index e919635..f665805 100644
--- a/libphobos/libdruntime/core/sys/windows/winhttp.d
+++ b/libphobos/libdruntime/core/sys/windows/winhttp.d
@@ -4,7 +4,7 @@
* Translated from Windows SDK Headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winhttp.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winhttp.d)
*/
module core.sys.windows.winhttp;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/wininet.d b/libphobos/libdruntime/core/sys/windows/wininet.d
index 64b95c4..f4aa997 100644
--- a/libphobos/libdruntime/core/sys/windows/wininet.d
+++ b/libphobos/libdruntime/core/sys/windows/wininet.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_wininet.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_wininet.d)
*/
module core.sys.windows.wininet;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/winioctl.d b/libphobos/libdruntime/core/sys/windows/winioctl.d
index 84d498e..b91ddda1 100644
--- a/libphobos/libdruntime/core/sys/windows/winioctl.d
+++ b/libphobos/libdruntime/core/sys/windows/winioctl.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winioctl.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winioctl.d)
*/
module core.sys.windows.winioctl;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/winldap.d b/libphobos/libdruntime/core/sys/windows/winldap.d
index 78578dd..0ab11d6 100644
--- a/libphobos/libdruntime/core/sys/windows/winldap.d
+++ b/libphobos/libdruntime/core/sys/windows/winldap.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winldap.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winldap.d)
*/
module core.sys.windows.winldap;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/winnetwk.d b/libphobos/libdruntime/core/sys/windows/winnetwk.d
index 7601279..e0c7551 100644
--- a/libphobos/libdruntime/core/sys/windows/winnetwk.d
+++ b/libphobos/libdruntime/core/sys/windows/winnetwk.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winnetwk.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winnetwk.d)
*/
module core.sys.windows.winnetwk;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/winnls.d b/libphobos/libdruntime/core/sys/windows/winnls.d
index 6483f4b..b487a17 100644
--- a/libphobos/libdruntime/core/sys/windows/winnls.d
+++ b/libphobos/libdruntime/core/sys/windows/winnls.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winnls.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winnls.d)
*/
module core.sys.windows.winnls;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/winnt.d b/libphobos/libdruntime/core/sys/windows/winnt.d
index 2d9a281..bf30072 100644
--- a/libphobos/libdruntime/core/sys/windows/winnt.d
+++ b/libphobos/libdruntime/core/sys/windows/winnt.d
@@ -4,7 +4,7 @@
* Translated from MinGW API for MS-Windows 3.12
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winnt.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winnt.d)
*/
module core.sys.windows.winnt;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/winperf.d b/libphobos/libdruntime/core/sys/windows/winperf.d
index 367c2b0..cd31990 100644
--- a/libphobos/libdruntime/core/sys/windows/winperf.d
+++ b/libphobos/libdruntime/core/sys/windows/winperf.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winperf.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winperf.d)
*/
module core.sys.windows.winperf;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/winreg.d b/libphobos/libdruntime/core/sys/windows/winreg.d
index 078bdf7..c3e5854 100644
--- a/libphobos/libdruntime/core/sys/windows/winreg.d
+++ b/libphobos/libdruntime/core/sys/windows/winreg.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winreg.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winreg.d)
*/
module core.sys.windows.winreg;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/winspool.d b/libphobos/libdruntime/core/sys/windows/winspool.d
index db5b23f..2ff621a 100644
--- a/libphobos/libdruntime/core/sys/windows/winspool.d
+++ b/libphobos/libdruntime/core/sys/windows/winspool.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winspool.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winspool.d)
*/
module core.sys.windows.winspool;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/winsvc.d b/libphobos/libdruntime/core/sys/windows/winsvc.d
index 44c4563..14ab6e4 100644
--- a/libphobos/libdruntime/core/sys/windows/winsvc.d
+++ b/libphobos/libdruntime/core/sys/windows/winsvc.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winsvc.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winsvc.d)
*/
module core.sys.windows.winsvc;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/winuser.d b/libphobos/libdruntime/core/sys/windows/winuser.d
index 07e5efa..078e061 100644
--- a/libphobos/libdruntime/core/sys/windows/winuser.d
+++ b/libphobos/libdruntime/core/sys/windows/winuser.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winuser.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winuser.d)
*/
module core.sys.windows.winuser;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/winver.d b/libphobos/libdruntime/core/sys/windows/winver.d
index afe53d8..5099c3f 100644
--- a/libphobos/libdruntime/core/sys/windows/winver.d
+++ b/libphobos/libdruntime/core/sys/windows/winver.d
@@ -5,7 +5,7 @@
*
* Authors: Stewart Gordon
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_winver.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_winver.d)
*/
module core.sys.windows.winver;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/wtsapi32.d b/libphobos/libdruntime/core/sys/windows/wtsapi32.d
index 643c049..13576bd 100644
--- a/libphobos/libdruntime/core/sys/windows/wtsapi32.d
+++ b/libphobos/libdruntime/core/sys/windows/wtsapi32.d
@@ -4,7 +4,7 @@
* Translated from MinGW-w64 API
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_wtsapi32.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_wtsapi32.d)
*/
module core.sys.windows.wtsapi32;
version (Windows):
diff --git a/libphobos/libdruntime/core/sys/windows/wtypes.d b/libphobos/libdruntime/core/sys/windows/wtypes.d
index 8af42cf..c27dd3a 100644
--- a/libphobos/libdruntime/core/sys/windows/wtypes.d
+++ b/libphobos/libdruntime/core/sys/windows/wtypes.d
@@ -4,7 +4,7 @@
* Translated from MinGW Windows headers
*
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
- * Source: $(DRUNTIMESRC src/core/sys/windows/_wtypes.d)
+ * Source: $(DRUNTIMESRC core/sys/windows/_wtypes.d)
*/
module core.sys.windows.wtypes;
version (Windows):
diff --git a/libphobos/libdruntime/core/thread/fiber.d b/libphobos/libdruntime/core/thread/fiber.d
index 56f6d67..bd53eed 100644
--- a/libphobos/libdruntime/core/thread/fiber.d
+++ b/libphobos/libdruntime/core/thread/fiber.d
@@ -1043,10 +1043,14 @@ private:
// Allocate more for the memory guard
sz += guardPageSize;
+ int mmap_flags = MAP_PRIVATE | MAP_ANON;
+ version (OpenBSD)
+ mmap_flags |= MAP_STACK;
+
m_pmem = mmap( null,
sz,
PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANON,
+ mmap_flags,
-1,
0 );
if ( m_pmem == MAP_FAILED )
@@ -1894,7 +1898,7 @@ unittest
try
{
- (new Fiber({
+ (new Fiber(function() {
throw new Exception( MSG );
})).call();
assert( false, "Expected rethrown exception." );
diff --git a/libphobos/libdruntime/core/thread/osthread.d b/libphobos/libdruntime/core/thread/osthread.d
index c9bc130..b7dde93 100644
--- a/libphobos/libdruntime/core/thread/osthread.d
+++ b/libphobos/libdruntime/core/thread/osthread.d
@@ -1109,6 +1109,7 @@ unittest
try
{
new Thread(
+ function()
{
throw new Exception( MSG );
}).start().join();
diff --git a/libphobos/libdruntime/core/time.d b/libphobos/libdruntime/core/time.d
index 26e515b..0ddf62f 100644
--- a/libphobos/libdruntime/core/time.d
+++ b/libphobos/libdruntime/core/time.d
@@ -1196,8 +1196,8 @@ public:
+/
template split(units...)
if (allAreAcceptedUnits!("weeks", "days", "hours", "minutes", "seconds",
- "msecs", "usecs", "hnsecs", "nsecs")(units) &&
- unitsAreInDescendingOrder(units))
+ "msecs", "usecs", "hnsecs", "nsecs")([units]) &&
+ unitsAreInDescendingOrder([units]))
{
/++ Ditto +/
void split(Args...)(out Args args) const nothrow @nogc
@@ -3709,7 +3709,7 @@ unittest
/+
Whether all of the given strings are among the accepted strings.
+/
-bool allAreAcceptedUnits(acceptedUnits...)(string[] units...)
+bool allAreAcceptedUnits(acceptedUnits...)(scope string[] units)
{
foreach (unit; units)
{
@@ -3730,12 +3730,12 @@ bool allAreAcceptedUnits(acceptedUnits...)(string[] units...)
unittest
{
- assert(allAreAcceptedUnits!("hours", "seconds")("seconds", "hours"));
- assert(!allAreAcceptedUnits!("hours", "seconds")("minutes", "hours"));
- assert(!allAreAcceptedUnits!("hours", "seconds")("seconds", "minutes"));
- assert(allAreAcceptedUnits!("days", "hours", "minutes", "seconds", "msecs")("minutes"));
- assert(!allAreAcceptedUnits!("days", "hours", "minutes", "seconds", "msecs")("usecs"));
- assert(!allAreAcceptedUnits!("days", "hours", "minutes", "seconds", "msecs")("secs"));
+ assert(allAreAcceptedUnits!("hours", "seconds")(["seconds", "hours"]));
+ assert(!allAreAcceptedUnits!("hours", "seconds")(["minutes", "hours"]));
+ assert(!allAreAcceptedUnits!("hours", "seconds")(["seconds", "minutes"]));
+ assert(allAreAcceptedUnits!("days", "hours", "minutes", "seconds", "msecs")(["minutes"]));
+ assert(!allAreAcceptedUnits!("days", "hours", "minutes", "seconds", "msecs")(["usecs"]));
+ assert(!allAreAcceptedUnits!("days", "hours", "minutes", "seconds", "msecs")(["secs"]));
}
@@ -3743,7 +3743,7 @@ unittest
Whether the given time unit strings are arranged in order from largest to
smallest.
+/
-bool unitsAreInDescendingOrder(string[] units...)
+bool unitsAreInDescendingOrder(scope string[] units)
{
if (units.length <= 1)
return true;
@@ -3783,13 +3783,13 @@ bool unitsAreInDescendingOrder(string[] units...)
unittest
{
- assert(unitsAreInDescendingOrder("years", "months", "weeks", "days", "hours", "minutes",
- "seconds", "msecs", "usecs", "hnsecs", "nsecs"));
- assert(unitsAreInDescendingOrder("weeks", "hours", "msecs"));
- assert(unitsAreInDescendingOrder("days", "hours", "minutes"));
- assert(unitsAreInDescendingOrder("hnsecs"));
- assert(!unitsAreInDescendingOrder("days", "hours", "hours"));
- assert(!unitsAreInDescendingOrder("days", "hours", "days"));
+ assert(unitsAreInDescendingOrder(["years", "months", "weeks", "days", "hours", "minutes",
+ "seconds", "msecs", "usecs", "hnsecs", "nsecs"]));
+ assert(unitsAreInDescendingOrder(["weeks", "hours", "msecs"]));
+ assert(unitsAreInDescendingOrder(["days", "hours", "minutes"]));
+ assert(unitsAreInDescendingOrder(["hnsecs"]));
+ assert(!unitsAreInDescendingOrder(["days", "hours", "hours"]));
+ assert(!unitsAreInDescendingOrder(["days", "hours", "days"]));
}
version (Darwin)
diff --git a/libphobos/libdruntime/object.d b/libphobos/libdruntime/object.d
index 151755f..a079e0e 100644
--- a/libphobos/libdruntime/object.d
+++ b/libphobos/libdruntime/object.d
@@ -2446,7 +2446,7 @@ class Throwable : Object
override string toString()
{
string s;
- toString((buf) { s ~= buf; });
+ toString((in buf) { s ~= buf; });
return s;
}
@@ -4752,3 +4752,79 @@ template _arrayOp(Args...)
}
public import core.builtins : __ctfeWrite;
+
+/**
+
+Provides an "inline import", i.e. an `import` that is only available for a
+limited lookup. For example:
+
+---
+void fun(imported!"std.stdio".File input)
+{
+ ... use File from std.stdio normally ...
+}
+---
+
+There is no need to import `std.stdio` at top level, so `fun` carries its own
+dependencies. The same approach can be used for template constraints:
+
+---
+void fun(T)(imported!"std.stdio".File input, T value)
+if (imported!"std.traits".isIntegral!T)
+{
+ ...
+}
+---
+
+An inline import may be used in conjunction with the `with` statement as well.
+Inside the scope controlled by `with`, all symbols in the imported module are
+made available:
+
+---
+void fun()
+{
+ with (imported!"std.datetime")
+ with (imported!"std.stdio")
+ {
+ Clock.currTime.writeln;
+ }
+}
+---
+
+The advantages of inline imports over top-level uses of the `import` declaration
+are the following:
+
+$(UL
+$(LI The `imported` template specifies dependencies at declaration level, not at
+module level. This allows reasoning about the dependency cost of declarations in
+separation instead of aggregated at module level.)
+$(LI Declarations using `imported` are easier to move around because they don't
+require top-level context, making for simpler and quicker refactorings.)
+$(LI Declarations using `imported` scale better with templates. This is because
+templates that are not instantiated do not have their parameters and constraints
+instantiated, so additional modules are not imported without necessity. This
+makes the cost of unused templates negligible. Dependencies are pulled on a need
+basis depending on the declarations used by client code.)
+)
+
+The use of `imported` also has drawbacks:
+
+$(UL
+$(LI If most declarations in a module need the same imports, then factoring them
+at top level, outside the declarations, is simpler than repeating them.)
+$(LI Traditional dependency-tracking tools such as make and other build systems
+assume file-level dependencies and need special tooling (such as rdmd) in order
+to work efficiently.)
+$(LI Dependencies at the top of a module are easier to inspect quickly than
+dependencies spread throughout the module.)
+)
+
+See_Also: The $(HTTP forum.dlang.org/post/tzqzmqhankrkbrfsrmbo@forum.dlang.org,
+forum discussion) that led to the creation of the `imported` facility. Credit is
+due to Daniel Nielsen and Dominikus Dittes Scherkl.
+
+*/
+template imported(string moduleName)
+{
+ mixin("import imported = " ~ moduleName ~ ";");
+}
diff --git a/libphobos/libdruntime/rt/aApplyR.d b/libphobos/libdruntime/rt/aApplyR.d
index 6db6530..7f19fa8 100644
--- a/libphobos/libdruntime/rt/aApplyR.d
+++ b/libphobos/libdruntime/rt/aApplyR.d
@@ -8,19 +8,8 @@
* Authors: Walter Bright, Sean Kelly
* Source: $(DRUNTIMESRC rt/_aApplyR.d)
*/
-
-/* Copyright Digital Mars 2004 - 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)
- */
module rt.aApplyR;
-/* This code handles decoding UTF strings for foreach_reverse loops.
- * There are 6 combinations of conversions between char, wchar,
- * and dchar, and 2 of each of those.
- */
-
import core.internal.utf;
/**********************************************/
diff --git a/libphobos/libdruntime/rt/aaA.d b/libphobos/libdruntime/rt/aaA.d
index 0181053..6ff93f7 100644
--- a/libphobos/libdruntime/rt/aaA.d
+++ b/libphobos/libdruntime/rt/aaA.d
@@ -833,11 +833,9 @@ extern (C) hash_t _aaGetHash(scope const AA* paa, scope const TypeInfo tiRaw) no
size_t h;
foreach (b; aa.buckets)
{
- if (!b.filled)
- continue;
- size_t[2] h2 = [keyHash(b.entry), valHash(b.entry + off)];
// use addition here, so that hash is independent of element order
- h += hashOf(h2);
+ if (b.filled)
+ h += hashOf(valHash(b.entry + off), keyHash(b.entry));
}
return h;
diff --git a/libphobos/libdruntime/rt/dmain2.d b/libphobos/libdruntime/rt/dmain2.d
index 328452e..b363e3f 100644
--- a/libphobos/libdruntime/rt/dmain2.d
+++ b/libphobos/libdruntime/rt/dmain2.d
@@ -538,7 +538,7 @@ private extern (C) int _d_run_main2(char[][] args, size_t totalArgsLength, MainF
return result;
}
-private void formatThrowable(Throwable t, scope void delegate(const scope char[] s) nothrow sink)
+private void formatThrowable(Throwable t, scope void delegate(in char[] s) nothrow sink)
{
foreach (u; t)
{
@@ -667,7 +667,7 @@ extern (C) void _d_print_throwable(Throwable t)
}
}
- void sink(const scope char[] buf) scope nothrow
+ void sink(in char[] buf) scope nothrow
{
fprintf(stderr, "%.*s", cast(int)buf.length, buf.ptr);
}
diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE
index 927d3ee..29bcf33 100644
--- a/libphobos/src/MERGE
+++ b/libphobos/src/MERGE
@@ -1,4 +1,4 @@
-5ab9ad2561cea35ac33ebc0452c0e6a8d762f27d
+574bf883b790340fb753d6542ec48a3ba3e6cb82
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 ba1579d..c584b5a 100644
--- a/libphobos/src/Makefile.am
+++ b/libphobos/src/Makefile.am
@@ -19,8 +19,9 @@
include $(top_srcdir)/d_rules.am
# Make sure GDC can find libdruntime and libphobos include files
-D_EXTRA_DFLAGS=-fpreview=dip1000 -fpreview=dtorfields -nostdinc -I $(srcdir) \
- -I $(top_srcdir)/libdruntime -I ../libdruntime -I .
+D_EXTRA_DFLAGS=-fpreview=dip1000 -fpreview=dtorfields -fpreview=fieldwise \
+ -nostdinc -I $(srcdir) -I $(top_srcdir)/libdruntime \
+ -I ../libdruntime -I .
# D flags for compilation
AM_DFLAGS= \
diff --git a/libphobos/src/Makefile.in b/libphobos/src/Makefile.in
index 9e61bb3..a4101eb 100644
--- a/libphobos/src/Makefile.in
+++ b/libphobos/src/Makefile.in
@@ -500,8 +500,9 @@ LTDCOMPILE = $(LIBTOOL) --tag=D $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
# Include D build rules
# Make sure GDC can find libdruntime and libphobos include files
-D_EXTRA_DFLAGS = -fpreview=dip1000 -fpreview=dtorfields -nostdinc -I $(srcdir) \
- -I $(top_srcdir)/libdruntime -I ../libdruntime -I .
+D_EXTRA_DFLAGS = -fpreview=dip1000 -fpreview=dtorfields -fpreview=fieldwise \
+ -nostdinc -I $(srcdir) -I $(top_srcdir)/libdruntime \
+ -I ../libdruntime -I .
# D flags for compilation
diff --git a/libphobos/src/etc/c/curl.d b/libphobos/src/etc/c/curl.d
index 98fe74a..0c5b727 100644
--- a/libphobos/src/etc/c/curl.d
+++ b/libphobos/src/etc/c/curl.d
@@ -548,29 +548,36 @@ enum CurlProxy {
alias curl_proxytype = int;
///
-enum CurlAuth : long {
- none = 0,
- basic = 1, /** Basic (default) */
- digest = 2, /** Digest */
- gssnegotiate = 4, /** GSS-Negotiate */
- ntlm = 8, /** NTLM */
- digest_ie = 16, /** Digest with IE flavour */
- only = 2_147_483_648, /** used together with a single other
- type to force no auth or just that
- single type */
- any = -17, /* (~CURLAUTH_DIGEST_IE) */ /** all fine types set */
- anysafe = -18 /* (~(CURLAUTH_BASIC|CURLAUTH_DIGEST_IE)) */ ///
+enum CurlAuth : ulong {
+ none = 0UL, /** None */
+ basic = 1UL << 0, /** Basic (default) */
+ digest = 1UL << 1, /** Digest */
+ negotiate = 1UL << 2, /** Negotiate (SPNEGO) */
+ gssnegotiate = negotiate, /** GSS-Negotiate */
+ gssapi = negotiate, /** GSS-Negoatiate */
+ ntlm = 1UL << 3, /** NTLM */
+ digest_ie = 1UL << 4, /** Digest with IE flavour */
+ ntlm_WB = 1UL << 5, /** NTML delegated to winbind helper */
+ bearer = 1UL << 6, /** Bearer token authentication */
+ only = 1UL << 31, /** used together with a single other
+ type to force no auth or just that
+ single type */
+ any = ~digest_ie, /** any allows */
+ anysafe = ~(basic | digest_ie) /** any except basic */
}
///
enum CurlSshAuth {
- any = -1, /** all types supported by the server */
+ any = ~0, /** all types supported by the server */
none = 0, /** none allowed, silly but complete */
- publickey = 1, /** public/private key files */
- password = 2, /** password */
- host = 4, /** host key files */
- keyboard = 8, /** keyboard interactive */
- default_ = -1 // CURLSSH_AUTH_ANY;
+ publickey = 1 << 0, /** public/private key files */
+ password = 1 << 1, /** password */
+ host = 1 << 2, /** host key files */
+ keyboard = 1 << 3, /** keyboard interactive */
+ agent = 1 << 4, /** agent (ssh-agent, pageant...) */
+ gssapi = 1 << 5, /** gssapi (kerberos, ...) */
+
+ default_ = any // CURLSSH_AUTH_ANY;
}
///
enum CURL_ERROR_SIZE = 256;
diff --git a/libphobos/src/index.d b/libphobos/src/index.dd
index 8613a3c..8613a3c 100644
--- a/libphobos/src/index.d
+++ b/libphobos/src/index.dd
diff --git a/libphobos/src/std/algorithm/comparison.d b/libphobos/src/std/algorithm/comparison.d
index c952544..2fcc2ba 100644
--- a/libphobos/src/std/algorithm/comparison.d
+++ b/libphobos/src/std/algorithm/comparison.d
@@ -58,10 +58,10 @@ T2=$(TR $(TDNW $(LREF $1)) $(TD $+))
*/
module std.algorithm.comparison;
-import std.functional : unaryFun, binaryFun;
+import std.functional : unaryFun, binaryFun, lessThan, greaterThan;
import std.range.primitives;
import std.traits;
-import std.meta : allSatisfy;
+import std.meta : allSatisfy, anySatisfy;
import std.typecons : tuple, Tuple, Flag, Yes;
import std.internal.attributes : betterC;
@@ -247,7 +247,7 @@ auto castSwitch(choices...)(Object switchObject)
bool result = true;
foreach (index, choice; choices)
{
- result &= is(ReturnType!choice == void);
+ result &= is(ReturnType!choice : void); // void or noreturn
}
return result;
}();
@@ -514,9 +514,54 @@ auto castSwitch(choices...)(Object switchObject)
) == "derived from I");
}
-/** Clamps a value into the given bounds.
+// https://issues.dlang.org/show_bug.cgi?id=22384
+@system unittest
+{
+ // Use explicit methods to enforce return types
+ static void objectSkip(Object) {}
+ static void defaultSkip() {}
+
+ static noreturn objectError(Object) { assert(false); }
+ static noreturn defaultError() { assert(false); }
+
+ {
+ alias test = castSwitch!(objectSkip, defaultError);
+ static assert(is(ReturnType!test == void));
+ }{
+ alias test = castSwitch!(objectError, defaultSkip);
+ static assert(is(ReturnType!test == void));
+ }{
+ alias test = castSwitch!(objectError, defaultError);
+ static assert(is(ReturnType!test == noreturn));
+ }
+
+ // Also works with non-void handlers
+ static int objectValue(Object) { return 1;}
+ static int defaultValue() { return 2; }
+
+ {
+ alias test = castSwitch!(objectValue, defaultError);
+ static assert(is(ReturnType!test == int));
+ }{
+ alias test = castSwitch!(objectError, defaultValue);
+ static assert(is(ReturnType!test == int));
+ }
+
+ // No confusion w.r.t. void callbacks
+ alias FP = void function();
+ static FP objectFunc(Object) { return &defaultSkip; }
+ static FP defaultFunc() { return &defaultSkip; }
+
+ {
+ alias test = castSwitch!(objectFunc, defaultError);
+ static assert(is(ReturnType!test == FP));
+ }{
+ alias test = castSwitch!(objectError, defaultFunc);
+ static assert(is(ReturnType!test == FP));
+ }
+}
-This function is equivalent to `max(lower, min(upper, val))`.
+/** Clamps `val` into the given bounds. Result has the same type as `val`.
Params:
val = The value to _clamp.
@@ -524,20 +569,22 @@ Params:
upper = The _upper bound of the _clamp.
Returns:
- Returns `val`, if it is between `lower` and `upper`.
- Otherwise returns the nearest of the two.
-
+ `lower` if `val` is less than `lower`, `upper` if `val` is greater than
+ `upper`, and `val` in all other cases. Comparisons are made
+ correctly (using $(REF lessThan, std,functional) and the return value
+ is converted to the return type using the standard integer coversion rules
+ $(REF greaterThan, std,functional)) even if the signedness of `T1`, `T2`,
+ and `T3` are different.
*/
-auto clamp(T1, T2, T3)(T1 val, T2 lower, T3 upper)
-if (is(typeof(max(min(val, upper), lower))))
+T1 clamp(T1, T2, T3)(T1 val, T2 lower, T3 upper)
+if (is(typeof(val.lessThan(lower) ? lower : val.greaterThan(upper) ? upper : val) : T1))
in
{
- import std.functional : greaterThan;
assert(!lower.greaterThan(upper), "Lower can't be greater than upper.");
}
do
{
- return max(min(val, upper), lower);
+ return val.lessThan(lower) ? lower : val.greaterThan(upper) ? upper : val;
}
///
@@ -550,6 +597,10 @@ do
assert(clamp(1, 1, 1) == 1);
assert(clamp(5, -1, 2u) == 2);
+
+ auto x = clamp(42, uint.max, uint.max);
+ static assert(is(typeof(x) == int));
+ assert(x == -1);
}
@safe unittest
@@ -564,7 +615,7 @@ do
// mixed sign
a = -5;
uint f = 5;
- static assert(is(typeof(clamp(f, a, b)) == int));
+ static assert(is(typeof(clamp(f, a, b)) == uint));
assert(clamp(f, a, b) == f);
// similar type deduction for (u)long
static assert(is(typeof(clamp(-1L, -2L, 2UL)) == long));
@@ -874,101 +925,121 @@ nothrow pure @safe unittest
// equal
/**
-Compares two ranges for equality, as defined by predicate `pred`
+Compares two or more ranges for equality, as defined by predicate `pred`
(which is `==` by default).
*/
template equal(alias pred = "a == b")
{
/++
- Compares two ranges for equality. The ranges may have
- different element types, as long as `pred(r1.front, r2.front)`
- evaluates to `bool`.
- Performs $(BIGOH min(r1.length, r2.length)) evaluations of `pred`.
+ Compares two or more ranges for equality. The ranges may have
+ different element types, as long as all are comparable by means of
+ the `pred`.
+ Performs $(BIGOH min(rs[0].length, rs[1].length, ...)) evaluations of `pred`. However, if
+ `equal` is invoked with the default predicate, the implementation may take the liberty
+ to use faster implementations that have the theoretical worst-case
+ $(BIGOH max(rs[0].length, rs[1].length, ...)).
At least one of the ranges must be finite. If one range involved is infinite, the result is
(statically known to be) `false`.
- If the two ranges are different kinds of UTF code unit (`char`, `wchar`, or
- `dchar`), then the arrays are compared using UTF decoding to avoid
+ If the ranges have different kinds of UTF code unit (`char`, `wchar`, or
+ `dchar`), then they are compared using UTF decoding to avoid
accidentally integer-promoting units.
Params:
- r1 = The first range to be compared.
- r2 = The second range to be compared.
+ rs = The ranges to be compared.
Returns:
- `true` if and only if the two ranges compare _equal element
+ `true` if and only if all ranges compare _equal element
for element, according to binary predicate `pred`.
+/
- bool equal(Range1, Range2)(Range1 r1, Range2 r2)
- if (isInputRange!Range1 && isInputRange!Range2 &&
- !(isInfinite!Range1 && isInfinite!Range2) &&
- is(typeof(binaryFun!pred(r1.front, r2.front))))
+ bool equal(Ranges...)(Ranges rs)
+ if (rs.length > 1
+ && allSatisfy!(isInputRange, Ranges)
+ && !allSatisfy!(isInfinite, Ranges)
+ && is(typeof(binaryFun!pred(rs[0].front, rs[1].front)))
+ && (rs.length == 2 || is(typeof(equal!pred(rs[1 .. $])) == bool))
+ )
{
- // Use code points when comparing two ranges of UTF code units that aren't
- // the same type. This is for backwards compatibility with autodecode
- // strings.
- enum useCodePoint =
- isSomeChar!(ElementEncodingType!Range1) && isSomeChar!(ElementEncodingType!Range2) &&
- ElementEncodingType!Range1.sizeof != ElementEncodingType!Range2.sizeof;
-
- static if (useCodePoint)
+ alias ElementEncodingTypes = staticMap!(ElementEncodingType, Ranges);
+ enum differentSize(T) = T.sizeof != ElementEncodingTypes[0].sizeof;
+ enum useCodePoint = allSatisfy!(isSomeChar, ElementEncodingTypes) &&
+ anySatisfy!(differentSize, ElementEncodingTypes);
+ enum bool comparableWithEq(alias r) = is(typeof(rs[0] == r));
+
+ static if (anySatisfy!(isInfinite, Ranges))
{
- import std.utf : byDchar;
- return equal(r1.byDchar, r2.byDchar);
+ return false;
}
- else
+ else static if (useCodePoint)
{
- static if (isInfinite!Range1 || isInfinite!Range2)
- {
- // No finite range can be ever equal to an infinite range.
- return false;
- }
- // Detect default pred and compatible dynamic arrays.
- else static if (is(typeof(pred) == string) && pred == "a == b" &&
- isArray!Range1 && isArray!Range2 && is(typeof(r1 == r2)))
- {
- return r1 == r2;
- }
- // If one of the arguments is a string and the other isn't, then auto-decoding
- // can be avoided if they have the same ElementEncodingType.
- else static if (is(typeof(pred) == string) && pred == "a == b" &&
- isAutodecodableString!Range1 != isAutodecodableString!Range2 &&
- is(immutable ElementEncodingType!Range1 == immutable ElementEncodingType!Range2))
+ import std.utf : byDchar;
+ static bool allByDchar(size_t done, Ranges...)(auto ref Ranges rs)
{
- import std.utf : byCodeUnit;
-
- static if (isAutodecodableString!Range1)
- return equal(r1.byCodeUnit, r2);
+ static if (done == rs.length)
+ return equalLoop(rs);
else
- return equal(r2.byCodeUnit, r1);
- }
- // Try a fast implementation when the ranges have comparable lengths.
- else static if (hasLength!Range1 && hasLength!Range2 && is(typeof(r1.length == r2.length)))
- {
- immutable len1 = r1.length;
- immutable len2 = r2.length;
- if (len1 != len2) return false; //Short circuit return
-
- // Lengths are the same, so we need to do an actual comparison.
- // Good news is we can squeeze out a bit of performance by not checking if r2 is empty.
- for (; !r1.empty; r1.popFront(), r2.popFront())
- {
- if (!binaryFun!(pred)(r1.front, r2.front)) return false;
- }
- return true;
+ return allByDchar!(done + 1)(rs[0 .. done], rs[done].byDchar, rs[done + 1 .. $]);
}
+ return allByDchar!0(rs);
+ }
+ else static if (is(typeof(pred) == string) && pred == "a == b" &&
+ allSatisfy!(isArray, Ranges) && allSatisfy!(comparableWithEq, rs))
+ {
+ static foreach (r; rs[1 .. $])
+ if (rs[0] != r)
+ return false;
+ return true;
+ }
+ // if one of the arguments is a string and the other isn't, then auto-decoding
+ // can be avoided if they have the same ElementEncodingType
+ // TODO: generalize this
+ else static if (rs.length == 2 && is(typeof(pred) == string) && pred == "a == b" &&
+ isAutodecodableString!(Ranges[0]) != isAutodecodableString!(Ranges[1]) &&
+ is(immutable ElementEncodingType!(Ranges[0]) == immutable ElementEncodingType!(Ranges[1])))
+ {
+ import std.utf : byCodeUnit;
+ static if (isAutodecodableString!(Ranges[0]))
+ return equal(rs[0].byCodeUnit, rs[1]);
else
+ return equal(rs[1].byCodeUnit, rs[0]);
+ }
+ else
+ {
+ static foreach (i, R; Ranges)
{
- //Generic case, we have to walk both ranges making sure neither is empty
- for (; !r1.empty; r1.popFront(), r2.popFront())
+ static if (hasLength!R)
{
- if (r2.empty || !binaryFun!(pred)(r1.front, r2.front)) return false;
+ static if (!is(typeof(firstLength)))
+ {
+ // Found the first range that has length
+ auto firstLength = rs[i].length;
+ }
+ else
+ {
+ // Compare the length of the current range against the first with length
+ if (firstLength != rs[i].length)
+ return false;
+ }
}
- return r2.empty;
}
+ return equalLoop(rs);
}
}
+
+ private bool equalLoop(Rs...)(Rs rs)
+ {
+ for (; !rs[0].empty; rs[0].popFront)
+ static foreach (r; rs[1 .. $])
+ if (r.empty || !binaryFun!pred(rs[0].front, r.front))
+ return false;
+ else
+ r.popFront;
+ static foreach (r; rs[1 .. $])
+ if (!r.empty)
+ return false;
+ return true;
+ }
}
///
@@ -992,6 +1063,31 @@ template equal(alias pred = "a == b")
assert(equal!isClose(b[], c[]));
}
+@safe @nogc unittest
+{
+ import std.algorithm.comparison : equal;
+ import std.math.operations : isClose;
+
+ auto s1 = "abc", s2 = "abc"w;
+ assert(equal(s1, s2, s2));
+ assert(equal(s1, s2, s2, s1));
+ assert(!equal(s1, s2, s2[1 .. $]));
+
+ int[4] a = [ 1, 2, 4, 3 ];
+ assert(!equal(a[], a[1..$], a[]));
+ assert(equal(a[], a[], a[]));
+ assert(equal!((a, b) => a == b)(a[], a[], a[]));
+
+ // different types
+ double[4] b = [ 1.0, 2, 4, 3];
+ assert(!equal(a[], b[1..$], b[]));
+ assert(equal(a[], b[], a[], b[]));
+
+ // predicated: ensure that two vectors are approximately equal
+ double[4] c = [ 1.0000000005, 2, 4, 3];
+ assert(equal!isClose(b[], c[], b[]));
+}
+
/++
Tip: `equal` can itself be used as a predicate to other functions.
This can be very useful when the element type of a range is itself a
@@ -1748,21 +1844,26 @@ store the lowest values.
// mismatch
/**
-Sequentially compares elements in `r1` and `r2` in lockstep, and
+Sequentially compares elements in `rs` in lockstep, and
stops at the first mismatch (according to `pred`, by default
equality). Returns a tuple with the reduced ranges that start with the
-two mismatched values. Performs $(BIGOH min(r1.length, r2.length))
+two mismatched values. Performs $(BIGOH min(r[0].length, r[1].length, ...))
evaluations of `pred`.
*/
-Tuple!(Range1, Range2)
-mismatch(alias pred = "a == b", Range1, Range2)(Range1 r1, Range2 r2)
-if (isInputRange!(Range1) && isInputRange!(Range2))
+Tuple!(Ranges)
+mismatch(alias pred = (a, b) => a == b, Ranges...)(Ranges rs)
+if (rs.length >= 2 && allSatisfy!(isInputRange, Ranges))
{
- for (; !r1.empty && !r2.empty; r1.popFront(), r2.popFront())
+ loop: for (; !rs[0].empty; rs[0].popFront)
{
- if (!binaryFun!(pred)(r1.front, r2.front)) break;
+ static foreach (r; rs[1 .. $])
+ {
+ if (r.empty || !binaryFun!pred(rs[0].front, r.front))
+ break loop;
+ r.popFront;
+ }
}
- return tuple(r1, r2);
+ return tuple(rs);
}
///
@@ -1773,6 +1874,12 @@ if (isInputRange!(Range1) && isInputRange!(Range2))
auto m = mismatch(x[], y[]);
assert(m[0] == x[3 .. $]);
assert(m[1] == y[3 .. $]);
+
+ auto m2 = mismatch(x[], y[], x[], y[]);
+ assert(m2[0] == x[3 .. $]);
+ assert(m2[1] == y[3 .. $]);
+ assert(m2[2] == x[3 .. $]);
+ assert(m2[3] == y[3 .. $]);
}
@safe @nogc unittest
@@ -1925,50 +2032,91 @@ auto predSwitch(alias pred = "a == b", T, R ...)(T switchExpression, lazy R choi
}
/**
-Checks if the two ranges have the same number of elements. This function is
+Checks if two or more ranges have the same number of elements. This function is
optimized to always take advantage of the `length` member of either range
if it exists.
-If both ranges have a length member, this function is $(BIGOH 1). Otherwise,
-this function is $(BIGOH min(r1.length, r2.length)).
+If all ranges have a `length` member or at least one is infinite,
+`_isSameLength`'s complexity is $(BIGOH 1). Otherwise, complexity is
+$(BIGOH n), where `n` is the smallest of the lengths of ranges with unknown
+length.
-Infinite ranges are considered of the same length. An infinite range has never the same length as a
-finite range.
+Infinite ranges are considered of the same length. An infinite range has never
+the same length as a finite range.
Params:
- r1 = a finite $(REF_ALTTEXT input range, isInputRange, std,range,primitives)
- r2 = a finite $(REF_ALTTEXT input range, isInputRange, std,range,primitives)
+ rs = two or more $(REF_ALTTEXT input ranges, isInputRange, std,range,primitives)
Returns:
`true` if both ranges have the same length, `false` otherwise.
*/
-bool isSameLength(Range1, Range2)(Range1 r1, Range2 r2)
-if (isInputRange!Range1 && isInputRange!Range2)
+bool isSameLength(Ranges...)(Ranges rs)
+if (allSatisfy!(isInputRange, Ranges))
{
- static if (isInfinite!Range1 || isInfinite!Range2)
- {
- return isInfinite!Range1 && isInfinite!Range2;
- }
- else static if (hasLength!(Range1) && hasLength!(Range2))
+ static if (anySatisfy!(isInfinite, Ranges))
{
- return r1.length == r2.length;
+ return allSatisfy!(isInfinite, Ranges);
}
- else static if (hasLength!(Range1) && !hasLength!(Range2))
+ else static if (anySatisfy!(hasLength, Ranges))
{
- return r2.walkLength(r1.length + 1) == r1.length;
- }
- else static if (!hasLength!(Range1) && hasLength!(Range2))
- {
- return r1.walkLength(r2.length + 1) == r2.length;
+ // Compute the O(1) length
+ auto baselineLength = size_t.max;
+ static foreach (i, R; Ranges)
+ {
+ static if (hasLength!R)
+ {
+ if (baselineLength == size_t.max)
+ baselineLength = rs[i].length;
+ else if (rs[i].length != baselineLength)
+ return false;
+ }
+ }
+ // Iterate all ranges without known length
+ foreach (_; 0 .. baselineLength)
+ static foreach (i, R; Ranges)
+ {
+ static if (!hasLength!R)
+ {
+ // All must be non-empty
+ if (rs[i].empty)
+ return false;
+ rs[i].popFront;
+ }
+ }
+ static foreach (i, R; Ranges)
+ {
+ static if (!hasLength!R)
+ {
+ // All must be now empty
+ if (!rs[i].empty)
+ return false;
+ }
+ }
+ return true;
}
else
{
- for (; !r1.empty; r1.popFront, r2.popFront)
- {
- if (r2.empty)
- return false;
- }
- return r2.empty;
+ // All have unknown length, iterate in lockstep
+ for (;;)
+ static foreach (i, r; rs)
+ {
+ if (r.empty)
+ {
+ // One is empty, so all must be empty
+ static if (i != 0)
+ {
+ return false;
+ }
+ else
+ {
+ static foreach (j, r1; rs[1 .. $])
+ if (!r1.empty)
+ return false;
+ return true;
+ }
+ }
+ r.popFront;
+ }
}
}
@@ -1976,34 +2124,42 @@ if (isInputRange!Range1 && isInputRange!Range2)
@safe nothrow pure unittest
{
assert(isSameLength([1, 2, 3], [4, 5, 6]));
+ assert(isSameLength([1, 2, 3], [4, 5, 6], [7, 8, 9]));
assert(isSameLength([0.3, 90.4, 23.7, 119.2], [42.6, 23.6, 95.5, 6.3]));
assert(isSameLength("abc", "xyz"));
+ assert(isSameLength("abc", "xyz", [1, 2, 3]));
int[] a;
int[] b;
assert(isSameLength(a, b));
+ assert(isSameLength(a, b, a, a, b, b, b));
assert(!isSameLength([1, 2, 3], [4, 5]));
+ assert(!isSameLength([1, 2, 3], [4, 5, 6], [7, 8]));
assert(!isSameLength([0.3, 90.4, 23.7], [42.6, 23.6, 95.5, 6.3]));
assert(!isSameLength("abcd", "xyz"));
+ assert(!isSameLength("abcd", "xyz", "123"));
+ assert(!isSameLength("abcd", "xyz", "1234"));
}
// Test CTFE
@safe @nogc pure @betterC unittest
{
- enum result1 = isSameLength([1, 2, 3], [4, 5, 6]);
- static assert(result1);
-
- enum result2 = isSameLength([0.3, 90.4, 23.7], [42.6, 23.6, 95.5, 6.3]);
- static assert(!result2);
+ static assert(isSameLength([1, 2, 3], [4, 5, 6]));
+ static assert(isSameLength([1, 2, 3], [4, 5, 6], [7, 8, 9]));
+ static assert(!isSameLength([0.3, 90.4, 23.7], [42.6, 23.6, 95.5, 6.3]));
+ static assert(!isSameLength([1], [0.3, 90.4], [42]));
}
@safe @nogc pure unittest
{
import std.range : only;
assert(isSameLength(only(1, 2, 3), only(4, 5, 6)));
+ assert(isSameLength(only(1, 2, 3), only(4, 5, 6), only(7, 8, 9)));
assert(isSameLength(only(0.3, 90.4, 23.7, 119.2), only(42.6, 23.6, 95.5, 6.3)));
assert(!isSameLength(only(1, 3, 3), only(4, 5)));
+ assert(!isSameLength(only(1, 3, 3), only(1, 3, 3), only(4, 5)));
+ assert(!isSameLength(only(1, 3, 3), only(4, 5), only(1, 3, 3)));
}
@safe nothrow pure unittest
@@ -2033,6 +2189,15 @@ if (isInputRange!Range1 && isInputRange!Range2)
DummyRange!(ReturnBy.Reference, Length.Yes, RangeType.Input) r11;
auto r12 = new ReferenceInputRange!int([1, 2, 3, 4, 5, 6, 7, 8]);
assert(!isSameLength(r11, r12));
+
+ import std.algorithm.iteration : filter;
+
+ assert(isSameLength(filter!"a >= 1"([1, 2, 3]), [4, 5, 6]));
+ assert(!isSameLength(filter!"a > 1"([1, 2, 3]), [4, 5, 6]));
+
+ assert(isSameLength(filter!"a > 1"([1, 2, 3]), filter!"a > 4"([4, 5, 6])));
+ assert(isSameLength(filter!"a > 1"([1, 2, 3]),
+ filter!"a > 4"([4, 5, 6]), filter!"a >= 5"([4, 5, 6])));
}
// Still functional but not documented anymore.
diff --git a/libphobos/src/std/algorithm/iteration.d b/libphobos/src/std/algorithm/iteration.d
index c3e8487..9e728e4 100644
--- a/libphobos/src/std/algorithm/iteration.d
+++ b/libphobos/src/std/algorithm/iteration.d
@@ -77,51 +77,6 @@ import std.range.primitives;
import std.traits;
import std.typecons : Flag, Yes, No;
-private template aggregate(fun...)
-if (fun.length >= 1)
-{
- /* --Intentionally not ddoc--
- * Aggregates elements in each subrange of the given range of ranges using
- * the given aggregating function(s).
- * Params:
- * fun = One or more aggregating functions (binary functions that return a
- * single _aggregate value of their arguments).
- * ror = A range of ranges to be aggregated.
- *
- * Returns:
- * A range representing the aggregated value(s) of each subrange
- * of the original range. If only one aggregating function is specified,
- * each element will be the aggregated value itself; if multiple functions
- * are specified, each element will be a tuple of the aggregated values of
- * each respective function.
- */
- auto aggregate(RoR)(RoR ror)
- if (isInputRange!RoR && isIterable!(ElementType!RoR))
- {
- return ror.map!(reduce!fun);
- }
-
- @safe unittest
- {
- import std.algorithm.comparison : equal, max, min;
-
- auto data = [[4, 2, 1, 3], [4, 9, -1, 3, 2], [3]];
-
- // Single aggregating function
- auto agg1 = data.aggregate!max;
- assert(agg1.equal([4, 9, 3]));
-
- // Multiple aggregating functions
- import std.typecons : tuple;
- auto agg2 = data.aggregate!(max, min);
- assert(agg2.equal([
- tuple(4, 1),
- tuple(9, -1),
- tuple(3, 3)
- ]));
- }
-}
-
/++
`cache` eagerly evaluates $(REF_ALTTEXT front, front, std,range,primitives) of `range`
on each construction or call to $(REF_ALTTEXT popFront, popFront, std,range,primitives),
@@ -2029,23 +1984,39 @@ private struct ChunkByGroup(alias eq, Range, bool eqEquivalenceAssured)
}
private Range current;
- private RefCounted!(OuterRange) mothership;
+ // using union prevents RefCounted destructor from propagating @system to
+ // user code
+ union { private RefCounted!(OuterRange) mothership; }
+ private @trusted ref cargo() { return mothership.refCountedPayload; }
- this(RefCounted!(OuterRange) origin)
+ private this(ref RefCounted!(OuterRange) origin)
{
- groupNum = origin.groupNum;
- current = origin.current.save;
+ () @trusted { mothership = origin; }();
+ groupNum = cargo.groupNum;
+ current = cargo.current.save;
assert(!current.empty, "Passed range 'r' must not be empty");
+
static if (eqEquivalenceAssured)
{
- start = origin.current.save;
+ start = cargo.current.save;
// Check for reflexivity.
assert(eq(start.front, current.front),
"predicate is not reflexive");
}
+ }
+
+ // Cannot be a copy constructor due to issue 22239
+ this(this) @trusted
+ {
+ import core.lifetime : emplace;
+ // since mothership has to be in a union, we have to manually trigger
+ // an increment to the reference count.
+ auto temp = mothership;
+ mothership = temp;
- mothership = origin;
+ // prevents the reference count from falling back with brute force
+ emplace(&temp);
}
@property bool empty() { return groupNum == size_t.max; }
@@ -2073,14 +2044,14 @@ private struct ChunkByGroup(alias eq, Range, bool eqEquivalenceAssured)
if (nowEmpty)
{
- if (groupNum == mothership.groupNum)
+ if (groupNum == cargo.groupNum)
{
// If parent range hasn't moved on yet, help it along by
// saving location of start of next Group.
- mothership.next = current.save;
+ cargo.next = current.save;
static if (!eqEquivalenceAssured)
{
- mothership.nextUpdated = true;
+ cargo.nextUpdated = true;
}
}
@@ -2094,6 +2065,11 @@ private struct ChunkByGroup(alias eq, Range, bool eqEquivalenceAssured)
copy.current = current.save;
return copy;
}
+
+ @trusted ~this()
+ {
+ mothership.destroy;
+ }
}
private enum GroupingOpType{binaryEquivalent, binaryAny, unary}
@@ -2110,23 +2086,48 @@ if (isForwardRange!Range)
static assert(isForwardRange!InnerRange);
- private RefCounted!OuterRange impl;
+ // using union prevents RefCounted destructor from propagating @system to
+ // user code
+ union { private RefCounted!OuterRange _impl; }
+ private @trusted ref impl() { return _impl; }
+ private @trusted ref implPL() { return _impl.refCountedPayload; }
this(Range r)
{
- static if (eqEquivalenceAssured)
+ import core.lifetime : move;
+
+ auto savedR = r.save;
+
+ static if (eqEquivalenceAssured) () @trusted
{
- impl = RefCounted!OuterRange(0, r, r.save);
- }
- else impl = RefCounted!OuterRange(0, r, r.save, false);
+ _impl = RefCounted!OuterRange(0, r, savedR.move);
+ }();
+ else () @trusted
+ {
+ _impl = RefCounted!OuterRange(0, r, savedR.move, false);
+ }();
+ }
+
+ // Cannot be a copy constructor due to issue 22239
+ this(this) @trusted
+ {
+ import core.lifetime : emplace;
+ // since _impl has to be in a union, we have to manually trigger
+ // an increment to the reference count.
+ auto temp = _impl;
+ _impl = temp;
+
+ // prevents the reference count from falling back with brute force
+ emplace(&temp);
}
- @property bool empty() { return impl.current.empty; }
+ @property bool empty() { return implPL.current.empty; }
static if (opType == GroupingOpType.unary) @property auto front()
{
import std.typecons : tuple;
- return tuple(unaryFun!pred(impl.current.front), InnerRange(impl));
+
+ return tuple(unaryFun!pred(implPL.current.front), InnerRange(impl));
}
else @property auto front()
{
@@ -2138,48 +2139,53 @@ if (isForwardRange!Range)
// Scan for next group. If we're lucky, one of our Groups would have
// already set .next to the start of the next group, in which case the
// loop is skipped.
- while (!impl.next.empty && eq(impl.current.front, impl.next.front))
+ while (!implPL.next.empty && eq(implPL.current.front, implPL.next.front))
{
- impl.next.popFront();
+ implPL.next.popFront();
}
- impl.current = impl.next.save;
+ implPL.current = implPL.next.save;
// Indicate to any remaining Groups that we have moved on.
- impl.groupNum++;
+ implPL.groupNum++;
}
else void popFront()
{
- if (impl.nextUpdated)
+ if (implPL.nextUpdated)
{
- impl.current = impl.next.save;
+ implPL.current = implPL.next.save;
}
else while (true)
{
- auto prevElement = impl.current.front;
- impl.current.popFront();
- if (impl.current.empty) break;
- if (!eq(prevElement, impl.current.front)) break;
+ auto prevElement = implPL.current.front;
+ implPL.current.popFront();
+ if (implPL.current.empty) break;
+ if (!eq(prevElement, implPL.current.front)) break;
}
- impl.nextUpdated = false;
+ implPL.nextUpdated = false;
// Indicate to any remaining Groups that we have moved on.
- impl.groupNum++;
+ implPL.groupNum++;
}
@property auto save()
{
// Note: the new copy of the range will be detached from any existing
// satellite Groups, and will not benefit from the .next acceleration.
- return typeof(this)(impl.current.save);
+ return typeof(this)(implPL.current.save);
}
static assert(isForwardRange!(typeof(this)), typeof(this).stringof
~ " must be a forward range");
+
+ @trusted ~this()
+ {
+ _impl.destroy;
+ }
}
//Test for https://issues.dlang.org/show_bug.cgi?id=14909
-@system unittest
+@safe unittest
{
import std.algorithm.comparison : equal;
import std.typecons : tuple;
@@ -2192,8 +2198,36 @@ if (isForwardRange!Range)
assert(u.equal!equal([[1],[2],[3]]));
}
+//Testing inferring @system correctly
+@safe unittest
+{
+ struct DeadlySave
+ {
+ int front;
+ @safe void popFront(){front++;}
+ @safe bool empty(){return front >= 5;}
+ @system auto save(){return this;}
+ }
+
+ auto test1()
+ {
+ DeadlySave src;
+ return src.walkLength;
+
+ }
+
+ auto test2()
+ {
+ DeadlySave src;
+ return src.chunkBy!((a,b) => a % 2 == b % 2).walkLength;
+ }
+
+ static assert(isSafe!test1);
+ static assert(!isSafe!test2);
+}
+
//Test for https://issues.dlang.org/show_bug.cgi?id=18751
-@system unittest
+@safe unittest
{
import std.algorithm.comparison : equal;
@@ -2205,7 +2239,7 @@ if (isForwardRange!Range)
}
//Additional test for fix for issues 14909 and 18751
-@system unittest
+@safe unittest
{
import std.algorithm.comparison : equal;
auto v = [2,4,8,3,6,9,1,5,7];
@@ -2329,7 +2363,7 @@ if (isInputRange!Range)
}
/// Showing usage with binary predicate:
-/*FIXME: @safe*/ @system unittest
+@safe unittest
{
import std.algorithm.comparison : equal;
@@ -2356,7 +2390,7 @@ if (isInputRange!Range)
}
/// Showing usage with unary predicate:
-/* FIXME: pure @safe nothrow*/ @system unittest
+/* FIXME: pure nothrow*/ @safe unittest
{
import std.algorithm.comparison : equal;
import std.range.primitives;
@@ -2755,7 +2789,7 @@ if (isInputRange!Range)
// https://issues.dlang.org/show_bug.cgi?id=13805
-@system unittest
+@safe unittest
{
[""].map!((s) => s).chunkBy!((x, y) => true);
}
@@ -2790,9 +2824,8 @@ if (isForwardRange!Range)
return ChunkByImpl!(not!pred, not!pred, GroupingOpType.binaryAny, Range)(r);
}
-//FIXME: these should be @safe
///
-nothrow pure @system unittest
+nothrow pure @safe unittest
{
import std.algorithm.comparison : equal;
import std.range : dropExactly;
@@ -2816,7 +2849,7 @@ nothrow pure @system unittest
}
//ensure we don't iterate the underlying range twice
-nothrow @system unittest
+nothrow @safe unittest
{
import std.algorithm.comparison : equal;
import std.math.algebraic : abs;
@@ -2827,7 +2860,7 @@ nothrow @system unittest
static int popfrontsSoFar;
auto front(){return elements[0];}
- nothrow void popFront()
+ nothrow @safe void popFront()
{ popfrontsSoFar++;
elements = elements[1 .. $];
}
@@ -2851,7 +2884,7 @@ nothrow @system unittest
}
// Issue 13595
-@system unittest
+@safe unittest
{
import std.algorithm.comparison : equal;
auto r = [1, 2, 3, 4, 5, 6, 7, 8, 9].splitWhen!((x, y) => ((x*y) % 3) > 0);
@@ -2863,7 +2896,7 @@ nothrow @system unittest
]));
}
-nothrow pure @system unittest
+nothrow pure @safe unittest
{
// Grouping by maximum adjacent difference:
import std.math.algebraic : abs;
@@ -3654,10 +3687,18 @@ if (isInputRange!RoR && isInputRange!(ElementType!RoR))
{
@property auto save()
{
- auto r = Result(_items.save, _current.save);
+ // the null check is important if it is a class range, since null.save will segfault; issue #22359
+ // could not just compare x is y here without static if due to a compiler assertion failure
+ static if (is(typeof(null) : typeof(_current)))
+ auto r = Result(_items.save, _current is null ? null : _current.save);
+ else
+ auto r = Result(_items.save, _current.save);
static if (isBidirectional)
{
- r._currentBack = _currentBack.save;
+ static if (is(typeof(null) : typeof(_currentBack)))
+ r._currentBack = _currentBack is null ? null : _currentBack.save;
+ else
+ r._currentBack = _currentBack.save;
r.reachedFinalElement = reachedFinalElement;
}
return r;
@@ -3838,6 +3879,26 @@ if (isInputRange!RoR && isInputRange!(ElementType!RoR))
static assert(isForwardRange!(typeof(joiner([""]))));
}
+@system unittest
+{
+ // this test is system because the virtual interface call to save
+ // is flexible and thus cannot be inferred safe automatically
+
+ // https://issues.dlang.org/show_bug.cgi?id=22359
+ import std.range;
+ ForwardRange!int bug(int[][] r)
+ {
+ import std.range : inputRangeObject;
+ import std.algorithm.iteration : map, joiner;
+
+ auto range = inputRangeObject(r);
+
+ return range.map!(a =>inputRangeObject(a)).joiner.inputRangeObject;
+ }
+ auto f = bug([[]]);
+ f.save(); // should not segfault
+}
+
@safe unittest
{
// Initial version of PR #6115 caused a compilation failure for
diff --git a/libphobos/src/std/algorithm/mutation.d b/libphobos/src/std/algorithm/mutation.d
index 88191bb..07cbb9b 100644
--- a/libphobos/src/std/algorithm/mutation.d
+++ b/libphobos/src/std/algorithm/mutation.d
@@ -1427,7 +1427,7 @@ private void moveEmplaceImpl(T)(ref scope T target, ref return scope T source)
{
import std.exception : doesPointTo;
assert(!(doesPointTo(source, source) && !hasElaborateMove!T),
- "Cannot move object with internal pointer unless `opPostMove` is defined.");
+ "Cannot move object of type " ~ T.stringof ~ " with internal pointer unless `opPostMove` is defined.");
}
static if (is(T == struct))
diff --git a/libphobos/src/std/algorithm/searching.d b/libphobos/src/std/algorithm/searching.d
index d6d02ba..9635206 100644
--- a/libphobos/src/std/algorithm/searching.d
+++ b/libphobos/src/std/algorithm/searching.d
@@ -122,7 +122,9 @@ template all(alias pred = "a")
if (isInputRange!Range)
{
static assert(is(typeof(unaryFun!pred(range.front))),
- "`" ~ pred.stringof[1..$-1] ~ "` isn't a unary predicate function for range.front");
+ "`" ~ (isSomeString!(typeof(pred))
+ ? pred.stringof[1..$-1] : pred.stringof)
+ ~ "` isn't a unary predicate function for range.front");
import std.functional : not;
return find!(not!(unaryFun!pred))(range).empty;
@@ -3572,6 +3574,8 @@ Params:
r = range from which the minimal element will be selected
seed = custom seed to use as initial element
+Precondition: If a seed is not given, `r` must not be empty.
+
Returns: The minimal element of the passed-in range.
Note:
@@ -3723,6 +3727,8 @@ Params:
r = range from which the maximum element will be selected
seed = custom seed to use as initial element
+Precondition: If a seed is not given, `r` must not be empty.
+
Returns: The maximal element of the passed-in range.
Note:
diff --git a/libphobos/src/std/algorithm/sorting.d b/libphobos/src/std/algorithm/sorting.d
index dbfe37f..f2877cc 100644
--- a/libphobos/src/std/algorithm/sorting.d
+++ b/libphobos/src/std/algorithm/sorting.d
@@ -2209,7 +2209,7 @@ package(std) template HeapOps(alias less, Range)
~ " RandomAccessRange");
static assert(hasLength!Range, Range.stringof ~ " must have length");
static assert(hasSwappableElements!Range || hasAssignableElements!Range,
- Range.stringof ~ " must have swappable of assignable Elements");
+ Range.stringof ~ " must have swappable or assignable Elements");
alias lessFun = binaryFun!less;
@@ -2329,8 +2329,8 @@ private template TimSortImpl(alias pred, R)
~ " RandomAccessRange");
static assert(hasLength!R, R.stringof ~ " must have a length");
static assert(hasSlicing!R, R.stringof ~ " must support slicing");
- static assert(hasAssignableElements!R, R.stringof ~ " must support"
- ~ " assigning elements");
+ static assert(hasAssignableElements!R, R.stringof ~ " must have"
+ ~ " assignable elements");
alias T = ElementType!R;
@@ -3571,7 +3571,7 @@ void topNImpl(alias less, R)(R r, size_t n, ref bool useSampling)
private size_t topNPartition(alias lp, R)(R r, size_t n, bool useSampling)
{
import std.format : format;
- assert(r.length >= 9 && n < r.length, "length must be longer than 9"
+ assert(r.length >= 9 && n < r.length, "length must be longer than 8"
~ " and n must be less than r.length");
immutable ninth = r.length / 9;
auto pivot = ninth / 2;
@@ -4220,8 +4220,8 @@ if (isRandomAccessRange!Range && hasLength!Range &&
Indexes.length >= 2 && Indexes.length <= 5 &&
allSatisfy!(isUnsigned, Indexes))
{
- assert(r.length >= Indexes.length, "r.length must be greater equal to"
- ~ " Indexes.length");
+ assert(r.length >= Indexes.length, "r.length must be greater than or"
+ ~ " equal to Indexes.length");
import std.functional : binaryFun;
alias lt = binaryFun!less;
enum k = Indexes.length;
diff --git a/libphobos/src/std/array.d b/libphobos/src/std/array.d
index ded1196..ffdda8e 100644
--- a/libphobos/src/std/array.d
+++ b/libphobos/src/std/array.d
@@ -259,6 +259,19 @@ if (isPointer!Range && isIterable!(PointerTarget!Range) && !isAutodecodableStrin
)));
}
+// https://issues.dlang.org/show_bug.cgi?id=20937
+@safe pure nothrow unittest
+{
+ struct S {int* x;}
+ struct R
+ {
+ immutable(S) front;
+ bool empty;
+ @safe pure nothrow void popFront(){empty = true;}
+ }
+ R().array;
+}
+
/**
Convert a narrow autodecoding string to an array type that fully supports
random access. This is handled as a special case and always returns an array
@@ -1609,7 +1622,7 @@ private template isInputRangeOrConvertible(E)
`true` if $(D lhs.ptr == rhs.ptr), `false` otherwise.
+/
@safe
-pure nothrow bool sameHead(T)(in T[] lhs, in T[] rhs)
+pure nothrow @nogc bool sameHead(T)(in T[] lhs, in T[] rhs)
{
return lhs.ptr == rhs.ptr;
}
@@ -1637,7 +1650,7 @@ pure nothrow bool sameHead(T)(in T[] lhs, in T[] rhs)
`false` otherwise.
+/
@trusted
-pure nothrow bool sameTail(T)(in T[] lhs, in T[] rhs)
+pure nothrow @nogc bool sameTail(T)(in T[] lhs, in T[] rhs)
{
return lhs.ptr + lhs.length == rhs.ptr + rhs.length;
}
@@ -3492,13 +3505,14 @@ if (isDynamicArray!A)
}
else
{
- import core.internal.lifetime : emplaceRef;
+ import core.lifetime : emplace;
ensureAddable(1);
immutable len = _data.arr.length;
auto bigData = (() @trusted => _data.arr.ptr[0 .. len + 1])();
- emplaceRef!(Unqual!T)(bigData[len], cast() item);
+ auto itemUnqual = (() @trusted => & cast() item)();
+ emplace(&bigData[len], *itemUnqual);
//We do this at the end, in case of exceptions
_data.arr = bigData;
}
diff --git a/libphobos/src/std/bitmanip.d b/libphobos/src/std/bitmanip.d
index 2dd6211..9af9d72 100644
--- a/libphobos/src/std/bitmanip.d
+++ b/libphobos/src/std/bitmanip.d
@@ -2948,12 +2948,12 @@ if (isIntegral!T || isSomeChar!T || isBoolean!T)
private union EndianSwapper(T)
if (canSwapEndianness!T)
{
- Unqual!T value;
+ T value;
ubyte[T.sizeof] array;
- static if (is(FloatingPointTypeOf!(Unqual!T) == float))
+ static if (is(immutable FloatingPointTypeOf!(T) == immutable float))
uint intValue;
- else static if (is(FloatingPointTypeOf!(Unqual!T) == double))
+ else static if (is(immutable FloatingPointTypeOf!(T) == immutable double))
ulong intValue;
}
diff --git a/libphobos/src/std/concurrency.d b/libphobos/src/std/concurrency.d
index d101ce4..a9830af 100644
--- a/libphobos/src/std/concurrency.d
+++ b/libphobos/src/std/concurrency.d
@@ -484,7 +484,7 @@ private template isSpawnable(F, T...)
enum isParamsImplicitlyConvertible = false;
}
- enum isSpawnable = isCallable!F && is(ReturnType!F == void)
+ enum isSpawnable = isCallable!F && is(ReturnType!F : void)
&& isParamsImplicitlyConvertible!(F, void function(T))
&& (isFunctionPointer!F || !hasUnsharedAliasing!F);
}
@@ -1573,10 +1573,9 @@ private:
this.outer.yield();
}
- private bool notified;
+ bool notified;
}
-private:
void dispatch()
{
import std.algorithm.mutation : remove;
@@ -1600,7 +1599,6 @@ private:
}
}
-private:
Fiber[] m_fibers;
size_t m_pos;
}
@@ -1919,48 +1917,53 @@ void yield(T)(T value)
import core.exception;
import std.exception;
- static void testScheduler(Scheduler s)
- {
- scheduler = s;
- scheduler.start({
- auto tid = spawn({
- int i;
-
- try
+ auto mainTid = thisTid;
+ alias testdg = () {
+ auto tid = spawn(
+ (Tid mainTid) {
+ int i;
+ scope (failure) mainTid.send(false);
+ try
+ {
+ for (i = 1; i < 10; i++)
{
- for (i = 1; i < 10; i++)
+ if (receiveOnly!int() != i)
{
- assertNotThrown!AssertError(assert(receiveOnly!int() == i));
+ mainTid.send(false);
+ break;
}
}
- catch (OwnerTerminated e)
- {
-
- }
-
- // i will advance 1 past the last value expected
- assert(i == 4);
- });
-
- auto r = new Generator!int({
- assertThrown!Exception(yield(2.0));
- yield(); // ensure this is a no-op
- yield(1);
- yield(); // also once something has been yielded
- yield(2);
- yield(3);
- });
-
- foreach (e; r)
+ }
+ catch (OwnerTerminated e)
{
- tid.send(e);
+ // i will advance 1 past the last value expected
+ mainTid.send(i == 4);
}
+ }, mainTid);
+ auto r = new Generator!int(
+ {
+ assertThrown!Exception(yield(2.0));
+ yield(); // ensure this is a no-op
+ yield(1);
+ yield(); // also once something has been yielded
+ yield(2);
+ yield(3);
});
- scheduler = null;
- }
- testScheduler(new ThreadScheduler);
- testScheduler(new FiberScheduler);
+ foreach (e; r)
+ {
+ tid.send(e);
+ }
+ };
+
+ scheduler = new ThreadScheduler;
+ scheduler.spawn(testdg);
+ assert(receiveOnly!bool());
+
+ scheduler = new FiberScheduler;
+ scheduler.start(testdg);
+ assert(receiveOnly!bool());
+ scheduler = null;
}
///
@system unittest
diff --git a/libphobos/src/std/container/array.d b/libphobos/src/std/container/array.d
index 58de5b7..63dc864 100644
--- a/libphobos/src/std/container/array.d
+++ b/libphobos/src/std/container/array.d
@@ -24,6 +24,61 @@ import std.traits;
public import std.container.util;
+pure @system unittest
+{
+ // We test multiple array lengths in order to ensure that the "a1.capacity == a0.length" test is meaningful
+ // for the version in which the constructor uses insertBack
+ // (because for some lengths, the test passes even without reserve).
+ for (size_t n = 0; n < 100; ++n)
+ {
+ float[] a0;
+ {
+ import std.range : iota;
+ import std.array;
+ import std.algorithm.iteration : map;
+ a0 = iota (0, n).map!(i => i * 1.1f).array;
+ }
+
+ auto a1 = Array!float(a0);
+
+ // We check that a1 has the same length and contents as a0:
+ {
+ assert(a1.length == a0.length);
+
+ // I wish that I could write "assert(a1[] == a0[]);",
+ // but the compiler complains: "Error: incompatible types for `(a1.opSlice()) == (a0[])`: `RangeT!(Array!float)` and `float[]`".
+ import std.algorithm.comparison : equal;
+ assert(equal(a1[], a0[]));
+ }
+
+ // We check that a1's constructor has called reserve (to maintain good performance):
+ assert(a1.capacity == a0.length);
+ }
+}
+
+pure @system unittest
+{
+ // To avoid bad performance, we check that an Array constructed from an empty range
+ // does not initialize its RefCountedStore object, even after a call to "reserve(0)".
+
+ {
+ Array!float a1;
+ assert(! a1._data.refCountedStore.isInitialized);
+ a1.reserve(0);
+ assert(! a1._data.refCountedStore.isInitialized);
+ }
+
+ {
+ float[] a0 = [];
+ Array!float a1 = a0;
+ // [2021-09-26] TODO: Investigate RefCounted.
+ //assert(! a1._data.refCountedStore.isInitialized);
+ a1.reserve(0);
+ // [2021-09-26] TODO: Investigate RefCounted.
+ //assert(! a1._data.refCountedStore.isInitialized);
+ }
+}
+
///
pure @system unittest
{
@@ -246,6 +301,70 @@ private struct RangeT(A)
}
}
+@system unittest
+{
+ enum : bool { display = false }
+ static if (display)
+ {
+ import std.stdio;
+ enum { nDigitsForPointer = 2 * size_t.sizeof, nDigitsForNObjects = 4 }
+ }
+
+ static struct S
+ {
+ static size_t s_nConstructed;
+ static size_t s_nDestroyed;
+ static void throwIfTooMany()
+ {
+ if (s_nConstructed >= 7) throw new Exception ("Ka-boom !");
+ }
+
+ uint _i;
+
+ ~this()
+ {
+ static if (display) writefln("@%*Xh: Destroying.", nDigitsForPointer, &this);
+ ++s_nDestroyed;
+ }
+
+ this(uint i)
+ {
+ static if (display) writefln("@%*Xh: Constructing.", nDigitsForPointer, &this);
+ _i = i;
+ ++s_nConstructed;
+ throwIfTooMany();
+ }
+
+ this(this)
+ {
+ static if (display) writefln("@%*Xh: Copying.", nDigitsForPointer, &this);
+ ++s_nConstructed;
+ throwIfTooMany();
+ }
+ }
+
+ try
+ {
+ auto a = Array!S (S(0), S(1), S(2), S(3));
+ static if (display) writefln("@%*Xh: This is where the array elements are.", nDigitsForPointer, &a [0]);
+ }
+ catch (Exception e)
+ {
+ static if (display) writefln("Exception caught !");
+ }
+
+ static if (display)
+ {
+ writefln("s_nConstructed %*Xh.", nDigitsForNObjects, S.s_nConstructed);
+ writefln("s_nDestroyed %*Xh.", nDigitsForNObjects, S.s_nDestroyed);
+ writefln("s_nConstructed should be equal to s_nDestroyed.");
+ writefln("");
+ }
+
+ assert(S.s_nDestroyed == S.s_nConstructed);
+}
+
+
/**
* _Array type with deterministic control of memory. The memory allocated
* for the array is reclaimed as soon as possible; there is no reliance
@@ -441,32 +560,28 @@ if (!is(immutable T == immutable bool))
this(U)(U[] values...)
if (isImplicitlyConvertible!(U, T))
{
- import core.lifetime : emplace;
-
- static if (T.sizeof == 1)
+ // [2021-07-17] Checking to see whether *always* calling ensureInitialized works-around-and/or-is-related-to https://issues.dlang.org/show_bug.cgihttps://issues.dlang.org/show_bug.cgi...
+ //if (values.length)
{
- const nbytes = values.length;
- }
- else
- {
- import core.checkedint : mulu;
- bool overflow;
- const nbytes = mulu(values.length, T.sizeof, overflow);
- if (overflow)
- assert(false, "Overflow");
- }
- auto p = cast(T*) enforceMalloc(nbytes);
- // Before it is added to the gc, initialize the newly allocated memory
- foreach (i, e; values)
- {
- emplace(p + i, e);
- }
- static if (hasIndirections!T)
- {
- if (p)
- GC.addRange(p, T.sizeof * values.length);
+ _data.refCountedStore.ensureInitialized();
+ _data.reserve(values.length);
+ foreach (ref value; values)
+ {
+ // We do not simply write "_data.insertBack(value);"
+ // because that might perform, on each iteration, a now-redundant check of length vs capacity.
+ // Thanks to @dkorpel (https://github.com/dlang/phobos/pull/8162#discussion_r667479090).
+
+ import core.lifetime : emplace;
+ emplace(_data._payload.ptr + _data._payload.length, value);
+
+ // We increment the length after each iteration (as opposed to adjusting it just once, after the loop)
+ // in order to improve error-safety (in case one of the calls to emplace throws).
+ _data._payload = _data._payload.ptr[0 .. _data._payload.length + 1];
+ }
}
- _data = Data(p[0 .. values.length]);
+
+ assert(length == values.length); // We check that all values have been inserted.
+ assert(capacity == values.length); // We check that reserve has been called before the loop.
}
/**
@@ -563,9 +678,9 @@ if (!is(immutable T == immutable bool))
* Complexity: $(BIGOH 1).
*/
- T[] data() @system
+ inout(T)[] data() inout @system
{
- return _data._payload;
+ return _data.refCountedStore.isInitialized ? _data._payload : [];
}
/**
@@ -581,34 +696,11 @@ if (!is(immutable T == immutable bool))
*/
void reserve(size_t elements)
{
- if (!_data.refCountedStore.isInitialized)
- {
- if (!elements) return;
- static if (T.sizeof == 1)
- {
- const sz = elements;
- }
- else
- {
- import core.checkedint : mulu;
- bool overflow;
- const sz = mulu(elements, T.sizeof, overflow);
- if (overflow)
- assert(false, "Overflow");
- }
- auto p = enforceMalloc(sz);
- static if (hasIndirections!T)
- {
- // Zero out unused capacity to prevent gc from seeing false pointers
- memset(p, 0, sz);
- GC.addRange(p, sz);
- }
- _data = Data(cast(T[]) p[0 .. 0]);
- _data._capacity = elements;
- }
- else
+ if (elements > capacity)
{
+ _data.refCountedStore.ensureInitialized();
_data.reserve(elements);
+ assert(capacity == elements); // Might need changing to ">=" if implementation of Payload.reserve is changed.
}
}
@@ -2628,9 +2720,19 @@ if (is(immutable T == immutable bool))
@system unittest
{
+
Array!int arr = [1, 2, 4, 5];
int[] data = arr.data();
+ const Array!int arr2 = [8, 9];
+ assert(arr2.data() == [8, 9]);
+
data[0] = 0;
assert(arr[0] == 0);
+
+ arr.length = 0;
+ assert(arr.data == []);
+
+ Array!int empty;
+ assert(empty.data == []);
}
diff --git a/libphobos/src/std/datetime/systime.d b/libphobos/src/std/datetime/systime.d
index 18b8524..4da1281 100644
--- a/libphobos/src/std/datetime/systime.d
+++ b/libphobos/src/std/datetime/systime.d
@@ -8308,12 +8308,17 @@ public:
YYYY-MM-DDTHH:MM:SS.FFFFFFFTZ (where F is fractional seconds and TZ
is the time zone).
+ Default behaviour:
Note that the number of digits in the fractional seconds varies with the
number of fractional seconds. It's a maximum of 7 (which would be
hnsecs), but only has as many as are necessary to hold the correct value
(so no trailing zeroes), and if there are no fractional seconds, then
there is no decimal point.
+ The optional parameter "prec" allows to change the default behavior by
+ specifying the precision of the fractional seconds. The accepted values
+ are in the range [-1, 7], where -1 represents the default behavior.
+
If this $(LREF SysTime)'s time zone is
$(REF LocalTime,std,datetime,timezone), then TZ is empty. If its time
zone is `UTC`, then it is "Z". Otherwise, it is the offset from UTC
@@ -8325,25 +8330,30 @@ public:
Params:
writer = A `char` accepting
$(REF_ALTTEXT output range, isOutputRange, std, range, primitives)
+ prec = An `int` representing the desired precision. Acceptable values range from -1 to 7, where -1 represents the default behavior.
Returns:
A `string` when not using an output range; `void` otherwise.
+/
- string toISOExtString() @safe const nothrow scope
+ string toISOExtString(int prec = -1) @safe const nothrow scope
{
+ assert(prec >= -1 && prec <= 7, "Precision must be in the range [-1, 7]");
+
import std.array : appender;
auto app = appender!string();
app.reserve(35);
try
- toISOExtString(app);
+ toISOExtString(app, prec);
catch (Exception e)
assert(0, "toISOExtString() threw.");
return app.data;
}
/// ditto
- void toISOExtString(W)(ref W writer) const scope
+ void toISOExtString(W)(ref W writer, int prec = -1) const scope
if (isOutputRange!(W, char))
{
+ assert(prec >= -1 && prec <= 7, "Precision must be in the range [-1, 7]");
+
immutable adjustedTime = adjTime;
long hnsecs = adjustedTime;
@@ -8365,14 +8375,14 @@ public:
if (_timezone is LocalTime())
{
dateTime.toISOExtString(writer);
- fracSecsToISOString(writer, cast(int) hnsecs);
+ fracSecsToISOString(writer, cast(int) hnsecs, prec);
return;
}
if (_timezone is UTC())
{
dateTime.toISOExtString(writer);
- fracSecsToISOString(writer, cast(int) hnsecs);
+ fracSecsToISOString(writer, cast(int) hnsecs, prec);
put(writer, 'Z');
return;
}
@@ -8380,7 +8390,7 @@ public:
immutable utcOffset = dur!"hnsecs"(adjustedTime - stdTime);
dateTime.toISOExtString(writer);
- fracSecsToISOString(writer, cast(int) hnsecs);
+ fracSecsToISOString(writer, cast(int) hnsecs, prec);
SimpleTimeZone.toISOExtString(writer, utcOffset);
}
@@ -8401,6 +8411,15 @@ public:
assert(SysTime(DateTime(-4, 1, 5, 0, 0, 2), hnsecs(520_920)).toISOExtString() ==
"-0004-01-05T00:00:02.052092");
+
+ assert(SysTime(DateTime(-4, 1, 5, 0, 0, 2), hnsecs(520_920)).toISOExtString(4) ==
+ "-0004-01-05T00:00:02.0520");
+
+ assert(SysTime(DateTime(-4, 1, 5, 0, 0, 2), hnsecs(520_920)).toISOExtString(2) ==
+ "-0004-01-05T00:00:02.05");
+
+ assert(SysTime(DateTime(-4, 1, 5, 0, 0, 2), hnsecs(520_920)).toISOExtString(7) ==
+ "-0004-01-05T00:00:02.0520920");
}
@safe unittest
@@ -11025,32 +11044,41 @@ private:
/+
Returns the given hnsecs as an ISO string of fractional seconds.
+/
-string fracSecsToISOString(int hnsecs) @safe pure nothrow
+string fracSecsToISOString(int hnsecs, int prec = -1) @safe pure nothrow
{
import std.array : appender;
auto w = appender!string();
try
- fracSecsToISOString(w, hnsecs);
+ fracSecsToISOString(w, hnsecs, prec);
catch (Exception e)
assert(0, "fracSecsToISOString() threw.");
return w.data;
}
-void fracSecsToISOString(W)(ref W writer, int hnsecs)
+void fracSecsToISOString(W)(ref W writer, int hnsecs, int prec = -1)
{
import std.conv : toChars;
import std.range : padLeft;
assert(hnsecs >= 0);
+ if (prec == 0)
+ return;
+
if (hnsecs == 0)
return;
put(writer, '.');
auto chars = hnsecs.toChars.padLeft('0', 7);
- while (chars.back == '0')
- chars.popBack();
- put(writer, chars);
+
+ if (prec == -1)
+ {
+ while (chars.back == '0')
+ chars.popBack();
+ put(writer, chars);
+ }
+ else
+ put(writer, chars[0 .. prec]);
}
@safe unittest
diff --git a/libphobos/src/std/datetime/timezone.d b/libphobos/src/std/datetime/timezone.d
index 5df42e7..0527580 100644
--- a/libphobos/src/std/datetime/timezone.d
+++ b/libphobos/src/std/datetime/timezone.d
@@ -332,6 +332,7 @@ public:
version (Posix)
{
version (FreeBSD) enum utcZone = "Etc/UTC";
+ else version (OpenBSD) enum utcZone = "UTC";
else version (NetBSD) enum utcZone = "UTC";
else version (DragonFlyBSD) enum utcZone = "UTC";
else version (linux) enum utcZone = "UTC";
diff --git a/libphobos/src/std/digest/ripemd.d b/libphobos/src/std/digest/ripemd.d
index 4a5deca..0fdc251 100644
--- a/libphobos/src/std/digest/ripemd.d
+++ b/libphobos/src/std/digest/ripemd.d
@@ -210,7 +210,7 @@ struct RIPEMD160
* RIPEMD160 basic transformation. Transforms state based on block.
*/
- private void transform(const(ubyte[64])* block)
+ void transform(const(ubyte[64])* block)
pure nothrow @nogc
{
uint aa = _state[0],
diff --git a/libphobos/src/std/exception.d b/libphobos/src/std/exception.d
index 5fcee2a..4f7f3c3 100644
--- a/libphobos/src/std/exception.d
+++ b/libphobos/src/std/exception.d
@@ -191,7 +191,7 @@ auto assertNotThrown(T : Throwable = Exception, E)
{
import core.exception : AssertError;
- void throwEx(Throwable t) { throw t; }
+ static noreturn throwEx(Throwable t) { throw t; }
bool nothrowEx() { return true; }
try
@@ -294,7 +294,9 @@ void assertThrown(T : Throwable = Exception, E)
expression();
catch (T)
return;
- throw new AssertError("assertThrown failed: No " ~ T.stringof ~ " was thrown"
+
+ static if (!is(immutable E == immutable noreturn))
+ throw new AssertError("assertThrown failed: No " ~ T.stringof ~ " was thrown"
~ (msg.length == 0 ? "." : ": ") ~ msg,
file, line);
}
@@ -318,7 +320,7 @@ void assertThrown(T : Throwable = Exception, E)
{
import core.exception : AssertError;
- void throwEx(Throwable t) { throw t; }
+ static noreturn throwEx(Throwable t) { throw t; }
void nothrowEx() { }
try
@@ -666,7 +668,9 @@ T collectException(T = Exception, E)(lazy E expression, ref E result)
{
return e;
}
- return null;
+ // Avoid "statement not reachable" warning
+ static if (!is(immutable E == immutable noreturn))
+ return null;
}
///
@system unittest
@@ -675,9 +679,14 @@ T collectException(T = Exception, E)(lazy E expression, ref E result)
int foo() { throw new Exception("blah"); }
assert(collectException(foo(), b));
- int[] a = new int[3];
- import core.exception : RangeError;
- assert(collectException!RangeError(a[4], b));
+ version (D_NoBoundsChecks) {}
+ else
+ {
+ // check for out of bounds error
+ int[] a = new int[3];
+ import core.exception : RangeError;
+ assert(collectException!RangeError(a[4], b));
+ }
}
/++
@@ -706,7 +715,9 @@ T collectException(T : Throwable = Exception, E)(lazy E expression)
{
return t;
}
- return null;
+ // Avoid "statement not reachable" warning
+ static if (!is(immutable E == immutable noreturn))
+ return null;
}
///
@@ -742,7 +753,9 @@ string collectExceptionMsg(T = Exception, E)(lazy E expression)
{
expression();
- return cast(string) null;
+ // Avoid "statement not reachable" warning
+ static if (!is(immutable E == immutable noreturn))
+ return cast(string) null;
}
catch (T e)
return e.msg.empty ? emptyExceptionMsg : e.msg;
@@ -766,6 +779,25 @@ string collectExceptionMsg(T = Exception, E)(lazy E expression)
+/
enum emptyExceptionMsg = "<Empty Exception Message>";
+// https://issues.dlang.org/show_bug.cgi?id=22364
+@system unittest
+{
+ static noreturn foo() { throw new Exception(""); }
+
+ const ex = collectException!(Exception, noreturn)(foo());
+ assert(ex);
+
+ const msg = collectExceptionMsg!(Exception, noreturn)(foo());
+ assert(msg);
+
+ noreturn n;
+
+ // Triggers a backend assertion failure
+ // collectException!(Exception, noreturn)(foo(), n);
+
+ static assert(__traits(compiles, collectException!(Exception, noreturn)(foo(), n)));
+}
+
/**
* Casts a mutable array to an immutable array in an idiomatic
* manner. Technically, `assumeUnique` just inserts a cast,
diff --git a/libphobos/src/std/experimental/checkedint.d b/libphobos/src/std/experimental/checkedint.d
index b33c2ed..354851b 100644
--- a/libphobos/src/std/experimental/checkedint.d
+++ b/libphobos/src/std/experimental/checkedint.d
@@ -1614,9 +1614,9 @@ static:
been evaluated
bound = The bound being violated
- Returns: `cast(Lhs) rhs`
+ Returns: `cast(T) rhs`
*/
- Lhs onLowerBound(Rhs, T)(Rhs rhs, T bound)
+ T onLowerBound(Rhs, T)(Rhs rhs, T bound)
{
trustedStderr.writefln("Lower bound error: %s(%s) < %s(%s)",
Rhs.stringof, rhs, T.stringof, bound);
@@ -1793,6 +1793,12 @@ static:
assert(witness == expected, "'" ~ witness ~ "'");
}
+// https://issues.dlang.org/show_bug.cgi?id=22249
+@safe unittest
+{
+ alias _ = Warn.onLowerBound!(int, int);
+}
+
// ProperCompare
/**
diff --git a/libphobos/src/std/file.d b/libphobos/src/std/file.d
index 741656d..1bfed64 100644
--- a/libphobos/src/std/file.d
+++ b/libphobos/src/std/file.d
@@ -400,25 +400,23 @@ version (Posix) private void[] readImpl(scope const(char)[] name, scope const(FS
: result[0 .. size.get];
}
+version (Windows)
+private extern (Windows) @nogc nothrow
+{
+ pragma(mangle, CreateFileW.mangleof)
+ HANDLE trustedCreateFileW(scope const(wchar)* namez, DWORD dwDesiredAccess,
+ DWORD dwShareMode, SECURITY_ATTRIBUTES* lpSecurityAttributes,
+ DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
+ HANDLE hTemplateFile) @trusted;
+
+ pragma(mangle, CloseHandle.mangleof) BOOL trustedCloseHandle(HANDLE) @trusted;
+}
version (Windows) private void[] readImpl(scope const(char)[] name, scope const(FSChar)* namez,
size_t upTo = size_t.max) @trusted
{
import core.memory : GC;
import std.algorithm.comparison : min;
- static trustedCreateFileW(scope const(wchar)* namez, DWORD dwDesiredAccess, DWORD dwShareMode,
- SECURITY_ATTRIBUTES *lpSecurityAttributes, DWORD dwCreationDisposition,
- DWORD dwFlagsAndAttributes, HANDLE hTemplateFile)
- {
- return CreateFileW(namez, dwDesiredAccess, dwShareMode,
- lpSecurityAttributes, dwCreationDisposition,
- dwFlagsAndAttributes, hTemplateFile);
-
- }
- static trustedCloseHandle(HANDLE hObject)
- {
- return CloseHandle(hObject);
- }
static trustedGetFileSize(HANDLE hFile, out ulong fileSize)
{
DWORD sizeHigh;
@@ -1125,6 +1123,9 @@ version (Windows) private ulong makeUlong(DWORD dwLow, DWORD dwHigh) @safe pure
return li.QuadPart;
}
+version (Posix) private extern (C) pragma(mangle, stat.mangleof)
+int trustedStat(const(FSChar)* namez, ref stat_t buf) @nogc nothrow @trusted;
+
/**
Get size of file `name` in bytes.
@@ -1148,10 +1149,6 @@ if (isInputRange!R && !isInfinite!R && isSomeChar!(ElementEncodingType!R) &&
{
auto namez = name.tempCString();
- static trustedStat(const(FSChar)* namez, out stat_t buf) @trusted
- {
- return stat(namez, &buf);
- }
static if (isNarrowString!R && is(immutable ElementEncodingType!R == immutable char))
alias names = name;
else
@@ -1253,10 +1250,6 @@ if (isInputRange!R && !isInfinite!R && isSomeChar!(ElementEncodingType!R) &&
{
auto namez = name.tempCString();
- static auto trustedStat(const(FSChar)* namez, ref stat_t buf) @trusted
- {
- return stat(namez, &buf);
- }
stat_t statbuf = void;
static if (isNarrowString!R && is(immutable ElementEncodingType!R == immutable char))
@@ -1679,10 +1672,6 @@ if (isInputRange!R && !isInfinite!R && isSomeChar!(ElementEncodingType!R) &&
else version (Posix)
{
auto namez = name.tempCString!FSChar();
- static auto trustedStat(const(FSChar)* namez, ref stat_t buf) @trusted
- {
- return stat(namez, &buf);
- }
stat_t statbuf = void;
static if (isNarrowString!R && is(immutable ElementEncodingType!R == immutable char))
@@ -1770,10 +1759,6 @@ if (isInputRange!R && !isInfinite!R && isSomeChar!(ElementEncodingType!R))
else version (Posix)
{
auto namez = name.tempCString!FSChar();
- static auto trustedStat(const(FSChar)* namez, ref stat_t buf) @trusted
- {
- return stat(namez, &buf);
- }
stat_t statbuf = void;
return trustedStat(namez, statbuf) != 0 ?
@@ -2042,10 +2027,6 @@ if (isInputRange!R && !isInfinite!R && isSomeChar!(ElementEncodingType!R) &&
else version (Posix)
{
auto namez = name.tempCString!FSChar();
- static auto trustedStat(const(FSChar)* namez, ref stat_t buf) @trusted
- {
- return stat(namez, &buf);
- }
stat_t statbuf = void;
static if (isNarrowString!R && is(immutable ElementEncodingType!R == immutable char))
@@ -5275,9 +5256,20 @@ slurp(Types...)(string filename, scope const(char)[] format)
assert(slurp!(int)(deleteme, "%d") == [10, 20]);
}
-
/**
Returns the path to a directory for temporary files.
+On POSIX platforms, it searches through the following list of directories
+and returns the first one which is found to exist:
+$(OL
+ $(LI The directory given by the `TMPDIR` environment variable.)
+ $(LI The directory given by the `TEMP` environment variable.)
+ $(LI The directory given by the `TMP` environment variable.)
+ $(LI `/tmp/`)
+ $(LI `/var/tmp/`)
+ $(LI `/usr/tmp/`)
+)
+
+On all platforms, `tempDir` returns the current working directory on failure.
The return value of the function is cached, so the procedures described
below will only be performed the first time the function is called. All
@@ -5308,6 +5300,7 @@ Returns:
*/
string tempDir() @trusted
{
+ import std.path : dirSeparator;
static string cache;
if (cache is null)
{
@@ -5327,7 +5320,7 @@ string tempDir() @trusted
static string findExistingDir(T...)(lazy T alternatives)
{
foreach (dir; alternatives)
- if (!dir.empty && exists(dir)) return dir;
+ if (!dir.empty && exists(dir)) return dir ~ dirSeparator;
return null;
}
@@ -5340,7 +5333,10 @@ string tempDir() @trusted
}
else static assert(false, "Unsupported platform");
- if (cache is null) cache = getcwd();
+ if (cache is null)
+ {
+ cache = getcwd() ~ dirSeparator;
+ }
}
return cache;
}
@@ -5363,6 +5359,13 @@ string tempDir() @trusted
assert(myFile.readText == "hello");
}
+@safe unittest
+{
+ import std.algorithm.searching : endsWith;
+ import std.path : dirSeparator;
+ assert(tempDir.endsWith(dirSeparator));
+}
+
/**
Returns the available disk space based on a given path.
On Windows, `path` must be a directory; on POSIX systems, it can be a file or directory.
diff --git a/libphobos/src/std/format/internal/floats.d b/libphobos/src/std/format/internal/floats.d
index 81b21dc..632bf76 100644
--- a/libphobos/src/std/format/internal/floats.d
+++ b/libphobos/src/std/format/internal/floats.d
@@ -17,7 +17,7 @@ module std.format.internal.floats;
import std.format.spec : FormatSpec;
// wrapper for unittests
-private auto printFloat(T, Char)(T val, FormatSpec!Char f)
+private auto printFloat(T, Char)(const(T) val, FormatSpec!Char f)
if (is(T == float) || is(T == double)
|| (is(T == real) && (T.mant_dig == double.mant_dig || T.mant_dig == 64)))
{
@@ -28,7 +28,7 @@ if (is(T == float) || is(T == double)
return w.data;
}
-package(std.format) void printFloat(Writer, T, Char)(auto ref Writer w, T val, FormatSpec!Char f)
+package(std.format) void printFloat(Writer, T, Char)(auto ref Writer w, const(T) val, FormatSpec!Char f)
if (is(T == float) || is(T == double)
|| (is(T == real) && (T.mant_dig == double.mant_dig || T.mant_dig == 64)))
{
@@ -76,7 +76,7 @@ if (is(T == float) || is(T == double)
}
}
-private void printFloatA(Writer, T, Char)(auto ref Writer w, T val,
+private void printFloatA(Writer, T, Char)(auto ref Writer w, const(T) val,
FormatSpec!Char f, string sgn, int exp, ulong mnt, bool is_upper)
if (is(T == float) || is(T == double)
|| (is(T == real) && (T.mant_dig == double.mant_dig || T.mant_dig == 64)))
@@ -586,7 +586,7 @@ if (is(T == float) || is(T == double)
assert(printFloat(0x1.19f01p0, f) == "0X1.19FP+0");
}
-private void printFloatE(bool g, Writer, T, Char)(auto ref Writer w, T val,
+private void printFloatE(bool g, Writer, T, Char)(auto ref Writer w, const(T) val,
FormatSpec!Char f, string sgn, int exp, ulong mnt, bool is_upper)
if (is(T == float) || is(T == double)
|| (is(T == real) && (T.mant_dig == double.mant_dig || T.mant_dig == 64)))
@@ -1505,7 +1505,7 @@ if (is(T == float) || is(T == double)
});
}
-private void printFloatF(bool g, Writer, T, Char)(auto ref Writer w, T val,
+private void printFloatF(bool g, Writer, T, Char)(auto ref Writer w, const(T) val,
FormatSpec!Char f, string sgn, int exp, ulong mnt, bool is_upper)
if (is(T == float) || is(T == double)
|| (is(T == real) && (T.mant_dig == double.mant_dig || T.mant_dig == 64)))
@@ -2268,7 +2268,7 @@ if (is(T == float) || is(T == double)
~"7175706828388979108268586060148663818836212158203125");
}
-private void printFloatG(Writer, T, Char)(auto ref Writer w, T val,
+private void printFloatG(Writer, T, Char)(auto ref Writer w, const(T) val,
FormatSpec!Char f, string sgn, int exp, ulong mnt, bool is_upper)
if (is(T == float) || is(T == double)
|| (is(T == real) && (T.mant_dig == double.mant_dig || T.mant_dig == 64)))
diff --git a/libphobos/src/std/format/internal/write.d b/libphobos/src/std/format/internal/write.d
index 5883d8d..68b9e4d 100644
--- a/libphobos/src/std/format/internal/write.d
+++ b/libphobos/src/std/format/internal/write.d
@@ -28,7 +28,7 @@ package(std.format):
`bool`s are formatted as `"true"` or `"false"` with `%s` and as `1` or
`0` with integral-specific format specs.
*/
-void formatValueImpl(Writer, T, Char)(auto ref Writer w, T obj, scope const ref FormatSpec!Char f)
+void formatValueImpl(Writer, T, Char)(auto ref Writer w, const(T) obj, scope const ref FormatSpec!Char f)
if (is(BooleanTypeOf!T) && !is(T == enum) && !hasToString!(T, Char))
{
BooleanTypeOf!T val = obj;
@@ -123,7 +123,7 @@ if (is(BooleanTypeOf!T) && !is(T == enum) && !hasToString!(T, Char))
/*
`null` literal is formatted as `"null"`
*/
-void formatValueImpl(Writer, T, Char)(auto ref Writer w, T obj, scope const ref FormatSpec!Char f)
+void formatValueImpl(Writer, T, Char)(auto ref Writer w, const(T) obj, scope const ref FormatSpec!Char f)
if (is(immutable T == immutable typeof(null)) && !is(T == enum) && !hasToString!(T, Char))
{
import std.format : enforceFmt;
@@ -157,11 +157,9 @@ if (is(immutable T == immutable typeof(null)) && !is(T == enum) && !hasToString!
/*
Integrals are formatted like $(REF printf, core, stdc, stdio).
*/
-void formatValueImpl(Writer, T, Char)(auto ref Writer w, T obj, scope const ref FormatSpec!Char f)
+void formatValueImpl(Writer, T, Char)(auto ref Writer w, const(T) obj, scope const ref FormatSpec!Char f)
if (is(IntegralTypeOf!T) && !is(T == enum) && !hasToString!(T, Char))
{
- import std.range.primitives : put;
-
alias U = IntegralTypeOf!T;
U val = obj; // Extracting alias this may be impure/system/may-throw
@@ -171,56 +169,46 @@ if (is(IntegralTypeOf!T) && !is(T == enum) && !hasToString!(T, Char))
auto raw = (ref val) @trusted {
return (cast(const char*) &val)[0 .. val.sizeof];
}(val);
-
+ import std.range.primitives : put;
if (needToSwapEndianess(f))
- {
foreach_reverse (c; raw)
put(w, c);
- }
else
- {
foreach (c; raw)
put(w, c);
- }
return;
}
- immutable uint base =
- f.spec == 'x' || f.spec == 'X' || f.spec == 'a' || f.spec == 'A' ? 16 :
- f.spec == 'o' ? 8 :
- f.spec == 'b' ? 2 :
- f.spec == 's' || f.spec == 'd' || f.spec == 'u'
- || f.spec == 'e' || f.spec == 'E' || f.spec == 'f' || f.spec == 'F'
- || f.spec == 'g' || f.spec == 'G' ? 10 :
- 0;
-
- import std.format : enforceFmt;
- enforceFmt(base > 0,
- "incompatible format character for integral argument: %" ~ f.spec);
-
- import std.math.algebraic : abs;
-
- bool negative = false;
- ulong arg = val;
static if (isSigned!U)
{
- if (f.spec != 'x' && f.spec != 'X' && f.spec != 'b' && f.spec != 'o' && f.spec != 'u')
- {
- if (val < 0)
- {
- negative = true;
- arg = cast(ulong) abs(val);
- }
- }
+ const negative = val < 0 && f.spec != 'x' && f.spec != 'X' && f.spec != 'b' && f.spec != 'o' && f.spec != 'u';
+ ulong arg = negative ? -cast(ulong) val : val;
+ }
+ else
+ {
+ const negative = false;
+ ulong arg = val;
}
-
arg &= Unsigned!U.max;
+ formatValueImplUlong!(Writer, Char)(w, arg, negative, f);
+}
+
+// Helper function for `formatValueImpl` that avoids template bloat
+private void formatValueImplUlong(Writer, Char)(auto ref Writer w, ulong arg, in bool negative,
+ scope const ref FormatSpec!Char f)
+{
+ immutable uint base = baseOfSpec(f.spec);
+
+ const bool zero = arg == 0;
char[64] digits = void;
size_t pos = digits.length - 1;
do
{
- digits[pos--] = '0' + arg % base;
+ /* `cast(char)` is needed because value range propagation (VRP) cannot
+ * analyze `base` because it’s computed in a separate function
+ * (`baseOfSpec`). */
+ digits[pos--] = cast(char) ('0' + arg % base);
if (base > 10 && digits[pos + 1] > '9')
digits[pos + 1] += ((f.spec == 'x' || f.spec == 'a') ? 'a' : 'A') - '0' - 10;
arg /= base;
@@ -245,12 +233,12 @@ if (is(IntegralTypeOf!T) && !is(T == enum) && !hasToString!(T, Char))
if (f.spec == 'x' || f.spec == 'X' || f.spec == 'b' || f.spec == 'o' || f.spec == 'u'
|| f.spec == 'd' || f.spec == 's')
{
- if (f.flHash && (base == 16) && obj != 0)
+ if (f.flHash && (base == 16) && !zero)
{
prefix[--left] = f.spec;
prefix[--left] = '0';
}
- if (f.flHash && (base == 8) && obj != 0
+ if (f.flHash && (base == 8) && !zero
&& (digits.length - (pos + 1) >= f.precision || f.precision == f.UNSPECIFIED))
prefix[--left] = '0';
@@ -358,6 +346,48 @@ if (is(IntegralTypeOf!T) && !is(T == enum) && !hasToString!(T, Char))
(f.spec == 'g' || f.spec == 'G') ? PrecisionType.allDigits : PrecisionType.fractionalDigits);
}
+private uint baseOfSpec(in char spec) @safe pure
+{
+ typeof(return) base =
+ spec == 'x' || spec == 'X' || spec == 'a' || spec == 'A' ? 16 :
+ spec == 'o' ? 8 :
+ spec == 'b' ? 2 :
+ spec == 's' || spec == 'd' || spec == 'u'
+ || spec == 'e' || spec == 'E' || spec == 'f' || spec == 'F'
+ || spec == 'g' || spec == 'G' ? 10 :
+ 0;
+
+ import std.format : enforceFmt;
+ enforceFmt(base > 0,
+ "incompatible format character for integral argument: %" ~ spec);
+
+ return base;
+}
+
+@safe pure unittest
+{
+ assertCTFEable!(
+ {
+ formatTest(byte.min, "-128");
+ formatTest(byte.max, "127");
+ formatTest(short.min, "-32768");
+ formatTest(short.max, "32767");
+ formatTest(int.min, "-2147483648");
+ formatTest(int.max, "2147483647");
+ formatTest(long.min, "-9223372036854775808");
+ formatTest(long.max, "9223372036854775807");
+
+ formatTest(ubyte.min, "0");
+ formatTest(ubyte.max, "255");
+ formatTest(ushort.min, "0");
+ formatTest(ushort.max, "65535");
+ formatTest(uint.min, "0");
+ formatTest(uint.max, "4294967295");
+ formatTest(ulong.min, "0");
+ formatTest(ulong.max, "18446744073709551615");
+ });
+}
+
// https://issues.dlang.org/show_bug.cgi?id=18838
@safe pure unittest
{
@@ -577,7 +607,8 @@ if (is(IntegralTypeOf!T) && !is(T == enum) && !hasToString!(T, Char))
/*
Floating-point values are formatted like $(REF printf, core, stdc, stdio)
*/
-void formatValueImpl(Writer, T, Char)(auto ref Writer w, T obj, scope const ref FormatSpec!Char f)
+void formatValueImpl(Writer, T, Char)(auto ref Writer w, const(T) obj,
+ scope const ref FormatSpec!Char f)
if (is(FloatingPointTypeOf!T) && !is(T == enum) && !hasToString!(T, Char))
{
import std.algorithm.searching : find;
@@ -986,7 +1017,7 @@ if (is(FloatingPointTypeOf!T) && !is(T == enum) && !hasToString!(T, Char))
Formatting a `creal` is deprecated but still kept around for a while.
*/
deprecated("Use of complex types is deprecated. Use std.complex")
-void formatValueImpl(Writer, T, Char)(auto ref Writer w, T obj, scope const ref FormatSpec!Char f)
+void formatValueImpl(Writer, T, Char)(auto ref Writer w, const(T) obj, scope const ref FormatSpec!Char f)
if (is(immutable T : immutable creal) && !is(T == enum) && !hasToString!(T, Char))
{
import std.range.primitives : put;
@@ -1006,7 +1037,7 @@ if (is(immutable T : immutable creal) && !is(T == enum) && !hasToString!(T, Char
Formatting an `ireal` is deprecated but still kept around for a while.
*/
deprecated("Use of imaginary types is deprecated. Use std.complex")
-void formatValueImpl(Writer, T, Char)(auto ref Writer w, T obj, scope const ref FormatSpec!Char f)
+void formatValueImpl(Writer, T, Char)(auto ref Writer w, const(T) obj, scope const ref FormatSpec!Char f)
if (is(immutable T : immutable ireal) && !is(T == enum) && !hasToString!(T, Char))
{
import std.range.primitives : put;
@@ -1021,7 +1052,7 @@ if (is(immutable T : immutable ireal) && !is(T == enum) && !hasToString!(T, Char
Individual characters are formatted as Unicode characters with `%s`
and as integers with integral-specific format specs
*/
-void formatValueImpl(Writer, T, Char)(auto ref Writer w, T obj, scope const ref FormatSpec!Char f)
+void formatValueImpl(Writer, T, Char)(auto ref Writer w, const(T) obj, scope const ref FormatSpec!Char f)
if (is(CharTypeOf!T) && !is(T == enum) && !hasToString!(T, Char))
{
import std.meta : AliasSeq;
@@ -1111,11 +1142,11 @@ if (is(CharTypeOf!T) && !is(T == enum) && !hasToString!(T, Char))
/*
Strings are formatted like $(REF printf, core, stdc, stdio)
*/
-void formatValueImpl(Writer, T, Char)(auto ref Writer w, scope T obj,
+void formatValueImpl(Writer, T, Char)(auto ref Writer w, scope const(T) obj,
scope const ref FormatSpec!Char f)
if (is(StringTypeOf!T) && !is(StaticArrayTypeOf!T) && !is(T == enum) && !hasToString!(T, Char))
{
- Unqual!(StringTypeOf!T) val = obj; // for `alias this`, see bug5371
+ Unqual!(const(StringTypeOf!T)) val = obj; // for `alias this`, see bug5371
formatRange(w, val, f);
}
@@ -1306,7 +1337,7 @@ if (is(StringTypeOf!T) && !is(StaticArrayTypeOf!T) && !is(T == enum) && !hasToSt
/*
Static-size arrays are formatted as dynamic arrays.
*/
-void formatValueImpl(Writer, T, Char)(auto ref Writer w, auto ref T obj,
+void formatValueImpl(Writer, T, Char)(auto ref Writer w, auto ref const(T) obj,
scope const ref FormatSpec!Char f)
if (is(StaticArrayTypeOf!T) && !is(T == enum) && !hasToString!(T, Char))
{
@@ -1751,13 +1782,13 @@ void formatChar(Writer)(ref Writer w, in dchar c, in char quote)
Associative arrays are formatted by using `':'` and $(D ", ") as
separators, and enclosed by `'['` and `']'`.
*/
-void formatValueImpl(Writer, T, Char)(auto ref Writer w, T obj, scope const ref FormatSpec!Char f)
+void formatValueImpl(Writer, T, Char)(auto ref Writer w, const(T) obj, scope const ref FormatSpec!Char f)
if (is(AssocArrayTypeOf!T) && !is(T == enum) && !hasToString!(T, Char))
{
import std.format : enforceFmt, formatValue;
import std.range.primitives : put;
- AssocArrayTypeOf!T val = obj;
+ AssocArrayTypeOf!(const(T)) val = obj;
const spec = f.spec;
enforceFmt(spec == 's' || spec == '(',
@@ -2540,12 +2571,21 @@ if ((is(T == struct) || is(T == union)) && (hasToString!(T, Char) || !is(Builtin
else static if (0 < i && val.tupleof[i-1].offsetof == val.tupleof[i].offsetof)
{
static if (i == val.tupleof.length - 1 || val.tupleof[i].offsetof != val.tupleof[i+1].offsetof)
- put(w, separator~val.tupleof[i].stringof[4 .. $]~"}");
+ {
+ enum el = separator ~ val.tupleof[i].stringof[4 .. $] ~ "}";
+ put(w, el);
+ }
else
- put(w, separator~val.tupleof[i].stringof[4 .. $]);
+ {
+ enum el = separator ~ val.tupleof[i].stringof[4 .. $];
+ put(w, el);
+ }
}
else static if (i+1 < val.tupleof.length && val.tupleof[i].offsetof == val.tupleof[i+1].offsetof)
- put(w, (i > 0 ? separator : "")~"#{overlap "~val.tupleof[i].stringof[4 .. $]);
+ {
+ enum el = (i > 0 ? separator : "") ~ "#{overlap " ~ val.tupleof[i].stringof[4 .. $];
+ put(w, el);
+ }
else
{
static if (i > 0)
@@ -2846,7 +2886,7 @@ void enforceValidFormatSpec(T, Char)(scope const ref FormatSpec!Char f)
/*
`enum`s are formatted like their base value
*/
-void formatValueImpl(Writer, T, Char)(auto ref Writer w, T val, scope const ref FormatSpec!Char f)
+void formatValueImpl(Writer, T, Char)(auto ref Writer w, const(T) val, scope const ref FormatSpec!Char f)
if (is(T == enum))
{
import std.array : appender;
@@ -2866,7 +2906,9 @@ if (is(T == enum))
auto w2 = appender!string();
// val is not a member of T, output cast(T) rawValue instead.
- put(w2, "cast(" ~ T.stringof ~ ")");
+ put(w2, "cast(");
+ put(w2, T.stringof);
+ put(w2, ")");
static assert(!is(OriginalType!T == T), "OriginalType!" ~ T.stringof ~
"must not be equal to " ~ T.stringof);
@@ -2934,7 +2976,7 @@ if (is(T == enum))
/*
Pointers are formatted as hex integers.
*/
-void formatValueImpl(Writer, T, Char)(auto ref Writer w, scope T val, scope const ref FormatSpec!Char f)
+void formatValueImpl(Writer, T, Char)(auto ref Writer w, scope const(T) val, scope const ref FormatSpec!Char f)
if (isPointer!T && !is(T == enum) && !hasToString!(T, Char))
{
static if (is(typeof({ shared const void* p = val; })))
@@ -3048,7 +3090,7 @@ if (isPointer!T && !is(T == enum) && !hasToString!(T, Char))
/*
SIMD vectors are formatted as arrays.
*/
-void formatValueImpl(Writer, V, Char)(auto ref Writer w, V val, scope const ref FormatSpec!Char f)
+void formatValueImpl(Writer, V, Char)(auto ref Writer w, const(V) val, scope const ref FormatSpec!Char f)
if (isSIMDVector!V)
{
formatValueImpl(w, val.array, f);
@@ -3082,7 +3124,7 @@ if (isSIMDVector!V)
Known bug: Because of issue https://issues.dlang.org/show_bug.cgi?id=18269
the FunctionAttributes might be wrong.
*/
-void formatValueImpl(Writer, T, Char)(auto ref Writer w, scope T, scope const ref FormatSpec!Char f)
+void formatValueImpl(Writer, T, Char)(auto ref Writer w, scope const(T), scope const ref FormatSpec!Char f)
if (isDelegate!T)
{
formatValueImpl(w, T.stringof, f);
diff --git a/libphobos/src/std/functional.d b/libphobos/src/std/functional.d
index cec61fe..b251e40 100644
--- a/libphobos/src/std/functional.d
+++ b/libphobos/src/std/functional.d
@@ -1056,26 +1056,23 @@ Note: In the special case where only a single function is provided
(`F[0]`).
*/
template adjoin(F...)
-if (F.length == 1)
+if (F.length >= 1)
{
- alias adjoin = F[0];
-}
-/// ditto
-template adjoin(F...)
-if (F.length > 1)
-{
- auto adjoin(V...)(auto ref V a)
- {
- import std.typecons : tuple;
- import std.meta : staticMap;
-
- auto resultElement(size_t i)()
+ static if (F.length == 1)
+ alias adjoin = F[0];
+ else
+ auto adjoin(V...)(auto ref V a)
{
- return F[i](a);
- }
+ import std.typecons : tuple;
+ import std.meta : staticMap;
- return tuple(staticMap!(resultElement, Iota!(F.length)));
- }
+ auto resultElement(size_t i)()
+ {
+ return F[i](a);
+ }
+
+ return tuple(staticMap!(resultElement, Iota!(F.length)));
+ }
}
///
diff --git a/libphobos/src/std/getopt.d b/libphobos/src/std/getopt.d
index d516012..482aae6 100644
--- a/libphobos/src/std/getopt.d
+++ b/libphobos/src/std/getopt.d
@@ -771,7 +771,7 @@ private void getoptImpl(T...)(ref string[] args, ref configuration cfg,
args = args.remove(i);
break;
}
- if (!a.length || a[0] != optionChar)
+ if (a.length < 2 || a[0] != optionChar)
{
// not an option
if (cfg.stopOnFirstNonOption) break;
@@ -1890,6 +1890,17 @@ void defaultGetoptFormatter(Output)(Output output, string text, Option[] opt, st
assert(f == "-");
}
+// Hyphen at the option value;
+// https://issues.dlang.org/show_bug.cgi?id=22394
+@safe unittest
+{
+ auto args = ["program", "-"];
+
+ getopt(args);
+
+ assert(args == ["program", "-"]);
+}
+
@safe unittest
{
import std.conv;
diff --git a/libphobos/src/std/internal/math/biguintcore.d b/libphobos/src/std/internal/math/biguintcore.d
index 59d7842..7944675 100644
--- a/libphobos/src/std/internal/math/biguintcore.d
+++ b/libphobos/src/std/internal/math/biguintcore.d
@@ -1910,7 +1910,6 @@ pure @safe unittest
}
-private:
// Converts a big uint to a hexadecimal string.
//
// Optionally, a separator character (eg, an underscore) may be added between
@@ -2185,7 +2184,6 @@ do
}
-private:
// ------------------------
// These in-place functions are only for internal use; they are incompatible
// with COW.
@@ -2628,8 +2626,6 @@ again:
}
}
-private:
-
// TODO: Replace with a library call
void itoaZeroPadded(char[] output, uint value)
pure nothrow @safe @nogc
@@ -2669,8 +2665,6 @@ void toHexZeroPadded(char[] output, uint value,
}
}
-private:
-
// Returns the highest value of i for which left[i]!=right[i],
// or 0 if left[] == right[]
size_t highestDifferentDigit(const BigDigit [] left, const BigDigit [] right)
diff --git a/libphobos/src/std/internal/windows/advapi32.d b/libphobos/src/std/internal/windows/advapi32.d
index 2220eec..6f999ba 100644
--- a/libphobos/src/std/internal/windows/advapi32.d
+++ b/libphobos/src/std/internal/windows/advapi32.d
@@ -16,17 +16,21 @@ import core.sys.windows.winbase, core.sys.windows.winnt, core.sys.windows.winreg
pragma(lib, "advapi32.lib");
-immutable bool isWow64;
-
-shared static this()
+@property bool isWow64()
{
// WOW64 is the x86 emulator that allows 32-bit Windows-based applications to run seamlessly on 64-bit Windows
// IsWow64Process Function - Minimum supported client - Windows Vista, Windows XP with SP2
+ static int result = -1; // <0 if uninitialized, >0 if yes, ==0 if no
+ if (result >= 0)
+ return result > 0; // short path
+ // Will do this work once per thread to avoid importing std.concurrency
+ // or doing gnarly initonce work.
alias fptr_t = extern(Windows) BOOL function(HANDLE, PBOOL);
auto hKernel = GetModuleHandleA("kernel32");
auto IsWow64Process = cast(fptr_t) GetProcAddress(hKernel, "IsWow64Process");
BOOL bIsWow64;
- isWow64 = IsWow64Process && IsWow64Process(GetCurrentProcess(), &bIsWow64) && bIsWow64;
+ result = IsWow64Process && IsWow64Process(GetCurrentProcess(), &bIsWow64) && bIsWow64;
+ return result > 0;
}
HMODULE hAdvapi32 = null;
diff --git a/libphobos/src/std/json.d b/libphobos/src/std/json.d
index 39f89a6..af7aa38 100644
--- a/libphobos/src/std/json.d
+++ b/libphobos/src/std/json.d
@@ -735,13 +735,13 @@ struct JSONValue
* Tests wether a key can be found in an object.
*
* Returns:
- * when found, the `const(JSONValue)*` that matches to the key,
+ * when found, the `inout(JSONValue)*` that matches to the key,
* otherwise `null`.
*
* Throws: `JSONException` if the right hand side argument `JSONType`
* is not `object`.
*/
- auto opBinaryRight(string op : "in")(string k) const @safe
+ inout(JSONValue)* opBinaryRight(string op : "in")(string k) inout @safe
{
return k in this.objectNoRef;
}
@@ -750,6 +750,8 @@ struct JSONValue
{
JSONValue j = [ "language": "D", "author": "walter" ];
string a = ("author" in j).str;
+ *("author" in j) = "Walter";
+ assert(j["author"].str == "Walter");
}
bool opEquals(const JSONValue rhs) const @nogc nothrow pure @safe
diff --git a/libphobos/src/std/math/algebraic.d b/libphobos/src/std/math/algebraic.d
index ae7cbf9..db70b7a 100644
--- a/libphobos/src/std/math/algebraic.d
+++ b/libphobos/src/std/math/algebraic.d
@@ -595,6 +595,12 @@ if (isFloatingPoint!T1 && isFloatingPoint!T2)
return r;
}
+version (linux) version = GenericPosixVersion;
+else version (FreeBSD) version = GenericPosixVersion;
+else version (OpenBSD) version = GenericPosixVersion;
+else version (Solaris) version = GenericPosixVersion;
+else version (DragonFlyBSD) version = GenericPosixVersion;
+
private real polyImpl(real x, in real[] A) @trusted pure nothrow @nogc
{
version (D_InlineAsm_X86)
@@ -631,7 +637,7 @@ private real polyImpl(real x, in real[] A) @trusted pure nothrow @nogc
return_ST: ;
}
}
- else version (linux)
+ else version (GenericPosixVersion)
{
asm pure nothrow @nogc // assembler by W. Bright
{
@@ -685,87 +691,6 @@ private real polyImpl(real x, in real[] A) @trusted pure nothrow @nogc
return_ST: ;
}
}
- else version (FreeBSD)
- {
- asm pure nothrow @nogc // assembler by W. Bright
- {
- // EDX = (A.length - 1) * real.sizeof
- mov ECX,A[EBP] ; // ECX = A.length
- dec ECX ;
- lea EDX,[ECX*8] ;
- lea EDX,[EDX][ECX*4] ;
- add EDX,A+4[EBP] ;
- fld real ptr [EDX] ; // ST0 = coeff[ECX]
- jecxz return_ST ;
- fld x[EBP] ; // ST0 = x
- fxch ST(1) ; // ST1 = x, ST0 = r
- align 4 ;
- L2: fmul ST,ST(1) ; // r *= x
- fld real ptr -12[EDX] ;
- sub EDX,12 ; // deg--
- faddp ST(1),ST ;
- dec ECX ;
- jne L2 ;
- fxch ST(1) ; // ST1 = r, ST0 = x
- fstp ST(0) ; // dump x
- align 4 ;
- return_ST: ;
- }
- }
- else version (Solaris)
- {
- asm pure nothrow @nogc // assembler by W. Bright
- {
- // EDX = (A.length - 1) * real.sizeof
- mov ECX,A[EBP] ; // ECX = A.length
- dec ECX ;
- lea EDX,[ECX*8] ;
- lea EDX,[EDX][ECX*4] ;
- add EDX,A+4[EBP] ;
- fld real ptr [EDX] ; // ST0 = coeff[ECX]
- jecxz return_ST ;
- fld x[EBP] ; // ST0 = x
- fxch ST(1) ; // ST1 = x, ST0 = r
- align 4 ;
- L2: fmul ST,ST(1) ; // r *= x
- fld real ptr -12[EDX] ;
- sub EDX,12 ; // deg--
- faddp ST(1),ST ;
- dec ECX ;
- jne L2 ;
- fxch ST(1) ; // ST1 = r, ST0 = x
- fstp ST(0) ; // dump x
- align 4 ;
- return_ST: ;
- }
- }
- else version (DragonFlyBSD)
- {
- asm pure nothrow @nogc // assembler by W. Bright
- {
- // EDX = (A.length - 1) * real.sizeof
- mov ECX,A[EBP] ; // ECX = A.length
- dec ECX ;
- lea EDX,[ECX*8] ;
- lea EDX,[EDX][ECX*4] ;
- add EDX,A+4[EBP] ;
- fld real ptr [EDX] ; // ST0 = coeff[ECX]
- jecxz return_ST ;
- fld x[EBP] ; // ST0 = x
- fxch ST(1) ; // ST1 = x, ST0 = r
- align 4 ;
- L2: fmul ST,ST(1) ; // r *= x
- fld real ptr -12[EDX] ;
- sub EDX,12 ; // deg--
- faddp ST(1),ST ;
- dec ECX ;
- jne L2 ;
- fxch ST(1) ; // ST1 = r, ST0 = x
- fstp ST(0) ; // dump x
- align 4 ;
- return_ST: ;
- }
- }
else
{
static assert(0);
diff --git a/libphobos/src/std/math/operations.d b/libphobos/src/std/math/operations.d
index dfb1aee..cb3c805 100644
--- a/libphobos/src/std/math/operations.d
+++ b/libphobos/src/std/math/operations.d
@@ -1717,11 +1717,12 @@ if (isFloatingPoint!T)
bool negative;
}
-FloatingPointBitpattern!T extractBitpattern(T)(T val) @trusted
+FloatingPointBitpattern!T extractBitpattern(T)(const(T) value) @trusted
if (isFloatingPoint!T)
{
import std.math : floatTraits, RealFormat;
+ T val = value;
FloatingPointBitpattern!T ret;
alias F = floatTraits!T;
diff --git a/libphobos/src/std/meta.d b/libphobos/src/std/meta.d
index 1209987..0075ed7 100644
--- a/libphobos/src/std/meta.d
+++ b/libphobos/src/std/meta.d
@@ -511,30 +511,19 @@ if (args.length >= 2)
}
/**
- * Returns an `AliasSeq` created from TList with all occurrences
- * of T, if found, replaced with U.
+ * Returns an `AliasSeq` created from `args[2 .. $]` with all occurrences
+ * of `args[0]`, if any, replaced with `args[1]`.
*/
-template ReplaceAll(T, U, TList...)
-{
- alias ReplaceAll = GenericReplaceAll!(T, U, TList).result;
-}
-
-/// Ditto
-template ReplaceAll(alias T, U, TList...)
+template ReplaceAll(args...)
{
- alias ReplaceAll = GenericReplaceAll!(T, U, TList).result;
-}
-
-/// Ditto
-template ReplaceAll(T, alias U, TList...)
-{
- alias ReplaceAll = GenericReplaceAll!(T, U, TList).result;
-}
-
-/// Ditto
-template ReplaceAll(alias T, alias U, TList...)
-{
- alias ReplaceAll = GenericReplaceAll!(T, U, TList).result;
+ alias ReplaceAll = AliasSeq!();
+ static foreach (arg; args[2 .. $])
+ {
+ static if (isSame!(args[0], arg))
+ ReplaceAll = AliasSeq!(ReplaceAll, args[1]);
+ else
+ ReplaceAll = AliasSeq!(ReplaceAll, arg);
+ }
}
///
@@ -546,31 +535,6 @@ template ReplaceAll(alias T, alias U, TList...)
static assert(is(TL == AliasSeq!(int, char, char, int, float)));
}
-// [internal]
-private template GenericReplaceAll(args...)
-if (args.length >= 2)
-{
- alias from = OldAlias!(args[0]);
- alias to = OldAlias!(args[1]);
- alias tuple = args[2 .. $];
-
- static if (tuple.length)
- {
- alias head = OldAlias!(tuple[0]);
- alias tail = tuple[1 .. $];
- alias next = GenericReplaceAll!(from, to, tail).result;
-
- static if (isSame!(from, head))
- alias result = AliasSeq!(to, next);
- else
- alias result = AliasSeq!(head, next);
- }
- else
- {
- alias result = AliasSeq!();
- }
-}
-
@safe unittest
{
static assert(Pack!(ReplaceAll!(byte, ubyte,
@@ -658,29 +622,40 @@ template DerivedToFront(TList...)
static assert(is(TL2 == AliasSeq!(C, C, C, B, B, B, A, A, A)));
}
-private enum staticMapExpandFactor = 150;
-private string generateCases()
-{
- string[staticMapExpandFactor] chunks;
- chunks[0] = q{};
- static foreach (enum i; 0 .. staticMapExpandFactor - 1)
- chunks[i + 1] = chunks[i] ~ `F!(Args[` ~ i.stringof ~ `]),`;
- string ret = `AliasSeq!(`;
- foreach (chunk; chunks)
- ret ~= `q{alias staticMap = AliasSeq!(` ~ chunk ~ `);},`;
- return ret ~ `)`;
-}
-private alias staticMapBasicCases = AliasSeq!(mixin(generateCases()));
-
/**
-Evaluates to $(D AliasSeq!(F!(T[0]), F!(T[1]), ..., F!(T[$ - 1]))).
+Evaluates to `AliasSeq!(fun!(args[0]), fun!(args[1]), ..., fun!(args[$ - 1]))`.
*/
-template staticMap(alias F, Args ...)
+template staticMap(alias fun, args...)
{
- static if (Args.length < staticMapExpandFactor)
- mixin(staticMapBasicCases[Args.length]);
- else
- alias staticMap = AliasSeq!(staticMap!(F, Args[0 .. $/2]), staticMap!(F, Args[$/2 .. $]));
+ version (__staticMap_simplest_but_buggy)
+ {
+ // @@@ BUG @@@
+ // The following straightforward implementation exposes a bug.
+ // See issue https://issues.dlang.org/show_bug.cgi?id=22421 and unittest below.
+ alias staticMap = AliasSeq!();
+ static foreach (arg; args)
+ staticMap = AliasSeq!(staticMap, fun!arg);
+ }
+ else version (__staticMap_simple_but_slow)
+ {
+ // This has a performance bug. Appending to the staticMap seems to be quadratic.
+ alias staticMap = AliasSeq!();
+ static foreach (i; 0 .. args.length)
+ staticMap = AliasSeq!(staticMap, fun!(args[i]));
+ }
+ else // Current best-of-breed implementation imitates quicksort
+ {
+ static if (args.length <= 8)
+ {
+ alias staticMap = AliasSeq!();
+ static foreach (i; 0 .. args.length)
+ staticMap = AliasSeq!(staticMap, fun!(args[i]));
+ }
+ else
+ {
+ alias staticMap = AliasSeq!(staticMap!(fun, args[0 .. $ / 2]), staticMap!(fun, args[$ / 2 .. $]));
+ }
+ }
}
///
@@ -705,6 +680,14 @@ template staticMap(alias F, Args ...)
alias T = staticMap!(Unqual, int, const int, immutable int, uint, ubyte, byte, short, ushort, long);
static assert(is(T == AliasSeq!(int, int, int, uint, ubyte, byte, short, ushort, long)));
+
+ // @@@ BUG @@@ The test below exposes failure of the straightforward use.
+ // See @adamdruppe's comment to https://github.com/dlang/phobos/pull/8039
+ template id(alias what) {
+ enum id = __traits(identifier, what);
+ }
+ enum A { a }
+ static assert(staticMap!(id, A.a) == AliasSeq!("a"));
}
// regression test for https://issues.dlang.org/show_bug.cgi?id=21088
@@ -716,17 +699,25 @@ template staticMap(alias F, Args ...)
assert(A == typeid(int));
}
-/**
-Tests whether all given items satisfy a template predicate, i.e. evaluates to
-$(D F!(T[0]) && F!(T[1]) && ... && F!(T[$ - 1])).
+version (StdDdoc)
+{
+ /**
+ Tests whether all given items satisfy a template predicate, i.e. evaluates to
+ $(D F!(T[0]) && F!(T[1]) && ... && F!(T[$ - 1])).
-Evaluation is $(I not) short-circuited if a false result is encountered; the
-template predicate must be instantiable with all the given items.
- */
-template allSatisfy(alias F, T...)
+ Evaluation is $(I not) short-circuited if a false result is encountered; the
+ template predicate must be instantiable with all the given items.
+ */
+ template allSatisfy(alias F, T...)
+ {
+ import core.internal.traits : allSat = allSatisfy;
+ alias allSatisfy = allSat!(F, T);
+ }
+}
+else
{
import core.internal.traits : allSat = allSatisfy;
- alias allSatisfy = allSat!(F, T);
+ alias allSatisfy = allSat;
}
///
@@ -738,17 +729,25 @@ template allSatisfy(alias F, T...)
static assert( allSatisfy!(isIntegral, int, long));
}
-/**
-Tests whether any given items satisfy a template predicate, i.e. evaluates to
-$(D F!(T[0]) || F!(T[1]) || ... || F!(T[$ - 1])).
+version (StdDdoc)
+{
+ /**
+ Tests whether any given items satisfy a template predicate, i.e. evaluates to
+ $(D F!(T[0]) || F!(T[1]) || ... || F!(T[$ - 1])).
-Evaluation is short-circuited if a true result is encountered; the
-template predicate must be instantiable with one of the given items.
- */
-template anySatisfy(alias F, T...)
+ Evaluation is short-circuited if a true result is encountered; the
+ template predicate must be instantiable with one of the given items.
+ */
+ template anySatisfy(alias F, T...)
+ {
+ import core.internal.traits : anySat = anySatisfy;
+ alias anySatisfy = anySat!(F, T);
+ }
+}
+else
{
import core.internal.traits : anySat = anySatisfy;
- alias anySatisfy = anySat!(F, T);
+ alias anySatisfy = anySat;
}
///
@@ -760,170 +759,16 @@ template anySatisfy(alias F, T...)
static assert( anySatisfy!(isIntegral, int, double));
}
-private alias FilterShortCode = AliasSeq!(
- q{
- alias Filter = Nothing;
- },
- q{
- static if (pred!(TList[0]))
- alias Filter = AliasSeq!(TList[0]);
- else
- alias Filter = Nothing;
- },
- q{
- static if (pred!(TList[0]))
- {
- static if (pred!(TList[1]))
- alias Filter = AliasSeq!(TList[0], TList[1]);
- else
- alias Filter = AliasSeq!(TList[0]);
- }
- else
- {
- static if (pred!(TList[1]))
- alias Filter = AliasSeq!(TList[1]);
- else
- alias Filter = Nothing;
- }
- },
- q{
- static if (pred!(TList[0]))
- {
- static if (pred!(TList[1]))
- {
- static if (pred!(TList[2]))
- alias Filter = AliasSeq!(TList[0], TList[1], TList[2]);
- else
- alias Filter = AliasSeq!(TList[0], TList[1]);
- }
- else
- {
- static if (pred!(TList[2]))
- alias Filter = AliasSeq!(TList[0], TList[2]);
- else
- alias Filter = AliasSeq!(TList[0]);
- }
- }
- else
- {
- static if (pred!(TList[1]))
- {
- static if (pred!(TList[2]))
- alias Filter = AliasSeq!(TList[1], TList[2]);
- else
- alias Filter = AliasSeq!(TList[1]);
- }
- else
- {
- static if (pred!(TList[2]))
- alias Filter = AliasSeq!(TList[2]);
- else
- alias Filter = Nothing;
- }
- }
- },
- q{
- static if (pred!(TList[0]))
- {
- static if (pred!(TList[1]))
- {
- static if (pred!(TList[2]))
- {
- static if (pred!(TList[3]))
- alias Filter = AliasSeq!(TList[0], TList[1], TList[2], TList[3]);
- else
- alias Filter = AliasSeq!(TList[0], TList[1], TList[2]);
- }
- else
- {
- static if (pred!(TList[3]))
- alias Filter = AliasSeq!(TList[0], TList[1], TList[3]);
- else
- alias Filter = AliasSeq!(TList[0], TList[1]);
- }
- }
- else
- {
- static if (pred!(TList[2]))
- {
- static if (pred!(TList[3]))
- alias Filter = AliasSeq!(TList[0], TList[2], TList[3]);
- else
- alias Filter = AliasSeq!(TList[0], TList[2]);
- }
- else
- {
- static if (pred!(TList[3]))
- alias Filter = AliasSeq!(TList[0], TList[3]);
- else
- alias Filter = AliasSeq!(TList[0]);
- }
- }
- }
- else
- {
- static if (pred!(TList[1]))
- {
- static if (pred!(TList[2]))
- {
- static if (pred!(TList[3]))
- alias Filter = AliasSeq!(TList[1], TList[2], TList[3]);
- else
- alias Filter = AliasSeq!(TList[1], TList[2]);
- }
- else
- {
- static if (pred!(TList[3]))
- alias Filter = AliasSeq!(TList[1], TList[3]);
- else
- alias Filter = AliasSeq!(TList[1]);
- }
- }
- else
- {
- static if (pred!(TList[2]))
- {
- static if (pred!(TList[3]))
- alias Filter = AliasSeq!(TList[2], TList[3]);
- else
- alias Filter = AliasSeq!(TList[2]);
- }
- else
- {
- static if (pred!(TList[3]))
- alias Filter = AliasSeq!(TList[3]);
- else
- alias Filter = Nothing;
- }
- }
- }
- }
-);
-
-private enum filterExpandFactor = FilterShortCode.length;
-
-package alias Nothing = AliasSeq!(); // yes, this really does speed up compilation!
/**
* Filters an `AliasSeq` using a template predicate. Returns an
* `AliasSeq` of the elements which satisfy the predicate.
*/
-template Filter(alias pred, TList ...)
+template Filter(alias pred, args...)
{
- static if (TList.length < filterExpandFactor)
- {
- mixin(FilterShortCode[TList.length]);
- }
- else
- {
- template MaybeNothing(Q ...)
- {
- static if (pred!(Q[0]))
- alias MaybeNothing = AliasSeq!(Q[0]);
- else
- alias MaybeNothing = Nothing;
- }
- alias Filter = staticMap!(MaybeNothing, TList);
- }
+ alias Filter = AliasSeq!();
+ static foreach (arg; args)
+ static if (pred!arg)
+ Filter = AliasSeq!(Filter, arg);
}
///
@@ -993,6 +838,7 @@ template templateNot(alias pred)
static assert(allSatisfy!(isNoPointer, string, char, float));
}
+version (StdUnittest)
@safe unittest
{
static foreach (T; AliasSeq!(int, staticMap, 42))
@@ -1044,6 +890,7 @@ template templateAnd(Preds...)
static assert(alwaysTrue!int);
}
+version (StdUnittest)
@safe unittest
{
static foreach (T; AliasSeq!(int, staticMap, 42))
@@ -1102,6 +949,7 @@ template templateOr(Preds...)
static assert(!alwaysFalse!int);
}
+version (StdUnittest)
@safe unittest
{
static foreach (T; AliasSeq!(int, staticMap, 42))
@@ -1427,28 +1275,18 @@ template Repeat(size_t n, items...)
* cmp = A template that returns a `bool` (if its first argument is less than the second one)
* or an `int` (-1 means less than, 0 means equal, 1 means greater than)
*
- * Seq = The $(LREF AliasSeq) to sort
+ * items = The $(LREF AliasSeq) to sort
*
* Returns: The sorted alias sequence
*/
-template staticSort(alias cmp, Seq...)
+template staticSort(alias cmp, items...)
{
- static if (Seq.length < 2)
- {
- alias staticSort = Seq;
- }
+ static if (items.length < 2)
+ alias staticSort = items;
else
- {
- private alias btm = staticSort!(cmp, Seq[0 .. $ / 2]);
- private alias top = staticSort!(cmp, Seq[$ / 2 .. $]);
-
- static if (isLessEq!(cmp, btm[$ - 1], top[0]))
- alias staticSort = AliasSeq!(btm, top); // already ascending
- else static if (isLessEq!(cmp, top[$ - 1], btm[0]))
- alias staticSort = AliasSeq!(top, btm); // already descending
- else
- alias staticSort = staticMerge!(cmp, Seq.length / 2, btm, top);
- }
+ alias staticSort = staticMerge!(cmp, items.length / 2,
+ staticSort!(cmp, items[0 .. $ / 2]),
+ staticSort!(cmp, items[$ / 2 .. $]));
}
///
@@ -1468,25 +1306,21 @@ template staticSort(alias cmp, Seq...)
Types)));
}
-private template staticMerge(alias cmp, int half, Seq...)
+private template staticMerge(alias cmp, uint mid, items...)
{
- static if (half == 0 || half == Seq.length)
+ enum run =
{
- alias staticMerge = Seq;
- }
+ static if (mid < items.length)
+ static foreach (i, item; items[0 .. mid])
+ static if (!isLessEq!(cmp, item, items[mid]))
+ if (__ctfe) return i;
+ return mid;
+ }();
+ static if (run == mid)
+ alias staticMerge = items;
else
- {
- static if (isLessEq!(cmp, Seq[0], Seq[half]))
- {
- alias staticMerge = AliasSeq!(Seq[0],
- staticMerge!(cmp, half - 1, Seq[1 .. $]));
- }
- else
- {
- alias staticMerge = AliasSeq!(Seq[half],
- staticMerge!(cmp, half, Seq[0 .. half], Seq[half + 1 .. $]));
- }
- }
+ alias staticMerge = AliasSeq!(items[0 .. run], items[mid],
+ staticMerge!(cmp, mid - run, items[run .. mid], items[mid + 1 .. $]));
}
private template isLessEq(alias cmp, Seq...)
diff --git a/libphobos/src/std/parallelism.d b/libphobos/src/std/parallelism.d
index 664330a..bd467d2 100644
--- a/libphobos/src/std/parallelism.d
+++ b/libphobos/src/std/parallelism.d
@@ -955,16 +955,46 @@ uint totalCPUsImpl() @nogc nothrow @trusted
}
else version (linux)
{
- import core.sys.linux.sched : CPU_COUNT, cpu_set_t, sched_getaffinity;
+ import core.stdc.stdlib : calloc;
+ import core.stdc.string : memset;
+ import core.sys.linux.sched : CPU_ALLOC_SIZE, CPU_FREE, CPU_COUNT, CPU_COUNT_S, cpu_set_t, sched_getaffinity;
import core.sys.posix.unistd : _SC_NPROCESSORS_ONLN, sysconf;
- cpu_set_t set = void;
- if (sched_getaffinity(0, cpu_set_t.sizeof, &set) == 0)
+ int count = 0;
+
+ /**
+ * According to ruby's source code, CPU_ALLOC() doesn't work as expected.
+ * see: https://github.com/ruby/ruby/commit/7d9e04de496915dd9e4544ee18b1a0026dc79242
+ *
+ * The hardcode number also comes from ruby's source code.
+ * see: https://github.com/ruby/ruby/commit/0fa75e813ecf0f5f3dd01f89aa76d0e25ab4fcd4
+ */
+ for (int n = 64; n <= 16384; n *= 2)
{
- int count = CPU_COUNT(&set);
+ size_t size = CPU_ALLOC_SIZE(count);
+ if (size >= 0x400)
+ {
+ auto cpuset = cast(cpu_set_t*) calloc(1, size);
+ if (cpuset is null) break;
+ if (sched_getaffinity(0, size, cpuset) == 0)
+ {
+ count = CPU_COUNT_S(size, cpuset);
+ }
+ CPU_FREE(cpuset);
+ }
+ else
+ {
+ cpu_set_t cpuset;
+ if (sched_getaffinity(0, cpu_set_t.sizeof, &cpuset) == 0)
+ {
+ count = CPU_COUNT(&cpuset);
+ }
+ }
+
if (count > 0)
return cast(uint) count;
}
+
return cast(uint) sysconf(_SC_NPROCESSORS_ONLN);
}
else version (Darwin)
@@ -2733,9 +2763,6 @@ public:
}
}
- foreach (ref t; tasks[])
- emplaceRef(t, RTask());
-
// Hack to take the address of a nested function w/o
// making a closure.
static auto scopedAddress(D)(scope D del) @system
@@ -2748,12 +2775,19 @@ public:
void useTask(ref RTask task)
{
import std.algorithm.comparison : min;
+ import core.lifetime : emplace;
+
+ // Private constructor, so can't feed it's arguments directly
+ // to emplace
+ emplace(&task, RTask
+ (
+ scopedAddress(&reduceOnRange),
+ range,
+ curPos, // lower bound.
+ cast() min(len, curPos + workUnitSize) // upper bound.
+ ));
task.pool = this;
- task._args[0] = scopedAddress(&reduceOnRange);
- task._args[3] = min(len, curPos + workUnitSize); // upper bound.
- task._args[1] = range; // range
- task._args[2] = curPos; // lower bound.
curPos += workUnitSize;
}
@@ -3505,6 +3539,21 @@ public:
assert(taskPool.fold!("a + b", "a + b")(r, 0, 0, 42) == tuple(expected, expected));
}
+// Issue 16705
+@system unittest
+{
+ struct MyIota
+ {
+ size_t front;
+ void popFront()(){front++;}
+ auto empty(){return front >= 25;}
+ auto opIndex(size_t i){return front+i;}
+ auto length(){return 25-front;}
+ }
+
+ auto mySum = taskPool.reduce!"a + b"(MyIota());
+}
+
/**
Returns a lazily initialized global instantiation of `TaskPool`.
This function can safely be called concurrently from multiple non-worker
diff --git a/libphobos/src/std/process.d b/libphobos/src/std/process.d
index 7ec8fa1..98c5b94 100644
--- a/libphobos/src/std/process.d
+++ b/libphobos/src/std/process.d
@@ -1498,10 +1498,10 @@ package(std) string searchPathFor(scope const(char)[] executable)
@safe
{
import std.algorithm.iteration : splitter;
- import std.conv : text;
+ import std.conv : to;
import std.path : chainPath;
- string result;
+ typeof(return) result;
environment.getImpl("PATH",
(scope const(char)[] path)
@@ -1514,7 +1514,7 @@ package(std) string searchPathFor(scope const(char)[] executable)
auto execPath = chainPath(dir, executable);
if (isExecutable(execPath))
{
- result = text(execPath);
+ result = execPath.to!(typeof(result));
return;
}
}
@@ -1580,6 +1580,7 @@ private void setCLOEXEC(int fd, bool on) nothrow @nogc
// calls, but we make do...
version (Posix) @system unittest
{
+ import core.stdc.errno : errno;
import core.sys.posix.fcntl : open, O_RDONLY;
import core.sys.posix.unistd : close;
import std.algorithm.searching : canFind, findSplitBefore;
@@ -1594,7 +1595,20 @@ version (Posix) @system unittest
scope(exit) std.file.rmdirRecurse(directory);
auto path = buildPath(directory, "tmp");
std.file.write(path, null);
+ errno = 0;
auto fd = open(path.tempCString, O_RDONLY);
+ if (fd == -1)
+ {
+ import core.stdc.string : strerror;
+ import std.stdio : stderr;
+ import std.string : fromStringz;
+
+ // For the CI logs
+ stderr.writefln("%s: could not open '%s': %s",
+ __FUNCTION__, path, strerror(errno).fromStringz);
+ // TODO: should we retry here instead?
+ return;
+ }
scope(exit) close(fd);
// command >&2 (or any other number) checks whethether that number
@@ -1642,7 +1656,12 @@ version (Posix) @system unittest
if (lsofRes.status == 0)
{
assert(!lsofRes.output.canFind(path));
- assert(execute(lsof.path, null, Config.inheritFDs).output.canFind(path));
+ auto lsofOut = execute(lsof.path, null, Config.inheritFDs).output;
+ if (!lsofOut.canFind(path))
+ {
+ std.stdio.stderr.writeln(__FILE__, ':', __LINE__,
+ ": Warning: unexpected lsof output:", lsofOut);
+ }
return;
}
diff --git a/libphobos/src/std/random.d b/libphobos/src/std/random.d
index 441bc5d..a348356 100644
--- a/libphobos/src/std/random.d
+++ b/libphobos/src/std/random.d
@@ -1799,13 +1799,19 @@ how excellent the source of entropy is.
{
db 0x0f, 0xc7, 0xf0; // rdrand EAX
jnc LnotUsingRdrand;
+ mov result, EAX;
// Some AMD CPUs shipped with bugs where RDRAND could fail
// but still set the carry flag to 1. In those cases the
// output will be -1.
cmp EAX, 0xffff_ffff;
+ jne LusingRdrand;
+ // If result was -1 verify RDAND isn't constantly returning -1.
+ db 0x0f, 0xc7, 0xf0;
+ jnc LusingRdrand;
+ cmp EAX, 0xffff_ffff;
je LnotUsingRdrand;
- mov result, EAX;
}
+ LusingRdrand:
return result;
}
LnotUsingRdrand:
@@ -1853,13 +1859,19 @@ if (isUnsigned!UIntType)
{
db 0x0f, 0xc7, 0xf0; // rdrand EAX
jnc LnotUsingRdrand;
+ mov result, EAX;
// Some AMD CPUs shipped with bugs where RDRAND could fail
// but still set the carry flag to 1. In those cases the
// output will be -1.
cmp EAX, 0xffff_ffff;
+ jne LusingRdrand;
+ // If result was -1 verify RDAND isn't constantly returning -1.
+ db 0x0f, 0xc7, 0xf0;
+ jnc LusingRdrand;
+ cmp EAX, 0xffff_ffff;
je LnotUsingRdrand;
- mov result, EAX;
}
+ LusingRdrand:
return cast(UIntType) result;
}
else version (D_InlineAsm_X86_64)
@@ -1869,13 +1881,19 @@ if (isUnsigned!UIntType)
{
db 0x48, 0x0f, 0xc7, 0xf0; // rdrand RAX
jnc LnotUsingRdrand;
+ mov result, RAX;
// Some AMD CPUs shipped with bugs where RDRAND could fail
// but still set the carry flag to 1. In those cases the
// output will be -1.
cmp RAX, 0xffff_ffff_ffff_ffff;
+ jne LusingRdrand;
+ // If result was -1 verify RDAND isn't constantly returning -1.
+ db 0x48, 0x0f, 0xc7, 0xf0;
+ jnc LusingRdrand;
+ cmp RAX, 0xffff_ffff_ffff_ffff;
je LnotUsingRdrand;
- mov result, RAX;
}
+ LusingRdrand:
return result;
}
else
diff --git a/libphobos/src/std/range/interfaces.d b/libphobos/src/std/range/interfaces.d
index 4f8eba7..475f35b 100644
--- a/libphobos/src/std/range/interfaces.d
+++ b/libphobos/src/std/range/interfaces.d
@@ -100,7 +100,9 @@ interface InputRange(E) {
///
@property E front();
- ///
+ /**Calls $(REF moveFront, std, range, primitives) on the wrapped range, if
+ * possible. Otherwise, throws an $(LREF UnsupportedRangeMethod) exception.
+ */
E moveFront();
///
@@ -162,7 +164,9 @@ interface BidirectionalRange(E) : ForwardRange!(E) {
///
@property E back();
- ///
+ /**Calls $(REF moveBack, std, range, primitives) on the wrapped range, if
+ * possible. Otherwise, throws an $(LREF UnsupportedRangeMethod) exception
+ */
E moveBack();
///
@@ -197,7 +201,9 @@ interface RandomAccessFinite(E) : BidirectionalRange!(E) {
/**Interface for an infinite random access range of type `E`.*/
interface RandomAccessInfinite(E) : ForwardRange!E {
- ///
+ /**Calls $(REF moveAt, std, range, primitives) on the wrapped range, if
+ * possible. Otherwise, throws an $(LREF UnsupportedRangeMethod) exception.
+ */
E moveAt(size_t);
///
@@ -377,7 +383,11 @@ if (isInputRange!(Unqual!R))
@property E front() { return _range.front; }
E moveFront() {
- return _range.moveFront();
+ static if (__traits(compiles, _range.moveFront()))
+ return _range.moveFront();
+ else
+ throw new UnsupportedRangeMethod(
+ "Cannot move the front of a(n) `" ~ R.stringof ~ "`");
}
void popFront() { _range.popFront(); }
@@ -402,7 +412,11 @@ if (isInputRange!(Unqual!R))
@property E back() { return _range.back; }
E moveBack() {
- return _range.moveBack();
+ static if (__traits(compiles, _range.moveFront()))
+ return _range.moveBack();
+ else
+ throw new UnsupportedRangeMethod(
+ "Cannot move the back of a(n) `" ~ R.stringof ~ "`");
}
void popBack() { return _range.popBack(); }
@@ -422,7 +436,11 @@ if (isInputRange!(Unqual!R))
}
E moveAt(size_t index) {
- return _range.moveAt(index);
+ static if (__traits(compiles, _range.moveAt(index)))
+ return _range.moveAt(index);
+ else
+ throw new UnsupportedRangeMethod(
+ "Cannot move an element of a(n) `" ~ R.stringof ~ "`");
}
static if (hasAssignableElements!R)
@@ -520,6 +538,14 @@ template outputRangeObject(E...) {
static assert(is(typeof(appWrapped) : OutputRange!(uint)));
}
+/// Thrown when an interface method is not supported by the wrapped range
+class UnsupportedRangeMethod : Exception
+{
+ import std.exception : basicExceptionCtors;
+
+ mixin basicExceptionCtors;
+}
+
@system unittest
{
import std.algorithm.comparison : equal;
@@ -568,3 +594,16 @@ template outputRangeObject(E...) {
assert(app.data.length == 3);
assert(equal(app.data, [1,2,3]));
}
+
+// https://issues.dlang.org/show_bug.cgi?id=19544
+@safe unittest
+{
+ import std.range : repeat;
+
+ static struct HasCC
+ {
+ inout this(ref inout typeof(this)) {}
+ }
+
+ auto r = repeat(HasCC.init).inputRangeObject;
+}
diff --git a/libphobos/src/std/range/package.d b/libphobos/src/std/range/package.d
index 86bd4a1..a21f4d0 100644
--- a/libphobos/src/std/range/package.d
+++ b/libphobos/src/std/range/package.d
@@ -902,7 +902,7 @@ if (Ranges.length > 0 &&
private:
alias R = staticMap!(Unqual, Ranges);
alias RvalueElementType = CommonType!(staticMap!(.ElementType, R));
- private template sameET(A)
+ template sameET(A)
{
enum sameET = is(.ElementType!A == RvalueElementType);
}
@@ -8427,7 +8427,7 @@ if (isForwardRange!Source && hasLength!Source)
/// Ditto
@property bool empty()
{
- return _source.empty;
+ return _chunkCount == 0;
}
/// Ditto
@@ -9713,9 +9713,18 @@ if (Values.length > 1)
{
private enum arity = Values.length;
+ private alias UnqualValues = staticMap!(Unqual, Values);
+
private this(return scope ref Values values)
{
- this.values = values;
+ ref @trusted unqual(T)(ref T x){return cast() x;}
+
+ // TODO: this calls any possible copy constructors without qualifiers.
+ // Find a way to initialize values using qualified copy constructors.
+ static foreach (i; 0 .. Values.length)
+ {
+ this.values[i] = unqual(values[i]);
+ }
this.backIndex = arity;
}
@@ -9760,7 +9769,7 @@ if (Values.length > 1)
alias opDollar = length;
- CommonType!Values opIndex(size_t idx)
+ @trusted CommonType!Values opIndex(size_t idx)
{
// when i + idx points to elements popped
// with popBack
@@ -9768,7 +9777,7 @@ if (Values.length > 1)
final switch (frontIndex + idx)
static foreach (i, T; Values)
case i:
- return values[i];
+ return cast(T) values[i];
}
OnlyResult opSlice()
@@ -9800,12 +9809,15 @@ if (Values.length > 1)
{
import std.traits : hasElaborateAssign;
static if (hasElaborateAssign!T)
- private Values values;
+ private UnqualValues values;
else
- private Values values = void;
+ private UnqualValues values = void;
}
else
- private Values values;
+ // These may alias to shared or immutable data. Do not let the user
+ // to access these directly, and do not allow mutation without checking
+ // the qualifier.
+ private UnqualValues values;
}
// Specialize for single-element results
@@ -9814,12 +9826,12 @@ private struct OnlyResult(T)
@property T front()
{
assert(!empty, "Attempting to fetch the front of an empty Only range");
- return _value;
+ return fetchFront();
}
@property T back()
{
assert(!empty, "Attempting to fetch the back of an empty Only range");
- return _value;
+ return fetchFront();
}
@property bool empty() const { return _empty; }
@property size_t length() const { return !_empty; }
@@ -9838,14 +9850,17 @@ private struct OnlyResult(T)
private this()(return scope auto ref T value)
{
- this._value = value;
+ ref @trusted unqual(ref T x){return cast() x;}
+ // TODO: this calls the possible copy constructor without qualifiers.
+ // Find a way to initialize value using a qualified copy constructor.
+ this._value = unqual(value);
this._empty = false;
}
T opIndex(size_t i)
{
assert(!_empty && i == 0, "Attempting to fetch an out of bounds index from an Only range");
- return _value;
+ return fetchFront();
}
OnlyResult opSlice()
@@ -9868,35 +9883,14 @@ private struct OnlyResult(T)
return copy;
}
+ // This may alias to shared or immutable data. Do not let the user
+ // to access this directly, and do not allow mutation without checking
+ // the qualifier.
private Unqual!T _value;
private bool _empty = true;
-}
-
-// Specialize for the empty range
-private struct OnlyResult()
-{
- private static struct EmptyElementType {}
-
- bool empty() @property { return true; }
- size_t length() const @property { return 0; }
- alias opDollar = length;
- EmptyElementType front() @property { assert(false); }
- void popFront() { assert(false); }
- EmptyElementType back() @property { assert(false); }
- void popBack() { assert(false); }
- OnlyResult save() @property { return this; }
-
- EmptyElementType opIndex(size_t i)
- {
- assert(false);
- }
-
- OnlyResult opSlice() { return this; }
-
- OnlyResult opSlice(size_t from, size_t to)
+ private @trusted T fetchFront()
{
- assert(from == 0 && to == 0);
- return this;
+ return *cast(T*)&_value;
}
}
@@ -9921,11 +9915,20 @@ Returns:
See_Also: $(LREF chain) to chain ranges
*/
auto only(Values...)(return scope Values values)
-if (!is(CommonType!Values == void) || Values.length == 0)
+if (!is(CommonType!Values == void))
{
return OnlyResult!Values(values);
}
+/// ditto
+auto only()()
+{
+ // cannot use noreturn due to issue 22383
+ struct EmptyElementType {}
+ EmptyElementType[] result;
+ return result;
+}
+
///
@safe unittest
{
@@ -10157,6 +10160,19 @@ if (!is(CommonType!Values == void) || Values.length == 0)
assert(range.join == "Hello World");
}
+// https://issues.dlang.org/show_bug.cgi?id=21022
+@safe pure nothrow unittest
+{
+ struct S
+ {
+ int* mem;
+ }
+
+ immutable S x;
+ immutable(S)[] arr;
+ auto r1 = arr.chain(x.only, only(x, x));
+}
+
/**
Iterate over `range` with an attached index variable.
@@ -12740,8 +12756,12 @@ if (isInputRange!R && isIntegral!(ElementType!R))
import std.exception : assertThrown;
- // Check out of bounds error
- assertThrown!Error(bw[2 * bitsNum - 1]);
+ version (D_NoBoundsChecks) {}
+ else
+ {
+ // Check out of bounds error
+ assertThrown!Error(bw[2 * bitsNum - 1]);
+ }
bw[2] = true;
assert(bw[2] == true);
diff --git a/libphobos/src/std/range/primitives.d b/libphobos/src/std/range/primitives.d
index 9c61ff5..c092a9d 100644
--- a/libphobos/src/std/range/primitives.d
+++ b/libphobos/src/std/range/primitives.d
@@ -2562,3 +2562,20 @@ package(std) mixin template ImplementLength(alias member)
alias opDollar = length;
}
}
+
+@safe unittest
+{
+ import std.meta : AliasSeq;
+
+ foreach (alias E; AliasSeq!(noreturn, const(noreturn), immutable(noreturn) ))
+ {
+ alias R = E[];
+
+ static assert(isInputRange!R);
+ static assert(isForwardRange!R);
+ static assert(isBidirectionalRange!R);
+ static assert(isRandomAccessRange!R);
+ }
+
+ static assert(isOutputRange!(noreturn[], noreturn));
+}
diff --git a/libphobos/src/std/socket.d b/libphobos/src/std/socket.d
index be0aeba..f8908cf 100644
--- a/libphobos/src/std/socket.d
+++ b/libphobos/src/std/socket.d
@@ -2121,23 +2121,6 @@ enum SocketFlags: int
}
-private mixin template FieldProxy(string target, string field)
-{
- mixin(`
- @property typeof(`~target~`) `~field~`() const pure nothrow @nogc
- {
- return `~target~`;
- }
-
- /// ditto
- @property typeof(`~target~`) `~field~`(typeof(`~target~`) value) pure nothrow @nogc
- {
- return `~target~` = value;
- }
- `);
-}
-
-
/// Duration timeout value.
struct TimeVal
{
@@ -2145,16 +2128,18 @@ struct TimeVal
alias tv_sec_t = typeof(ctimeval.tv_sec);
alias tv_usec_t = typeof(ctimeval.tv_usec);
- version (StdDdoc) // no DDoc for string mixins, can't forward individual fields
+ /// Number of _seconds.
+ pure nothrow @nogc @property
+ ref inout(tv_sec_t) seconds() inout return
{
- tv_sec_t seconds; /// Number of _seconds.
- tv_usec_t microseconds; /// Number of additional _microseconds.
+ return ctimeval.tv_sec;
}
- else
+
+ /// Number of additional _microseconds.
+ pure nothrow @nogc @property
+ ref inout(tv_usec_t) microseconds() inout return
{
- // D interface
- mixin FieldProxy!(`ctimeval.tv_sec`, `seconds`);
- mixin FieldProxy!(`ctimeval.tv_usec`, `microseconds`);
+ return ctimeval.tv_usec;
}
}
@@ -2567,18 +2552,21 @@ struct Linger
{
_clinger clinger;
- version (StdDdoc) // no DDoc for string mixins, can't forward individual fields
+ private alias l_onoff_t = typeof(_clinger.init.l_onoff );
+ private alias l_linger_t = typeof(_clinger.init.l_linger);
+
+ /// Nonzero for _on.
+ pure nothrow @nogc @property
+ ref inout(l_onoff_t) on() inout return
{
- private alias l_onoff_t = typeof(_clinger.init.l_onoff );
- private alias l_linger_t = typeof(_clinger.init.l_linger);
- l_onoff_t on; /// Nonzero for _on.
- l_linger_t time; /// Linger _time.
+ return clinger.l_onoff;
}
- else
+
+ /// Linger _time.
+ pure nothrow @nogc @property
+ ref inout(l_linger_t) time() inout return
{
- // D interface
- mixin FieldProxy!(`clinger.l_onoff`, `on`);
- mixin FieldProxy!(`clinger.l_linger`, `time`);
+ return clinger.l_linger;
}
}
@@ -3119,21 +3107,17 @@ public:
from = createAddress();
socklen_t nameLen = from.nameLen;
version (Windows)
- {
auto read = .recvfrom(sock, buf.ptr, capToInt(buf.length), cast(int) flags, from.name, &nameLen);
- from.setNameLen(nameLen);
- assert(from.addressFamily == _family);
- // if (!read) //connection closed
- return read;
- }
+
else
- {
auto read = .recvfrom(sock, buf.ptr, buf.length, cast(int) flags, from.name, &nameLen);
+
+ if (read >= 0)
+ {
from.setNameLen(nameLen);
assert(from.addressFamily == _family);
- // if (!read) //connection closed
- return read;
}
+ return read;
}
@@ -3576,6 +3560,17 @@ class UdpSocket: Socket
}
}
+@safe unittest
+{
+ byte[] buf;
+ buf.length = 1;
+ Address addr;
+ auto s = new UdpSocket;
+ s.blocking = false;
+ s.bind(new InternetAddress(InternetAddress.PORT_ANY));
+ s.receiveFrom(buf, addr);
+}
+
// https://issues.dlang.org/show_bug.cgi?id=16514
@safe unittest
{
diff --git a/libphobos/src/std/stdio.d b/libphobos/src/std/stdio.d
index a88beb8..d3097d5 100644
--- a/libphobos/src/std/stdio.d
+++ b/libphobos/src/std/stdio.d
@@ -281,17 +281,14 @@ else version (GENERIC_IO)
nothrow:
@nogc:
- private int _FPUTC(int c, _iobuf* fp) { return fputc(c, cast(shared) fp); }
- private int _FPUTWC(wchar_t c, _iobuf* fp)
+ extern (C) private
{
- import core.stdc.wchar_ : fputwc;
- return fputwc(c, cast(shared) fp);
- }
- private int _FGETC(_iobuf* fp) { return fgetc(cast(shared) fp); }
- private int _FGETWC(_iobuf* fp)
- {
- import core.stdc.wchar_ : fgetwc;
- return fgetwc(cast(shared) fp);
+ static import core.stdc.wchar_;
+
+ pragma(mangle, fputc.mangleof) int _FPUTC(int c, _iobuf* fp);
+ pragma(mangle, core.stdc.wchar_.fputwc.mangleof) int _FPUTWC(wchar_t c, _iobuf* fp);
+ pragma(mangle, fgetc.mangleof) int _FGETC(_iobuf* fp);
+ pragma(mangle, core.stdc.wchar_.fgetwc.mangleof) int _FGETWC(_iobuf* fp);
}
version (Posix)
@@ -307,27 +304,19 @@ else version (GENERIC_IO)
// @@@DEPRECATED_2.107@@@
deprecated("internal function fputc_unlocked was unintentionally available "
~ "from std.stdio and will be removed afer 2.107")
- int fputc_unlocked(int c, _iobuf* fp) { return fputc(c, cast(shared) fp); }
+ extern (C) pragma(mangle, fputc.mangleof) int fputc_unlocked(int c, _iobuf* fp);
// @@@DEPRECATED_2.107@@@
deprecated("internal function fputwc_unlocked was unintentionally available "
~ "from std.stdio and will be removed afer 2.107")
- int fputwc_unlocked(wchar_t c, _iobuf* fp)
- {
- import core.stdc.wchar_ : fputwc;
- return fputwc(c, cast(shared) fp);
- }
+ extern (C) pragma(mangle, core.stdc.wchar_.fputwc.mangleof) int fputwc_unlocked(wchar_t c, _iobuf* fp);
// @@@DEPRECATED_2.107@@@
deprecated("internal function fgetc_unlocked was unintentionally available "
~ "from std.stdio and will be removed afer 2.107")
- int fgetc_unlocked(_iobuf* fp) { return fgetc(cast(shared) fp); }
+ extern (C) pragma(mangle, fgetc.mangleof) int fgetc_unlocked(_iobuf* fp);
// @@@DEPRECATED_2.107@@@
deprecated("internal function fgetwc_unlocked was unintentionally available "
~ "from std.stdio and will be removed afer 2.107")
- int fgetwc_unlocked(_iobuf* fp)
- {
- import core.stdc.wchar_ : fgetwc;
- return fgetwc(cast(shared) fp);
- }
+ extern (C) pragma(mangle, core.stdc.wchar_.fgetwc.mangleof) int fgetwc_unlocked(_iobuf* fp);
// @@@DEPRECATED_2.107@@@
deprecated("internal alias FPUTC was unintentionally available from "
@@ -363,6 +352,16 @@ else
static assert(0, "unsupported C I/O system");
}
+private extern (C) @nogc nothrow
+{
+ pragma(mangle, _FPUTC.mangleof) int trustedFPUTC(int ch, _iobuf* h) @trusted;
+
+ version (DIGITAL_MARS_STDIO)
+ pragma(mangle, _FPUTWC.mangleof) int trustedFPUTWC(int ch, _iobuf* h) @trusted;
+ else
+ pragma(mangle, _FPUTWC.mangleof) int trustedFPUTWC(wchar_t ch, _iobuf* h) @trusted;
+}
+
static if (__traits(compiles, core.sys.posix.stdio.getdelim))
{
extern(C) nothrow @nogc
@@ -3183,16 +3182,7 @@ is empty, throws an `Exception`. In case of an I/O error throws
/// ditto
void put(C)(scope C c) @safe if (isSomeChar!C || is(C : const(ubyte)))
{
- import std.traits : Parameters;
import std.utf : decodeFront, encode, stride;
- static auto trustedFPUTC(int ch, _iobuf* h) @trusted
- {
- return _FPUTC(ch, h);
- }
- static auto trustedFPUTWC(Parameters!_FPUTWC[0] ch, _iobuf* h) @trusted
- {
- return _FPUTWC(ch, h);
- }
static if (c.sizeof == 1)
{
diff --git a/libphobos/src/std/string.d b/libphobos/src/std/string.d
index 420b68a..5c9a2c9 100644
--- a/libphobos/src/std/string.d
+++ b/libphobos/src/std/string.d
@@ -1759,8 +1759,8 @@ if (isSomeChar!Char && isSomeChar!Char2)
haystack = String to search for needles in.
needles = Strings to search for in haystack.
startIdx = slices haystack like this $(D haystack[startIdx .. $]). If
- the startIdx is greater equal the length of haystack the functions
- returns `-1`.
+ the startIdx is greater than or equal to the length of haystack the
+ functions returns `-1`.
cs = Indicates whether the comparisons are case sensitive.
*/
ptrdiff_t indexOfAny(Char,Char2)(const(Char)[] haystack, const(Char2)[] needles,
@@ -1926,8 +1926,8 @@ if (isSomeChar!Char && isSomeChar!Char2)
haystack = String to search for needles in.
needles = Strings to search for in haystack.
stopIdx = slices haystack like this $(D haystack[0 .. stopIdx]). If
- the stopIdx is greater equal the length of haystack the functions
- returns `-1`.
+ the stopIdx is greater than or equal to the length of haystack the
+ functions returns `-1`.
cs = Indicates whether the comparisons are case sensitive.
*/
ptrdiff_t lastIndexOfAny(Char,Char2)(const(Char)[] haystack,
@@ -2105,8 +2105,8 @@ if (isSomeChar!Char && isSomeChar!Char2)
haystack = String to search for needles in.
needles = Strings to search for in haystack.
startIdx = slices haystack like this $(D haystack[startIdx .. $]). If
- the startIdx is greater equal the length of haystack the functions
- returns `-1`.
+ the startIdx is greater than or equal to the length of haystack the
+ functions returns `-1`.
cs = Indicates whether the comparisons are case sensitive.
*/
ptrdiff_t indexOfNeither(Char,Char2)(const(Char)[] haystack,
@@ -2265,8 +2265,8 @@ if (isSomeChar!Char && isSomeChar!Char2)
haystack = String to search for needles in.
needles = Strings to search for in haystack.
stopIdx = slices haystack like this $(D haystack[0 .. stopIdx]) If
- the stopIdx is greater equal the length of haystack the functions
- returns `-1`.
+ the stopIdx is greater than or equal to the length of haystack the
+ functions returns `-1`.
cs = Indicates whether the comparisons are case sensitive.
*/
ptrdiff_t lastIndexOfNeither(Char,Char2)(const(Char)[] haystack,
diff --git a/libphobos/src/std/system.d b/libphobos/src/std/system.d
index 7a115da..55fcfd7 100644
--- a/libphobos/src/std/system.d
+++ b/libphobos/src/std/system.d
@@ -36,6 +36,7 @@ immutable
watchOS, /// watchOS
freeBSD, /// FreeBSD
netBSD, /// NetBSD
+ openBSD, /// OpenBSD
dragonFlyBSD, /// DragonFlyBSD
solaris, /// Solaris
android, /// Android
@@ -54,6 +55,7 @@ immutable
else version (watchOS) OS os = OS.watchOS;
else version (FreeBSD) OS os = OS.freeBSD;
else version (NetBSD) OS os = OS.netBSD;
+ else version (OpenBSD) OS os = OS.openBSD;
else version (DragonFlyBSD) OS os = OS.dragonFlyBSD;
else version (Posix) OS os = OS.otherPosix;
else OS os = OS.unknown;
diff --git a/libphobos/src/std/traits.d b/libphobos/src/std/traits.d
index 230a7c6..1541415 100644
--- a/libphobos/src/std/traits.d
+++ b/libphobos/src/std/traits.d
@@ -562,15 +562,10 @@ struct MyStruct {}
static assert(fullyQualifiedName!(const MyStruct[]) == "const(myModule.MyStruct[])");
-----------------
*/
-template fullyQualifiedName(T...)
-if (T.length == 1)
-{
+enum fullyQualifiedName(T) = fqnType!(T, false, false, false, false);
- static if (is(T))
- enum fullyQualifiedName = fqnType!(T[0], false, false, false, false);
- else
- enum fullyQualifiedName = fqnSym!(T[0]);
-}
+/// ditto
+enum fullyQualifiedName(alias T) = fqnSym!(T);
///
@safe unittest
@@ -986,8 +981,8 @@ private template fqnType(T,
* is not part of a type, but the attribute of the function
* (see template $(LREF functionAttributes)).
*/
-template ReturnType(func...)
-if (func.length == 1 && isCallable!func)
+template ReturnType(alias func)
+if (isCallable!func)
{
static if (is(FunctionTypeOf!func R == return))
alias ReturnType = R;
@@ -1045,8 +1040,8 @@ Get, as a tuple, the types of the parameters to a function, a pointer
to function, a delegate, a struct with an `opCall`, a pointer to a
struct with an `opCall`, or a class with an `opCall`.
*/
-template Parameters(func...)
-if (func.length == 1 && isCallable!func)
+template Parameters(alias func)
+if (isCallable!func)
{
static if (is(FunctionTypeOf!func P == function))
alias Parameters = P;
@@ -1095,9 +1090,8 @@ alias ParameterTypeTuple = Parameters;
Returns the number of arguments of function `func`.
arity is undefined for variadic functions.
*/
-template arity(func...)
-if (func.length == 1 && isCallable!func &&
- variadicFunctionStyle!func == Variadic.no)
+template arity(alias func)
+if (isCallable!func && variadicFunctionStyle!func == Variadic.no)
{
enum size_t arity = Parameters!func.length;
}
@@ -1143,8 +1137,8 @@ enum ParameterStorageClass : uint
}
/// ditto
-template ParameterStorageClassTuple(func...)
-if (func.length == 1 && isCallable!func)
+template ParameterStorageClassTuple(alias func)
+if (isCallable!func)
{
alias Func = FunctionTypeOf!func;
@@ -1308,8 +1302,8 @@ template extractParameterStorageClassFlags(Attribs...)
/**
Get, as a tuple, the identifiers of the parameters to a function symbol.
*/
-template ParameterIdentifierTuple(func...)
-if (func.length == 1 && isCallable!func)
+template ParameterIdentifierTuple(alias func)
+if (isCallable!func)
{
static if (is(FunctionTypeOf!func PT == __parameters))
{
@@ -1331,7 +1325,7 @@ if (func.length == 1 && isCallable!func)
}
else
{
- static assert(0, func[0].stringof ~ " is not a function");
+ static assert(0, func.stringof ~ " is not a function");
// Define dummy entities to avoid pointless errors
template Get(size_t i) { enum Get = ""; }
@@ -1407,11 +1401,11 @@ if (func.length == 1 && isCallable!func)
Get, as a tuple, the default value of the parameters to a function symbol.
If a parameter doesn't have the default value, `void` is returned instead.
*/
-template ParameterDefaults(func...)
-if (func.length == 1 && isCallable!func)
+template ParameterDefaults(alias func)
+if (isCallable!func)
{
alias param_names = ParameterIdentifierTuple!func;
- static if (is(FunctionTypeOf!(func[0]) PT == __parameters))
+ static if (is(FunctionTypeOf!(func) PT == __parameters))
{
template Get(size_t i)
{
@@ -1444,7 +1438,7 @@ if (func.length == 1 && isCallable!func)
}
else
{
- static assert(0, func[0].stringof ~ " is not a function");
+ static assert(0, func.stringof ~ " is not a function");
// Define dummy entities to avoid pointless errors
template Get(size_t i) { enum Get = ""; }
@@ -1559,8 +1553,8 @@ enum FunctionAttribute : uint
}
/// ditto
-template functionAttributes(func...)
-if (func.length == 1 && isCallable!func)
+template functionAttributes(alias func)
+if (isCallable!func)
{
// @bug: workaround for opCall
alias FuncSym = Select!(is(typeof(__traits(getFunctionAttributes, func))),
@@ -2090,8 +2084,8 @@ Params:
Returns:
one of the strings "D", "C", "C++", "Windows", "Objective-C", or "System".
*/
-template functionLinkage(func...)
-if (func.length == 1 && isCallable!func)
+template functionLinkage(alias func)
+if (isCallable!func)
{
enum string functionLinkage = __traits(getLinkage, FunctionTypeOf!func);
}
@@ -2148,8 +2142,8 @@ enum Variadic
}
/// ditto
-template variadicFunctionStyle(func...)
-if (func.length == 1 && isCallable!func)
+template variadicFunctionStyle(alias func)
+if (isCallable!func)
{
enum string varargs = __traits(getFunctionVariadicStyle, FunctionTypeOf!func);
enum Variadic variadicFunctionStyle =
@@ -2198,25 +2192,25 @@ Note:
Do not confuse function types with function pointer types; function types are
usually used for compile-time reflection purposes.
*/
-template FunctionTypeOf(func...)
-if (func.length == 1 && isCallable!func)
+template FunctionTypeOf(alias func)
+if (isCallable!func)
{
- static if ((is(typeof(& func[0]) Fsym : Fsym*) && is(Fsym == function)) || is(typeof(& func[0]) Fsym == delegate))
+ static if ((is(typeof(& func) Fsym : Fsym*) && is(Fsym == function)) || is(typeof(& func) Fsym == delegate))
{
alias FunctionTypeOf = Fsym; // HIT: (nested) function symbol
}
- else static if (is(typeof(& func[0].opCall) Fobj == delegate) || is(typeof(& func[0].opCall!()) Fobj == delegate))
+ else static if (is(typeof(& func.opCall) Fobj == delegate) || is(typeof(& func.opCall!()) Fobj == delegate))
{
alias FunctionTypeOf = Fobj; // HIT: callable object
}
else static if (
- (is(typeof(& func[0].opCall) Ftyp : Ftyp*) && is(Ftyp == function)) ||
- (is(typeof(& func[0].opCall!()) Ftyp : Ftyp*) && is(Ftyp == function))
+ (is(typeof(& func.opCall) Ftyp : Ftyp*) && is(Ftyp == function)) ||
+ (is(typeof(& func.opCall!()) Ftyp : Ftyp*) && is(Ftyp == function))
)
{
alias FunctionTypeOf = Ftyp; // HIT: callable type
}
- else static if (is(func[0] T) || is(typeof(func[0]) T))
+ else static if (is(func T) || is(typeof(func) T))
{
static if (is(T == function))
alias FunctionTypeOf = T; // HIT: function
@@ -2675,12 +2669,8 @@ template hasNested(T)
*/
template Fields(T)
{
- static if (is(T == struct) || is(T == union))
- alias Fields = typeof(T.tupleof[0 .. $ - isNested!T]);
- else static if (is(T == class) || is(T == interface))
- alias Fields = typeof(T.tupleof);
- else
- alias Fields = AliasSeq!T;
+ import core.internal.traits : _Fields = Fields;
+ alias Fields = _Fields!T;
}
///
@@ -2847,6 +2837,8 @@ template RepresentationTypeTuple(T)
struct S5 { int a; Rebindable!(immutable Object) b; }
alias R2 = RepresentationTypeTuple!S5;
static assert(R2.length == 2 && is(R2[0] == int) && is(R2[1] == immutable(Object)));
+
+ static assert(is(RepresentationTypeTuple!noreturn == AliasSeq!noreturn));
}
@safe unittest
@@ -2869,7 +2861,7 @@ private template RepresentationTypeTupleImpl(T)
{
import std.typecons : Rebindable;
- static if (is(T R: Rebindable!R))
+ static if (is(immutable T == immutable Rebindable!R, R))
{
alias RepresentationTypeTupleImpl
= staticMapMeta!(.RepresentationTypeTupleImpl, RepresentationTypeTupleImpl!R);
@@ -3292,13 +3284,15 @@ template hasAliasing(T...)
class S15 { S15[1] a; }
static assert( hasAliasing!S15);
static assert(!hasAliasing!(immutable(S15)));
+
+ static assert(!hasAliasing!noreturn);
}
private template hasAliasingImpl(T)
{
import std.typecons : Rebindable;
- static if (is(T : Rebindable!R, R))
+ static if (is(immutable T == immutable Rebindable!R, R))
{
enum hasAliasingImpl = hasAliasingImpl!R;
}
@@ -3324,15 +3318,8 @@ $(LI a [context pointer][isNested].))
*/
template hasIndirections(T)
{
- static if (is(T == struct) || is(T == union))
- enum hasIndirections = anySatisfy!(.hasIndirections, typeof(T.tupleof));
- else static if (isStaticArray!T && is(T : E[N], E, size_t N))
- enum hasIndirections = is(E == void) ? true : hasIndirections!E;
- else static if (isFunctionPointer!T)
- enum hasIndirections = false;
- else
- enum hasIndirections = isPointer!T || isDelegate!T || isDynamicArray!T ||
- isAssociativeArray!T || is (T == class) || is(T == interface);
+ import core.internal.traits : _hasIndirections = hasIndirections;
+ alias hasIndirections = _hasIndirections!T;
}
///
@@ -3409,6 +3396,8 @@ template hasIndirections(T)
int local;
struct HasContextPointer { int opCall() { return ++local; } }
static assert(hasIndirections!HasContextPointer);
+
+ static assert(!hasIndirections!noreturn);
}
// https://issues.dlang.org/show_bug.cgi?id=12000
@@ -3575,13 +3564,15 @@ template hasUnsharedAliasing(T...)
static assert( hasUnsharedAliasing!S18);
static assert( hasUnsharedAliasing!S19);
static assert(!hasUnsharedAliasing!S20);
+
+ static assert(!hasUnsharedAliasing!noreturn);
}
private template hasUnsharedAliasingImpl(T)
{
import std.typecons : Rebindable;
- static if (is(T R: Rebindable!R))
+ static if (is(immutable T == immutable Rebindable!R, R))
{
enum hasUnsharedAliasingImpl = hasUnsharedAliasingImpl!R;
}
@@ -3603,17 +3594,25 @@ private template hasUnsharedAliasingImpl(T)
}
}
-/**
- True if `S` or any type embedded directly in the representation of `S`
- defines an elaborate copy constructor. Elaborate copy constructors are
- introduced by defining `this(this)` for a `struct`.
+version (StdDdoc)
+{
+ /**
+ True if `S` or any type embedded directly in the representation of `S`
+ defines an elaborate copy constructor. Elaborate copy constructors are
+ introduced by defining `this(this)` for a `struct`.
- Classes and unions never have elaborate copy constructors.
- */
-template hasElaborateCopyConstructor(S)
+ Classes and unions never have elaborate copy constructors.
+ */
+ template hasElaborateCopyConstructor(S)
+ {
+ import core.internal.traits : hasElabCCtor = hasElaborateCopyConstructor;
+ alias hasElaborateCopyConstructor = hasElabCCtor!(S);
+ }
+}
+else
{
import core.internal.traits : hasElabCCtor = hasElaborateCopyConstructor;
- alias hasElaborateCopyConstructor = hasElabCCtor!(S);
+ alias hasElaborateCopyConstructor = hasElabCCtor;
}
///
@@ -3732,19 +3731,27 @@ template hasElaborateAssign(S)
static assert( hasElaborateAssign!SS9);
}
-/**
- True if `S` or any type directly embedded in the representation
- of `S` defines an elaborate destructor. Elaborate destructors
- are introduced by defining `~this()` for a $(D
- struct).
+version (StdDdoc)
+{
+ /**
+ True if `S` or any type directly embedded in the representation
+ of `S` defines an elaborate destructor. Elaborate destructors
+ are introduced by defining `~this()` for a $(D
+ struct).
- Classes and unions never have elaborate destructors, even
- though classes may define `~this()`.
- */
-template hasElaborateDestructor(S)
+ Classes and unions never have elaborate destructors, even
+ though classes may define `~this()`.
+ */
+ template hasElaborateDestructor(S)
+ {
+ import core.internal.traits : hasElabDest = hasElaborateDestructor;
+ alias hasElaborateDestructor = hasElabDest!(S);
+ }
+}
+else
{
import core.internal.traits : hasElabDest = hasElaborateDestructor;
- alias hasElaborateDestructor = hasElabDest!(S);
+ alias hasElaborateDestructor = hasElabDest;
}
///
@@ -3771,17 +3778,25 @@ template hasElaborateDestructor(S)
static assert( hasElaborateDestructor!S7);
}
-/**
- True if `S` or any type embedded directly in the representation of `S`
- defines elaborate move semantics. Elaborate move semantics are
- introduced by defining `opPostMove(ref typeof(this))` for a `struct`.
+version (StdDdoc)
+{
+ /**
+ True if `S` or any type embedded directly in the representation of `S`
+ defines elaborate move semantics. Elaborate move semantics are
+ introduced by defining `opPostMove(ref typeof(this))` for a `struct`.
- Classes and unions never have elaborate move semantics.
- */
-template hasElaborateMove(S)
+ Classes and unions never have elaborate move semantics.
+ */
+ template hasElaborateMove(S)
+ {
+ import core.internal.traits : hasElabMove = hasElaborateMove;
+ alias hasElaborateMove = hasElabMove!(S);
+ }
+}
+else
{
import core.internal.traits : hasElabMove = hasElaborateMove;
- alias hasElaborateMove = hasElabMove!(S);
+ alias hasElaborateMove = hasElabMove;
}
///
@@ -4116,50 +4131,9 @@ int[] abc = cast(int[]) [ EnumMembers!E ];
template EnumMembers(E)
if (is(E == enum))
{
- import std.meta : AliasSeq;
- // Supply the specified identifier to an constant value.
- template WithIdentifier(string ident)
- {
- static if (ident == "Symbolize")
- {
- template Symbolize(alias value)
- {
- enum Symbolize = value;
- }
- }
- else
- {
- mixin("template Symbolize(alias "~ ident ~")"
- ~"{"
- ~"alias Symbolize = "~ ident ~";"
- ~"}");
- }
- }
-
- template EnumSpecificMembers(names...)
- {
- static if (names.length == 1)
- {
- alias EnumSpecificMembers = AliasSeq!(WithIdentifier!(names[0])
- .Symbolize!(__traits(getMember, E, names[0])));
- }
- else static if (names.length > 0)
- {
- alias EnumSpecificMembers =
- AliasSeq!(
- WithIdentifier!(names[0])
- .Symbolize!(__traits(getMember, E, names[0])),
- EnumSpecificMembers!(names[1 .. $/2]),
- EnumSpecificMembers!(names[$/2..$])
- );
- }
- else
- {
- alias EnumSpecificMembers = AliasSeq!();
- }
- }
-
- alias EnumMembers = EnumSpecificMembers!(__traits(allMembers, E));
+ alias EnumMembers = AliasSeq!();
+ static foreach (M; __traits(allMembers, E))
+ EnumMembers = AliasSeq!(EnumMembers, __traits(getMember, E, M));
}
/// Create an array of enumerated values
@@ -4494,14 +4468,7 @@ template InterfacesTuple(T)
* interfaces. $(D_PARAM TransitiveBaseTypeTuple!Object) yields the
* empty type tuple.
*/
-template TransitiveBaseTypeTuple(T)
-{
- static if (is(T == Object))
- alias TransitiveBaseTypeTuple = AliasSeq!();
- else
- alias TransitiveBaseTypeTuple =
- AliasSeq!(BaseClassesTuple!T, InterfacesTuple!T);
-}
+alias TransitiveBaseTypeTuple(T) = AliasSeq!(BaseClassesTuple!T, InterfacesTuple!T);
///
@safe unittest
@@ -4748,22 +4715,13 @@ if (is(C == class) || is(C == interface))
Returns an alias to the template that `T` is an instance of.
It will return `void` if a symbol without a template is given.
*/
-template TemplateOf(alias T : Base!Args, alias Base, Args...)
-{
- alias TemplateOf = Base;
-}
+alias TemplateOf(alias T : Base!Args, alias Base, Args...) = Base;
/// ditto
-template TemplateOf(T : Base!Args, alias Base, Args...)
-{
- alias TemplateOf = Base;
-}
+alias TemplateOf(T : Base!Args, alias Base, Args...) = Base;
/// ditto
-template TemplateOf(T)
-{
- alias TemplateOf = void;
-}
+alias TemplateOf(T) = void;
///
@safe unittest
@@ -4805,16 +4763,10 @@ template TemplateOf(T)
/**
Returns a `AliasSeq` of the template arguments used to instantiate `T`.
*/
-template TemplateArgsOf(alias T : Base!Args, alias Base, Args...)
-{
- alias TemplateArgsOf = Args;
-}
+alias TemplateArgsOf(alias T : Base!Args, alias Base, Args...) = Args;
/// ditto
-template TemplateArgsOf(T : Base!Args, alias Base, Args...)
-{
- alias TemplateArgsOf = Args;
-}
+alias TemplateArgsOf(T : Base!Args, alias Base, Args...) = Args;
///
@safe unittest
@@ -4850,24 +4802,15 @@ template TemplateArgsOf(T : Base!Args, alias Base, Args...)
static assert(is(TemplateArgsOf!(Foo10!()) == AliasSeq!()));
}
-
-package template maxAlignment(U...)
-if (isTypeTuple!U)
+// Returns the largest alignment in a type tuple.
+package enum maxAlignment(U...) =
{
- static if (U.length == 0)
- static assert(0);
- else static if (U.length == 1)
- enum maxAlignment = U[0].alignof;
- else static if (U.length == 2)
- enum maxAlignment = U[0].alignof > U[1].alignof ? U[0].alignof : U[1].alignof;
- else
- {
- enum a = maxAlignment!(U[0 .. ($+1)/2]);
- enum b = maxAlignment!(U[($+1)/2 .. $]);
- enum maxAlignment = a > b ? a : b;
- }
-}
-
+ size_t result = U[0].alignof;
+ static foreach (T; U[1 .. $])
+ if (result < T.alignof)
+ result = T.alignof;
+ return result;
+}();
/**
Returns class instance alignment.
@@ -4902,25 +4845,10 @@ types have no common type.
*/
template CommonType(T...)
{
- static if (!T.length)
- {
- alias CommonType = void;
- }
- else static if (T.length == 1)
- {
- static if (is(typeof(T[0])))
- {
- alias CommonType = typeof(T[0]);
- }
- else
- {
- alias CommonType = T[0];
- }
- }
+ static if (T.length == 1)
+ alias CommonType = typeof(T[0].init);
else static if (is(typeof(true ? T[0].init : T[1].init) U))
- {
alias CommonType = CommonType!(U, T[2 .. $]);
- }
else
alias CommonType = void;
}
@@ -4966,36 +4894,29 @@ template AllImplicitConversionTargets(T)
{
static if (is(T == bool))
alias AllImplicitConversionTargets =
- AliasSeq!(byte, ubyte, short, ushort, int, uint, long, ulong, CentTypeList,
- float, double, real, char, wchar, dchar);
+ AliasSeq!(byte, AllImplicitConversionTargets!byte);
else static if (is(T == byte))
alias AllImplicitConversionTargets =
- AliasSeq!(ubyte, short, ushort, int, uint, long, ulong, CentTypeList,
- float, double, real, char, wchar, dchar);
+ AliasSeq!(char, ubyte, short, AllImplicitConversionTargets!short);
else static if (is(T == ubyte))
alias AllImplicitConversionTargets =
- AliasSeq!(byte, short, ushort, int, uint, long, ulong, CentTypeList,
- float, double, real, char, wchar, dchar);
+ AliasSeq!(byte, char, short, AllImplicitConversionTargets!short);
else static if (is(T == short))
alias AllImplicitConversionTargets =
- AliasSeq!(ushort, int, uint, long, ulong, CentTypeList, float, double, real);
+ AliasSeq!(ushort, wchar, int, AllImplicitConversionTargets!int);
else static if (is(T == ushort))
alias AllImplicitConversionTargets =
- AliasSeq!(short, int, uint, long, ulong, CentTypeList, float, double, real);
+ AliasSeq!(short, wchar, dchar, AllImplicitConversionTargets!dchar);
else static if (is(T == int))
alias AllImplicitConversionTargets =
- AliasSeq!(uint, long, ulong, CentTypeList, float, double, real);
+ AliasSeq!(dchar, uint, long, AllImplicitConversionTargets!long);
else static if (is(T == uint))
alias AllImplicitConversionTargets =
- AliasSeq!(int, long, ulong, CentTypeList, float, double, real);
+ AliasSeq!(dchar, int, long, AllImplicitConversionTargets!long);
else static if (is(T == long))
- alias AllImplicitConversionTargets = AliasSeq!(ulong, float, double, real);
+ alias AllImplicitConversionTargets = AliasSeq!(ulong, CentTypeList, float, double, real);
else static if (is(T == ulong))
- alias AllImplicitConversionTargets = AliasSeq!(long, float, double, real);
- else static if (is(cent) && is(T == cent))
- alias AllImplicitConversionTargets = AliasSeq!(UnsignedCentTypeList, float, double, real);
- else static if (is(ucent) && is(T == ucent))
- alias AllImplicitConversionTargets = AliasSeq!(SignedCentTypeList, float, double, real);
+ alias AllImplicitConversionTargets = AliasSeq!(long, CentTypeList, float, double, real);
else static if (is(T == float))
alias AllImplicitConversionTargets = AliasSeq!(double, real);
else static if (is(T == double))
@@ -5004,21 +4925,17 @@ template AllImplicitConversionTargets(T)
alias AllImplicitConversionTargets = AliasSeq!(float, double);
else static if (is(T == char))
alias AllImplicitConversionTargets =
- AliasSeq!(wchar, dchar, byte, ubyte, short, ushort,
- int, uint, long, ulong, CentTypeList, float, double, real);
+ AliasSeq!(byte, ubyte, short, AllImplicitConversionTargets!short);
else static if (is(T == wchar))
alias AllImplicitConversionTargets =
- AliasSeq!(dchar, short, ushort, int, uint, long, ulong, CentTypeList,
- float, double, real);
+ AliasSeq!(short, ushort, dchar, AllImplicitConversionTargets!dchar);
else static if (is(T == dchar))
alias AllImplicitConversionTargets =
- AliasSeq!(int, uint, long, ulong, CentTypeList, float, double, real);
- else static if (is(T : typeof(null)))
- alias AllImplicitConversionTargets = AliasSeq!(typeof(null));
+ AliasSeq!(int, uint, long, AllImplicitConversionTargets!long);
else static if (is(T == class))
- alias AllImplicitConversionTargets = staticMap!(ApplyLeft!(CopyConstness, T), TransitiveBaseTypeTuple!(T));
+ alias AllImplicitConversionTargets = staticMap!(ApplyLeft!(CopyConstness, T), TransitiveBaseTypeTuple!T);
else static if (is(T == interface))
- alias AllImplicitConversionTargets = staticMap!(ApplyLeft!(CopyConstness, T), InterfacesTuple!(T));
+ alias AllImplicitConversionTargets = staticMap!(ApplyLeft!(CopyConstness, T), InterfacesTuple!T);
else static if (isDynamicArray!T && !is(typeof(T.init[0]) == const))
{
static if (is(typeof(T.init[0]) == shared))
@@ -5028,8 +4945,12 @@ template AllImplicitConversionTargets(T)
alias AllImplicitConversionTargets =
AliasSeq!(const(Unqual!(typeof(T.init[0])))[]);
}
- else static if (is(T : void*))
+ else static if (is(T : void*) && !is(T == void*))
alias AllImplicitConversionTargets = AliasSeq!(void*);
+ else static if (is(cent) && is(T == cent))
+ alias AllImplicitConversionTargets = AliasSeq!(UnsignedCentTypeList, float, double, real);
+ else static if (is(ucent) && is(T == ucent))
+ alias AllImplicitConversionTargets = AliasSeq!(SignedCentTypeList, float, double, real);
else
alias AllImplicitConversionTargets = AliasSeq!();
}
@@ -5040,22 +4961,23 @@ template AllImplicitConversionTargets(T)
import std.meta : AliasSeq;
static assert(is(AllImplicitConversionTargets!(ulong) == AliasSeq!(long, float, double, real)));
- static assert(is(AllImplicitConversionTargets!(int) == AliasSeq!(uint, long, ulong, float, double, real)));
+ static assert(is(AllImplicitConversionTargets!(int) == AliasSeq!(dchar, uint, long, ulong, float, double, real)));
static assert(is(AllImplicitConversionTargets!(float) == AliasSeq!(double, real)));
static assert(is(AllImplicitConversionTargets!(double) == AliasSeq!(float, real)));
- static assert(is(AllImplicitConversionTargets!(char) == AliasSeq!(
- wchar, dchar, byte, ubyte, short, ushort, int, uint, long, ulong, float, double, real
- )));
+ static assert(is(AllImplicitConversionTargets!(char) ==
+ AliasSeq!(byte, ubyte, short, ushort, wchar, int, dchar, uint, long,
+ ulong, float, double, real)
+ ));
static assert(is(AllImplicitConversionTargets!(wchar) == AliasSeq!(
- dchar, short, ushort, int, uint, long, ulong, float, double, real
+ short, ushort, dchar, int, uint, long, ulong, float, double, real
)));
static assert(is(AllImplicitConversionTargets!(dchar) == AliasSeq!(
int, uint, long, ulong, float, double, real
)));
static assert(is(AllImplicitConversionTargets!(string) == AliasSeq!(const(char)[])));
- static assert(is(AllImplicitConversionTargets!(void*) == AliasSeq!(void*)));
+ static assert(is(AllImplicitConversionTargets!(int*) == AliasSeq!(void*)));
interface A {}
interface B {}
@@ -5747,13 +5669,11 @@ Note: Trying to use returned value will result in a
// SomethingTypeOf
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
-private alias AliasThisTypeOf(T) = typeof(__traits(getMember, T.init, __traits(getAliasThis, T)[0]));
-
/*
*/
template BooleanTypeOf(T)
{
- static if (is(AliasThisTypeOf!T AT) && !is(AT[] == AT))
+ static if (is(typeof(__traits(getMember, T.init, __traits(getAliasThis, T)[0])) AT) && !is(AT[] == AT))
alias X = BooleanTypeOf!AT;
else
alias X = OriginalType!T;
@@ -5804,7 +5724,7 @@ template BooleanTypeOf(T)
*/
template IntegralTypeOf(T)
{
- static if (is(AliasThisTypeOf!T AT) && !is(AT[] == AT))
+ static if (is(typeof(__traits(getMember, T.init, __traits(getAliasThis, T)[0])) AT) && !is(AT[] == AT))
alias X = IntegralTypeOf!AT;
else
alias X = OriginalType!T;
@@ -5840,7 +5760,7 @@ template IntegralTypeOf(T)
*/
template FloatingPointTypeOf(T)
{
- static if (is(AliasThisTypeOf!T AT) && !is(AT[] == AT))
+ static if (is(typeof(__traits(getMember, T.init, __traits(getAliasThis, T)[0])) AT) && !is(AT[] == AT))
alias X = FloatingPointTypeOf!AT;
else
alias X = OriginalType!T;
@@ -5925,7 +5845,7 @@ template SignedTypeOf(T)
*/
template CharTypeOf(T)
{
- static if (is(AliasThisTypeOf!T AT) && !is(AT[] == AT))
+ static if (is(typeof(__traits(getMember, T.init, __traits(getAliasThis, T)[0])) AT) && !is(AT[] == AT))
alias X = CharTypeOf!AT;
else
alias X = OriginalType!T;
@@ -5966,7 +5886,7 @@ template CharTypeOf(T)
*/
template StaticArrayTypeOf(T)
{
- static if (is(AliasThisTypeOf!T AT) && !is(AT[] == AT))
+ static if (is(typeof(__traits(getMember, T.init, __traits(getAliasThis, T)[0])) AT) && !is(AT[] == AT))
alias X = StaticArrayTypeOf!AT;
else
alias X = OriginalType!T;
@@ -6001,17 +5921,8 @@ template StaticArrayTypeOf(T)
*/
template DynamicArrayTypeOf(T)
{
- static if (is(AliasThisTypeOf!T AT) && !is(AT[] == AT))
- alias X = DynamicArrayTypeOf!AT;
- else
- alias X = OriginalType!T;
-
- static if (is(X == E[], E))
- {
- alias DynamicArrayTypeOf = X;
- }
- else
- static assert(0, T.stringof~" is not a dynamic array");
+ import core.internal.traits : _DynamicArrayTypeOf = DynamicArrayTypeOf;
+ alias DynamicArrayTypeOf = _DynamicArrayTypeOf!T;
}
@safe unittest
@@ -6132,7 +6043,7 @@ template StringTypeOf(T)
*/
template AssocArrayTypeOf(T)
{
- static if (is(AliasThisTypeOf!T AT) && !is(AT[] == AT))
+ static if (is(typeof(__traits(getMember, T.init, __traits(getAliasThis, T)[0])) AT) && !is(AT[] == AT))
alias X = AssocArrayTypeOf!AT;
else
alias X = OriginalType!T;
@@ -6173,7 +6084,7 @@ template BuiltinTypeOf(T)
alias BuiltinTypeOf = void;
else
{
- static if (is(AliasThisTypeOf!T AT) && !is(AT[] == AT))
+ static if (is(typeof(__traits(getMember, T.init, __traits(getAliasThis, T)[0])) AT) && !is(AT[] == AT))
alias X = BuiltinTypeOf!AT;
else
alias X = OriginalType!T;
@@ -6902,7 +6813,9 @@ template isAutodecodableString(T)
import std.range.primitives : autodecodeStrings;
enum isAutodecodableString = autodecodeStrings &&
- (is(T : const char[]) || is(T : const wchar[])) && !is(T : U[n], U, size_t n);
+ (is(T : const char[]) || is(T : const wchar[]))
+ && !is(T : U[n], U, size_t n)
+ && !is(immutable T : immutable noreturn[]);
}
///
@@ -6937,6 +6850,9 @@ template isAutodecodableString(T)
static assert(isAutodecodableString!(H));
static assert(isAutodecodableString!(I));
+
+ static assert(!isAutodecodableString!(noreturn[]));
+ static assert(!isAutodecodableString!(immutable(noreturn)[]));
}
/**
@@ -7381,15 +7297,14 @@ alias isExpressionTuple = isExpressions;
*
* See_Also: $(LREF isExpressions).
*/
-template isTypeTuple(T...)
+enum isTypeTuple(T...) =
{
- static if (T.length >= 2)
- enum bool isTypeTuple = isTypeTuple!(T[0 .. $/2]) && isTypeTuple!(T[$/2 .. $]);
- else static if (T.length == 1)
- enum bool isTypeTuple = is(T[0]);
- else
- enum bool isTypeTuple = true; // default
-}
+ static foreach (U; T)
+ static if (!is(U))
+ if (__ctfe)
+ return false;
+ return true;
+}();
///
@safe unittest
@@ -7473,15 +7388,14 @@ Params:
Returns:
A `bool`
*/
-template isSomeFunction(T...)
-if (T.length == 1)
+template isSomeFunction(alias T)
{
- static if (is(typeof(& T[0]) U : U*) && is(U == function) || is(typeof(& T[0]) U == delegate))
+ static if (is(typeof(& T) U : U*) && is(U == function) || is(typeof(& T) U == delegate))
{
// T is a (nested) function symbol.
enum bool isSomeFunction = true;
}
- else static if (is(T[0] W) || is(typeof(T[0]) W))
+ else static if (is(T W) || is(typeof(T) W))
{
// T is an expression or a type. Take the type of it and examine.
static if (is(W F : F*) && is(F == function))
@@ -7623,11 +7537,7 @@ Params:
Returns:
A `bool`
*/
-template isAbstractFunction(T...)
-if (T.length == 1)
-{
- enum bool isAbstractFunction = __traits(isAbstractFunction, T[0]);
-}
+enum isAbstractFunction(alias T) = __traits(isAbstractFunction, T);
///
@safe unittest
@@ -7644,11 +7554,7 @@ if (T.length == 1)
/**
* Detect whether `T` is a final function.
*/
-template isFinalFunction(T...)
-if (T.length == 1)
-{
- enum bool isFinalFunction = __traits(isFinalFunction, T[0]);
-}
+enum isFinalFunction(alias T) = __traits(isFinalFunction, T);
///
@safe unittest
@@ -7716,11 +7622,7 @@ template isNestedFunction(alias f)
/**
* Detect whether `T` is an abstract class.
*/
-template isAbstractClass(T...)
-if (T.length == 1)
-{
- enum bool isAbstractClass = __traits(isAbstractClass, T[0]);
-}
+enum isAbstractClass(alias T) = __traits(isAbstractClass, T);
///
@safe unittest
@@ -7740,11 +7642,7 @@ if (T.length == 1)
/**
* Detect whether `T` is a final class.
*/
-template isFinalClass(T...)
-if (T.length == 1)
-{
- enum bool isFinalClass = __traits(isFinalClass, T[0]);
-}
+enum isFinalClass(alias T) = __traits(isFinalClass, T);
///
@safe unittest
@@ -7767,13 +7665,21 @@ if (T.length == 1)
// General Types
//::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::://
-/**
-Removes `const`, `inout` and `immutable` qualifiers, if any, from type `T`.
- */
-template Unconst(T)
+version (StdDdoc)
+{
+ /**
+ Removes `const`, `inout` and `immutable` qualifiers, if any, from type `T`.
+ */
+ template Unconst(T)
+ {
+ import core.internal.traits : CoreUnconst = Unconst;
+ alias Unconst = CoreUnconst!(T);
+ }
+}
+else
{
import core.internal.traits : CoreUnconst = Unconst;
- alias Unconst = CoreUnconst!(T);
+ alias Unconst = CoreUnconst;
}
///
@@ -7802,13 +7708,21 @@ template Unconst(T)
static assert(is(Unconst!ImmIntArr == immutable(int)[]));
}
-/**
-Removes all qualifiers, if any, from type `T`.
- */
-template Unqual(T)
+version (StdDdoc)
+{
+ /**
+ Removes all qualifiers, if any, from type `T`.
+ */
+ template Unqual(T)
+ {
+ import core.internal.traits : CoreUnqual = Unqual;
+ alias Unqual = CoreUnqual!(T);
+ }
+}
+else
{
import core.internal.traits : CoreUnqual = Unqual;
- alias Unqual = CoreUnqual!(T);
+ alias Unqual = CoreUnqual;
}
///
@@ -7840,29 +7754,8 @@ template Unqual(T)
// [For internal use]
package template ModifyTypePreservingTQ(alias Modifier, T)
{
- static if (is(T U == immutable U)) alias ModifyTypePreservingTQ = immutable Modifier!U;
- else static if (is(T U == shared inout const U)) alias ModifyTypePreservingTQ = shared inout const Modifier!U;
- else static if (is(T U == shared inout U)) alias ModifyTypePreservingTQ = shared inout Modifier!U;
- else static if (is(T U == shared const U)) alias ModifyTypePreservingTQ = shared const Modifier!U;
- else static if (is(T U == shared U)) alias ModifyTypePreservingTQ = shared Modifier!U;
- else static if (is(T U == inout const U)) alias ModifyTypePreservingTQ = inout const Modifier!U;
- else static if (is(T U == inout U)) alias ModifyTypePreservingTQ = inout Modifier!U;
- else static if (is(T U == const U)) alias ModifyTypePreservingTQ = const Modifier!U;
- else alias ModifyTypePreservingTQ = Modifier!T;
-}
-
-@safe unittest
-{
- alias Intify(T) = int;
- static assert(is(ModifyTypePreservingTQ!(Intify, real) == int));
- static assert(is(ModifyTypePreservingTQ!(Intify, const real) == const int));
- static assert(is(ModifyTypePreservingTQ!(Intify, inout real) == inout int));
- static assert(is(ModifyTypePreservingTQ!(Intify, inout const real) == inout const int));
- static assert(is(ModifyTypePreservingTQ!(Intify, shared real) == shared int));
- static assert(is(ModifyTypePreservingTQ!(Intify, shared const real) == shared const int));
- static assert(is(ModifyTypePreservingTQ!(Intify, shared inout real) == shared inout int));
- static assert(is(ModifyTypePreservingTQ!(Intify, shared inout const real) == shared inout const int));
- static assert(is(ModifyTypePreservingTQ!(Intify, immutable real) == immutable int));
+ import core.internal.traits : _ModifyTypePreservingTQ = ModifyTypePreservingTQ;
+ alias ModifyTypePreservingTQ = _ModifyTypePreservingTQ!(Modifier, T);
}
/**
@@ -8009,20 +7902,8 @@ template ForeachType(T)
*/
template OriginalType(T)
{
- static if (is(T == enum))
- {
- template Impl(T)
- {
- static if (is(T U == enum)) alias Impl = OriginalType!U;
- else alias Impl = T;
- }
-
- alias OriginalType = ModifyTypePreservingTQ!(Impl, T);
- }
- else
- {
- alias OriginalType = T;
- }
+ import core.internal.traits : _OriginalType = OriginalType;
+ alias OriginalType = _OriginalType!T;
}
///
@@ -8158,25 +8039,9 @@ returned.
template Largest(T...)
if (T.length >= 1)
{
- static if (T.length == 1)
- {
- alias Largest = T[0];
- }
- else static if (T.length == 2)
- {
- static if (T[0].sizeof >= T[1].sizeof)
- {
- alias Largest = T[0];
- }
- else
- {
- alias Largest = T[1];
- }
- }
- else
- {
- alias Largest = Largest!(Largest!(T[0 .. $/2]), Largest!(T[$/2 .. $]));
- }
+ alias Largest = T[0];
+ static foreach (U; T[1 .. $])
+ Largest = Select!(U.sizeof > Largest.sizeof, U, Largest);
}
///
@@ -8332,11 +8197,7 @@ Returns the mangled name of symbol or type `sth`.
might be more convenient in generic code, e.g. as a template argument
when invoking staticMap.
*/
-template mangledName(sth...)
-if (sth.length == 1)
-{
- enum string mangledName = sth[0].mangleof;
-}
+enum mangledName(alias sth) = sth.mangleof;
///
@safe unittest
@@ -8451,10 +8312,7 @@ B select(bool cond : false, A, B)(lazy A a, B b) { return b; }
See_Also:
$(LREF getUDAs)
+/
-template hasUDA(alias symbol, alias attribute)
-{
- enum hasUDA = getUDAs!(symbol, attribute).length != 0;
-}
+enum hasUDA(alias symbol, alias attribute) = getUDAs!(symbol, attribute).length != 0;
///
@safe unittest
@@ -8941,28 +8799,22 @@ private template getSymbolsByUDAImpl(alias symbol, alias attribute, names...)
}
/**
- Returns: `true` iff all types `T` are the same.
+ Returns: `true` iff all types `Ts` are the same.
*/
-template allSameType(T...)
+enum bool allSameType(Ts...) =
{
- static foreach (idx, Ti; T)
- {
- static if (idx + 1 < T.length &&
- !is(typeof(allSameType) == bool) &&
- !is(T[idx] == T[idx + 1]))
- {
- enum bool allSameType = false;
- }
- }
- static if (!is(typeof(allSameType) == bool))
- {
- enum bool allSameType = true;
- }
-}
+ static foreach (T; Ts[Ts.length > 1 .. $])
+ static if (!is(Ts[0] == T))
+ if (__ctfe) // Dodge the "statement is unreachable" warning
+ return false;
+ return true;
+}();
///
@safe unittest
{
+ static assert(allSameType!());
+ static assert(allSameType!(int));
static assert(allSameType!(int, int));
static assert(allSameType!(int, int, int));
static assert(allSameType!(float, float, float));
@@ -8993,11 +8845,7 @@ enum ifTestable(T, alias pred = a => a) = __traits(compiles, { if (pred(T.init))
* Returns:
* `true` if `X` is a type, `false` otherwise
*/
-template isType(X...)
-if (X.length == 1)
-{
- enum isType = is(X[0]);
-}
+enum isType(alias X) = is(X);
///
@safe unittest
@@ -9037,16 +8885,15 @@ if (X.length == 1)
* Use $(LREF isFunctionPointer) or $(LREF isDelegate) for detecting those types
* respectively.
*/
-template isFunction(X...)
-if (X.length == 1)
+template isFunction(alias X)
{
- static if (is(typeof(&X[0]) U : U*) && is(U == function) ||
- is(typeof(&X[0]) U == delegate))
+ static if (is(typeof(&X) U : U*) && is(U == function) ||
+ is(typeof(&X) U == delegate))
{
// x is a (nested) function symbol.
enum isFunction = true;
}
- else static if (is(X[0] T))
+ else static if (is(X T))
{
// x is a type. Take the type of it and examine.
enum isFunction = is(T == function);
@@ -9074,13 +8921,12 @@ if (X.length == 1)
* Returns:
* `true` if `X` is final, `false` otherwise
*/
-template isFinal(X...)
-if (X.length == 1)
+template isFinal(alias X)
{
- static if (is(X[0] == class))
- enum isFinal = __traits(isFinalClass, X[0]);
+ static if (is(X == class))
+ enum isFinal = __traits(isFinalClass, X);
else static if (isFunction!X)
- enum isFinal = __traits(isFinalFunction, X[0]);
+ enum isFinal = __traits(isFinalFunction, X);
else
enum isFinal = false;
}
diff --git a/libphobos/src/std/typecons.d b/libphobos/src/std/typecons.d
index feedf90..db0e3da 100644
--- a/libphobos/src/std/typecons.d
+++ b/libphobos/src/std/typecons.d
@@ -448,6 +448,90 @@ private enum bool distinctFieldNames(names...) = __traits(compiles,
static assert(!distinctFieldNames!(int, "int"));
}
+
+// Parse (type,name) pairs (FieldSpecs) out of the specified
+// arguments. Some fields would have name, others not.
+private template parseSpecs(Specs...)
+{
+ static if (Specs.length == 0)
+ {
+ alias parseSpecs = AliasSeq!();
+ }
+ else static if (is(Specs[0]))
+ {
+ static if (is(typeof(Specs[1]) : string))
+ {
+ alias parseSpecs =
+ AliasSeq!(FieldSpec!(Specs[0 .. 2]),
+ parseSpecs!(Specs[2 .. $]));
+ }
+ else
+ {
+ alias parseSpecs =
+ AliasSeq!(FieldSpec!(Specs[0]),
+ parseSpecs!(Specs[1 .. $]));
+ }
+ }
+ else
+ {
+ static assert(0, "Attempted to instantiate Tuple with an "
+ ~"invalid argument: "~ Specs[0].stringof);
+ }
+}
+
+private template FieldSpec(T, string s = "")
+{
+ alias Type = T;
+ alias name = s;
+}
+
+// Used with staticMap.
+private alias extractType(alias spec) = spec.Type;
+private alias extractName(alias spec) = spec.name;
+private template expandSpec(alias spec)
+{
+ static if (spec.name.length == 0)
+ alias expandSpec = AliasSeq!(spec.Type);
+ else
+ alias expandSpec = AliasSeq!(spec.Type, spec.name);
+}
+
+
+private enum areCompatibleTuples(Tup1, Tup2, string op) =
+ isTuple!(OriginalType!Tup2) && Tup1.Types.length == Tup2.Types.length && is(typeof(
+ (ref Tup1 tup1, ref Tup2 tup2)
+ {
+ static foreach (i; 0 .. Tup1.Types.length)
+ {{
+ auto lhs = typeof(tup1.field[i]).init;
+ auto rhs = typeof(tup2.field[i]).init;
+ static if (op == "=")
+ lhs = rhs;
+ else
+ auto result = mixin("lhs "~op~" rhs");
+ }}
+ }));
+
+private enum areBuildCompatibleTuples(Tup1, Tup2) =
+ isTuple!Tup2 && Tup1.Types.length == Tup2.Types.length && is(typeof(
+ {
+ static foreach (i; 0 .. Tup1.Types.length)
+ static assert(isBuildable!(Tup1.Types[i], Tup2.Types[i]));
+ }));
+
+// Returns `true` iff a `T` can be initialized from a `U`.
+private enum isBuildable(T, U) = is(typeof(
+ {
+ U u = U.init;
+ T t = u;
+ }));
+// Helper for partial instantiation
+private template isBuildableFrom(U)
+{
+ enum isBuildableFrom(T) = isBuildable!(T, U);
+}
+
+
/**
_Tuple of values, for example $(D Tuple!(int, string)) is a record that
stores an `int` and a `string`. `Tuple` can be used to bundle
@@ -466,48 +550,8 @@ if (distinctFieldNames!(Specs))
{
import std.meta : staticMap;
- // Parse (type,name) pairs (FieldSpecs) out of the specified
- // arguments. Some fields would have name, others not.
- template parseSpecs(Specs...)
- {
- static if (Specs.length == 0)
- {
- alias parseSpecs = AliasSeq!();
- }
- else static if (is(Specs[0]))
- {
- static if (is(typeof(Specs[1]) : string))
- {
- alias parseSpecs =
- AliasSeq!(FieldSpec!(Specs[0 .. 2]),
- parseSpecs!(Specs[2 .. $]));
- }
- else
- {
- alias parseSpecs =
- AliasSeq!(FieldSpec!(Specs[0]),
- parseSpecs!(Specs[1 .. $]));
- }
- }
- else
- {
- static assert(0, "Attempted to instantiate Tuple with an "
- ~"invalid argument: "~ Specs[0].stringof);
- }
- }
-
- template FieldSpec(T, string s = "")
- {
- alias Type = T;
- alias name = s;
- }
-
alias fieldSpecs = parseSpecs!Specs;
- // Used with staticMap.
- alias extractType(alias spec) = spec.Type;
- alias extractName(alias spec) = spec.name;
-
// Generates named fields as follows:
// alias name_0 = Identity!(field[0]);
// alias name_1 = Identity!(field[1]);
@@ -534,52 +578,6 @@ if (distinctFieldNames!(Specs))
alias sliceSpecs(size_t from, size_t to) =
staticMap!(expandSpec, fieldSpecs[from .. to]);
- template expandSpec(alias spec)
- {
- static if (spec.name.length == 0)
- {
- alias expandSpec = AliasSeq!(spec.Type);
- }
- else
- {
- alias expandSpec = AliasSeq!(spec.Type, spec.name);
- }
- }
-
- enum areCompatibleTuples(Tup1, Tup2, string op) = isTuple!(OriginalType!Tup2) && is(typeof(
- (ref Tup1 tup1, ref Tup2 tup2)
- {
- static assert(tup1.field.length == tup2.field.length);
- static foreach (i; 0 .. Tup1.Types.length)
- {{
- auto lhs = typeof(tup1.field[i]).init;
- auto rhs = typeof(tup2.field[i]).init;
- static if (op == "=")
- lhs = rhs;
- else
- auto result = mixin("lhs "~op~" rhs");
- }}
- }));
-
- enum areBuildCompatibleTuples(Tup1, Tup2) = isTuple!Tup2 && is(typeof(
- {
- static assert(Tup1.Types.length == Tup2.Types.length);
- static foreach (i; 0 .. Tup1.Types.length)
- static assert(isBuildable!(Tup1.Types[i], Tup2.Types[i]));
- }));
-
- /+ Returns `true` iff a `T` can be initialized from a `U`. +/
- enum isBuildable(T, U) = is(typeof(
- {
- U u = U.init;
- T t = u;
- }));
- /+ Helper for partial instantiation +/
- template isBuildableFrom(U)
- {
- enum isBuildableFrom(T) = isBuildable!(T, U);
- }
-
struct Tuple
{
/**
@@ -1359,8 +1357,7 @@ if (distinctFieldNames!(Specs))
}
///
- static if (Types.length == 0)
- @safe unittest
+ static if (Specs.length == 0) @safe unittest
{
import std.format : format;
@@ -1381,8 +1378,7 @@ if (distinctFieldNames!(Specs))
}
///
- static if (Types.length == 0)
- @safe unittest
+ static if (Specs.length == 0) @safe unittest
{
import std.exception : assertThrown;
import std.format : format, FormatException;
@@ -2762,7 +2758,11 @@ struct Nullable(T)
{
private union DontCallDestructorT
{
- T payload;
+ import std.traits : hasIndirections;
+ static if (hasIndirections!T)
+ T payload;
+ else
+ T payload = void;
}
private DontCallDestructorT _value = DontCallDestructorT.init;
@@ -3020,7 +3020,7 @@ struct Nullable(T)
if (_isNull)
{
- // trusted since payload is known to be T.init here.
+ // trusted since payload is known to be uninitialized.
() @trusted { moveEmplace(copy.payload, _value.payload); }();
}
else
@@ -6850,9 +6850,10 @@ RefCounted!(T, RefCountedAutoInitialize.no) refCounted(T)(T val)
{
static struct File
{
+ static size_t nDestroyed;
string name;
@disable this(this); // not copyable
- ~this() { name = null; }
+ ~this() { name = null; ++nDestroyed; }
}
auto file = File("name");
@@ -6860,14 +6861,37 @@ RefCounted!(T, RefCountedAutoInitialize.no) refCounted(T)(T val)
// file cannot be copied and has unique ownership
static assert(!__traits(compiles, {auto file2 = file;}));
+ assert(File.nDestroyed == 0);
+
// make the file refcounted to share ownership
- import std.algorithm.mutation : move;
- auto rcFile = refCounted(move(file));
- assert(rcFile.name == "name");
- assert(file.name == null);
- auto rcFile2 = rcFile;
- assert(rcFile.refCountedStore.refCount == 2);
- // file gets properly closed when last reference is dropped
+ // Note:
+ // We write a compound statement (brace-delimited scope) in which all `RefCounted!File` handles are created and deleted.
+ // This allows us to see (after the scope) what happens after all handles have been destroyed.
+ {
+ // We move the content of `file` to a separate (and heap-allocated) `File` object,
+ // managed-and-accessed via one-or-multiple (initially: one) `RefCounted!File` objects ("handles").
+ // This "moving":
+ // (1) invokes `file`'s destructor (=> `File.nDestroyed` is incremented from 0 to 1 and `file.name` becomes `null`);
+ // (2) overwrites `file` with `File.init` (=> `file.name` becomes `null`).
+ // It appears that writing `name = null;` in the destructor is redundant,
+ // but please note that (2) is only performed if `File` defines a destructor (or post-blit operator),
+ // and in the absence of the `nDestroyed` instrumentation there would have been no reason to define a destructor.
+ import std.algorithm.mutation : move;
+ auto rcFile = refCounted(move(file));
+ assert(rcFile.name == "name");
+ assert(File.nDestroyed == 1);
+ assert(file.name == null);
+
+ // We create another `RefCounted!File` handle to the same separate `File` object.
+ // While any of the handles is still alive, the `File` object is kept alive (=> `File.nDestroyed` is not modified).
+ auto rcFile2 = rcFile;
+ assert(rcFile.refCountedStore.refCount == 2);
+ assert(File.nDestroyed == 1);
+ }
+ // The separate `File` object is deleted when the last `RefCounted!File` handle is destroyed
+ // (i.e. at the closing brace of the compound statement above, which destroys both handles: `rcFile` and `rcFile2`)
+ // (=> `File.nDestroyed` is incremented again, from 1 to 2):
+ assert(File.nDestroyed == 2);
}
/**
@@ -9086,9 +9110,14 @@ template ReplaceTypeUnless(alias pred, From, To, T...)
{
template replaceTemplateArgs(T...)
{
- static if (is(typeof(T[0]))) // template argument is value or symbol
- enum replaceTemplateArgs = T[0];
- else
+ static if (is(typeof(T[0]))) { // template argument is value or symbol
+ static if (__traits(compiles, { alias _ = T[0]; }))
+ // it's a symbol
+ alias replaceTemplateArgs = T[0];
+ else
+ // it's a value
+ enum replaceTemplateArgs = T[0];
+ } else
alias replaceTemplateArgs = ReplaceTypeUnless!(pred, From, To, T[0]);
}
alias ReplaceTypeUnless = U!(staticMap!(replaceTemplateArgs, V));
@@ -9341,6 +9370,14 @@ private template replaceTypeInFunctionTypeUnless(alias pred, From, To, fun)
static assert(is(ReplaceType!(int, string, C) == C));
}
+// https://issues.dlang.org/show_bug.cgi?id=22325
+@safe unittest
+{
+ static struct Foo(alias f) {}
+ static void bar() {}
+ alias _ = ReplaceType!(int, int, Foo!bar);
+}
+
/**
Ternary type with three truth values:
diff --git a/libphobos/src/std/uni/package.d b/libphobos/src/std/uni/package.d
index 318bcb3..45b7207c 100644
--- a/libphobos/src/std/uni/package.d
+++ b/libphobos/src/std/uni/package.d
@@ -1528,7 +1528,7 @@ if (is(Unqual!T == T))
return SliceOverIndexed!T(a, b, x);
}
-@system unittest
+@safe unittest
{
int[] idxArray = [2, 3, 5, 8, 13];
auto sliced = sliceOverIndexed(0, idxArray.length, &idxArray);
@@ -3116,7 +3116,7 @@ private:
CowArray!SP data;
}
-pure @system unittest
+pure @safe unittest
{
import std.conv : to;
assert(unicode.ASCII.to!string() == "[0..128)");
@@ -5410,7 +5410,7 @@ pure @safe unittest
}
// cover decode fail cases of Matcher
-pure @system unittest
+pure @safe unittest
{
import std.algorithm.iteration : map;
import std.exception : collectException;
@@ -5427,7 +5427,7 @@ pure @system unittest
auto s = msg;
size_t idx = 0;
utf8.test(s);
- }()), format("%( %2x %)", cast(ubyte[]) msg));
+ }()), format("%( %2x %)", cast(immutable(ubyte)[]) msg));
}
//decode failure cases UTF-16
alias fails16 = AliasSeq!([0xD811], [0xDC02]);
@@ -7150,7 +7150,7 @@ if (isInputRange!Input && is(immutable ElementType!Input == immutable dchar))
return genericDecodeGrapheme!true(inp);
}
-@system unittest
+@safe unittest
{
import std.algorithm.comparison : equal;
@@ -7233,7 +7233,7 @@ if (isInputRange!Range && is(immutable ElementType!Range == immutable dchar))
// For testing non-forward-range input ranges
version (StdUnittest)
-private static struct InputRangeString
+private static @safe struct InputRangeString
{
private string s;
@@ -7242,7 +7242,7 @@ private static struct InputRangeString
void popFront() { s.popFront(); }
}
-@system unittest
+@safe unittest
{
import std.algorithm.comparison : equal;
import std.array : array;
@@ -7366,7 +7366,7 @@ if (isInputRange!Range && is(immutable ElementType!Range == immutable dchar))
assert(reverse == "le\u0308on"); // lëon
}
-@system unittest
+@safe unittest
{
import std.algorithm.comparison : equal;
import std.range.primitives : walkLength;
@@ -7523,7 +7523,7 @@ public:
}
///
- @system unittest
+ @safe unittest
{
import std.algorithm.comparison : equal;
auto g = Grapheme("A");
@@ -7650,7 +7650,7 @@ private:
static assert(Grapheme.sizeof == size_t.sizeof*4);
-@system pure /*nothrow @nogc*/ unittest // TODO: string .front is GC and throw
+@safe pure /*nothrow @nogc*/ unittest // TODO: string .front is GC and throw
{
import std.algorithm.comparison : equal;
Grapheme[3] data = [Grapheme("Ю"), Grapheme("У"), Grapheme("З")];
@@ -7658,7 +7658,7 @@ static assert(Grapheme.sizeof == size_t.sizeof*4);
}
///
-@system unittest
+@safe unittest
{
import std.algorithm.comparison : equal;
import std.algorithm.iteration : filter;
@@ -7704,7 +7704,7 @@ static assert(Grapheme.sizeof == size_t.sizeof*4);
assert(!g.valid);
}
-@system unittest
+@safe unittest
{
import std.algorithm.comparison : equal;
import std.algorithm.iteration : map;
@@ -8205,7 +8205,7 @@ package(std) auto simpleCaseFoldings(dchar ch) @safe
return Range(start, entry.size);
}
-@system unittest
+@safe unittest
{
import std.algorithm.comparison : equal;
import std.algorithm.searching : canFind;
@@ -8356,7 +8356,7 @@ public Grapheme decompose(UnicodeDecomposition decompType=Canonical)(dchar ch) @
}
///
-@system unittest
+@safe unittest
{
import std.algorithm.comparison : equal;
@@ -8464,7 +8464,7 @@ Grapheme decomposeHangul(dchar ch) @safe
}
///
-@system unittest
+@safe unittest
{
import std.algorithm.comparison : equal;
assert(decomposeHangul('\uD4DB')[].equal("\u1111\u1171\u11B6"));
@@ -8504,7 +8504,7 @@ dchar composeJamo(dchar lead, dchar vowel, dchar trailing=dchar.init) pure nothr
assert(composeJamo('A', '\u1171') == dchar.init);
}
-@system unittest
+@safe unittest
{
import std.algorithm.comparison : equal;
import std.conv : text;
@@ -10105,7 +10105,7 @@ if (isSomeString!S || (isRandomAccessRange!S && hasLength!S && hasSlicing!S && i
assert(s2 !is s1);
}
-@system unittest
+@safe unittest
{
static void doTest(C)(const(C)[] s, const(C)[] trueUp, const(C)[] trueLow)
{
@@ -10118,9 +10118,9 @@ if (isSomeString!S || (isRandomAccessRange!S && hasLength!S && hasSlicing!S && i
assert(low == trueLow, format(diff, low, trueLow));
assert(up == trueUp, format(diff, up, trueUp));
assert(lowInp == trueLow,
- format(diff, cast(ubyte[]) s, cast(ubyte[]) lowInp, cast(ubyte[]) trueLow));
+ format(diff, cast(const(ubyte)[]) s, cast(const(ubyte)[]) lowInp, cast(const(ubyte)[]) trueLow));
assert(upInp == trueUp,
- format(diff, cast(ubyte[]) s, cast(ubyte[]) upInp, cast(ubyte[]) trueUp));
+ format(diff, cast(const(ubyte)[]) s, cast(const(ubyte)[]) upInp, cast(const(ubyte)[]) trueUp));
}
static foreach (S; AliasSeq!(dstring, wstring, string))
{{
diff --git a/libphobos/src/std/variant.d b/libphobos/src/std/variant.d
index 953d6ea..ce635fb 100644
--- a/libphobos/src/std/variant.d
+++ b/libphobos/src/std/variant.d
@@ -78,7 +78,7 @@ import std.meta, std.traits, std.typecons;
/++
Gives the `sizeof` the largest type given.
- See_Also: https://forum.dlang.org/thread/wbpnncxepehgcswhuazl@forum.dlang.org?page=1
+ See_Also: $(LINK https://forum.dlang.org/thread/wbpnncxepehgcswhuazl@forum.dlang.org?page=1)
+/
template maxSize(Ts...)
{
diff --git a/libphobos/src/std/windows/registry.d b/libphobos/src/std/windows/registry.d
index cdf37c1..d66adff 100644
--- a/libphobos/src/std/windows/registry.d
+++ b/libphobos/src/std/windows/registry.d
@@ -881,7 +881,6 @@ public:
return new ValueNameSequence(this);
}
-public:
/**
Returns the named sub-key of this key.
@@ -1412,7 +1411,6 @@ public:
return getKeyName(index);
}
-public:
///
int opApply(scope int delegate(ref string name) dg)
{
@@ -1509,7 +1507,6 @@ public:
return getKey(index);
}
-public:
///
int opApply(scope int delegate(ref Key key) dg)
{
@@ -1618,7 +1615,6 @@ public:
return getValueName(index);
}
-public:
///
int opApply(scope int delegate(ref string name) dg)
{
@@ -1712,7 +1708,6 @@ public:
return getValue(index);
}
-public:
///
int opApply(scope int delegate(ref Value value) dg)
{
diff --git a/libphobos/testsuite/libphobos.betterc/test22336.d b/libphobos/testsuite/libphobos.betterc/test22336.d
new file mode 100644
index 0000000..de0e31d
--- /dev/null
+++ b/libphobos/testsuite/libphobos.betterc/test22336.d
@@ -0,0 +1,19 @@
+/*******************************************/
+// https://issues.dlang.org/show_bug.cgi?id=22336
+
+import core.lifetime;
+
+struct Foo {
+ int f = -1;
+ @disable this(this);
+ this(int x) { f = x; }
+ @disable this();
+}
+
+extern(C) int main() {
+ Foo a = Foo(42);
+ Foo b = move(a);
+ assert(a.f == -1);
+ assert(b.f == 42);
+ return 0;
+}
diff --git a/libphobos/testsuite/libphobos.exceptions/assert_fail.d b/libphobos/testsuite/libphobos.exceptions/assert_fail.d
index 79b3cb8..352ccca3 100644
--- a/libphobos/testsuite/libphobos.exceptions/assert_fail.d
+++ b/libphobos/testsuite/libphobos.exceptions/assert_fail.d
@@ -426,6 +426,18 @@ void testShared()
import core.atomic : atomicLoad;
static assert( __traits(compiles, atomicLoad(s1)));
static assert(!__traits(compiles, atomicLoad(b1)));
+
+ static struct Fail
+ {
+ int value;
+
+ @safe pure nothrow @nogc:
+ bool opCast () shared const scope { return true; }
+ }
+
+ shared Fail fail = { value: 1 };
+ assert(_d_assert_fail!(shared Fail)("==", fail) == "Fail(1) != true");
+ assert(_d_assert_fail!(shared Fail)("==", fail, fail) == "Fail(1) != Fail(1)");
}
void testException()