aboutsummaryrefslogtreecommitdiff
path: root/libphobos/libdruntime
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2021-12-10 03:14:20 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2021-12-10 05:25:41 +0100
commit9c7d5e8846edb28e5421211ee8eaad93e234de2c (patch)
tree36b78f03305b82ef82ec5ecfaf29844fadd86ddc /libphobos/libdruntime
parent38c60e5075f89265a560eab166d43247624a7535 (diff)
downloadgcc-9c7d5e8846edb28e5421211ee8eaad93e234de2c.zip
gcc-9c7d5e8846edb28e5421211ee8eaad93e234de2c.tar.gz
gcc-9c7d5e8846edb28e5421211ee8eaad93e234de2c.tar.bz2
d: Merge upstream dmd 3982604c5, druntime bc58b1e9, phobos 12329adb6.
D front-end changes: - Import dmd mainline development. - Split off enum EXP from enum TOK. - Integer promotions now follow C integral promotions by default. - Implements __traits(initSymbol). - Lowering of array construction has been moved to the dmd front-end. - Fix segfault in dmd.lexer from unaligned read (PR103529). Druntime changes: - Import druntime mainline development. - Define SIG_BLOCK for Solaris (PR103528). Phobos changes: - Import phobos mainline development. gcc/d/ChangeLog: PR d/103529 * dmd/MERGE: Merge upstream dmd 3982604c5. * Make-lang.in (D_FRONTEND_OBJS): Add d/root-optional.o. * d-attribs.cc (build_attributes): Update for new front-end interface. * d-codegen.cc (d_build_call): Likewise. * d-compiler.cc (Compiler::paintAsType): Likewise. * d-lang.cc (d_handle_option): Remove OPT_fpreview_intpromote, add handling of OPT_frevert_intpromote. * d-port.cc (Port::valcpy): Assert buffer is aligned. * d-target.cc (Target::isVectorOpSupported): Update for new front-end interface. * decl.cc (layout_class_initializer): Likewise. * expr.cc (lvalue_p): Likewise. (binop_assignment): Likewise. (ExprVisitor::visit): Likewise. (ExprVisitor::visit (AssignExp *)): Remove generation of _d_arrayctor and _d_arraysetctor library helpers. (ExprVisitor::visit (VarExp *)): Support __traits(initSymbol). * intrinsics.cc (expand_intrinsic_rotate): Update for new front-end interface. * lang.opt (fpreview=intpromote): Remove. (frevert=intpromote): New. * runtime.def (ARRAYCTOR): Remove. (ARRAYSETCTOR): Remove. * toir.cc (IRVisitor::visit): Update for new front-end interface. * types.cc (layout_aggregate_members): Likewise. * dmd/root/optional.d: New file. * dmd/root/optional.h: New file. libphobos/ChangeLog: PR d/103528 * libdruntime/MERGE: Merge upstream druntime bc58b1e9. * libdruntime/Makefile.am (DRUNTIME_DSOURCES_LINUX): Remove core/sys/linux/syscalls.d. * libdruntime/Makefile.in: Regenerate. * src/MERGE: Merge upstream phobos 12329adb6. * testsuite/libphobos.config/config.exp: Add test22523. * libdruntime/core/sys/linux/syscalls.d: Removed. * testsuite/libphobos.config/test22523.d: New test.
Diffstat (limited to 'libphobos/libdruntime')
-rw-r--r--libphobos/libdruntime/MERGE2
-rw-r--r--libphobos/libdruntime/Makefile.am5
-rw-r--r--libphobos/libdruntime/Makefile.in12
-rw-r--r--libphobos/libdruntime/core/demangle.d8
-rw-r--r--libphobos/libdruntime/core/internal/array/construction.d43
-rw-r--r--libphobos/libdruntime/core/internal/convert.d8
-rw-r--r--libphobos/libdruntime/core/internal/lifetime.d49
-rw-r--r--libphobos/libdruntime/core/internal/string.d2
-rw-r--r--libphobos/libdruntime/core/internal/utf.d10
-rw-r--r--libphobos/libdruntime/core/lifetime.d111
-rw-r--r--libphobos/libdruntime/core/memory.d21
-rw-r--r--libphobos/libdruntime/core/stdc/stdlib.d10
-rw-r--r--libphobos/libdruntime/core/stdc/string.d28
-rw-r--r--libphobos/libdruntime/core/stdc/wchar_.d26
-rw-r--r--libphobos/libdruntime/core/stdcpp/exception.d2
-rw-r--r--libphobos/libdruntime/core/sync/mutex.d4
-rw-r--r--libphobos/libdruntime/core/sys/bionic/string.d2
-rw-r--r--libphobos/libdruntime/core/sys/darwin/mach/nlist.d2
-rw-r--r--libphobos/libdruntime/core/sys/darwin/string.d2
-rw-r--r--libphobos/libdruntime/core/sys/dragonflybsd/string.d2
-rw-r--r--libphobos/libdruntime/core/sys/freebsd/string.d2
-rw-r--r--libphobos/libdruntime/core/sys/linux/string.d2
-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/netbsd/string.d2
-rw-r--r--libphobos/libdruntime/core/sys/openbsd/string.d2
-rw-r--r--libphobos/libdruntime/core/sys/posix/signal.d26
-rw-r--r--libphobos/libdruntime/core/sys/posix/string.d8
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/socket.d2
-rw-r--r--libphobos/libdruntime/core/sys/solaris/sys/elf.d5
-rw-r--r--libphobos/libdruntime/core/sys/solaris/sys/elf_386.d3
-rw-r--r--libphobos/libdruntime/core/sys/solaris/sys/elf_SPARC.d3
-rw-r--r--libphobos/libdruntime/core/sys/windows/dbghelp.d8
-rw-r--r--libphobos/libdruntime/core/thread/osthread.d5
-rw-r--r--libphobos/libdruntime/core/thread/threadbase.d5
-rw-r--r--libphobos/libdruntime/object.d8
-rw-r--r--libphobos/libdruntime/rt/aaA.d4
-rw-r--r--libphobos/libdruntime/rt/cast_.d2
-rw-r--r--libphobos/libdruntime/rt/config.d3
-rw-r--r--libphobos/libdruntime/rt/lifetime.d4
-rw-r--r--libphobos/libdruntime/rt/monitor_.d2
41 files changed, 291 insertions, 925 deletions
diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE
index d0d3a25..edb1017 100644
--- a/libphobos/libdruntime/MERGE
+++ b/libphobos/libdruntime/MERGE
@@ -1,4 +1,4 @@
-178c44ff362902af589603767055cfac89215652
+bc58b1e9ea68051af9094651a26313371297b79f
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 44d4fe1..224d06e 100644
--- a/libphobos/libdruntime/Makefile.am
+++ b/libphobos/libdruntime/Makefile.am
@@ -280,9 +280,8 @@ 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/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
+ 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 \
diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in
index 84be808..bb936dd 100644
--- a/libphobos/libdruntime/Makefile.in
+++ b/libphobos/libdruntime/Makefile.in
@@ -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/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
+ 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,9 +944,8 @@ 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/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
+ 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 \
@@ -1675,7 +1674,6 @@ 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 33ca0ddc..1915fb0 100644
--- a/libphobos/libdruntime/core/demangle.d
+++ b/libphobos/libdruntime/core/demangle.d
@@ -54,13 +54,13 @@ pure @safe:
enum AddType { no, yes }
- this( return const(char)[] buf_, return char[] dst_ = null )
+ this( return scope const(char)[] buf_, return scope char[] dst_ = null )
{
this( buf_, AddType.yes, dst_ );
}
- this( return const(char)[] buf_, AddType addType_, return char[] dst_ = null )
+ this( return scope const(char)[] buf_, AddType addType_, return scope char[] dst_ = null )
{
buf = buf_;
addType = addType_;
@@ -105,7 +105,7 @@ pure @safe:
//throw new ParseException( msg );
debug(info) printf( "error: %.*s\n", cast(int) msg.length, msg.ptr );
throw __ctfe ? new ParseException(msg)
- : cast(ParseException) cast(void*) typeid(ParseException).initializer;
+ : cast(ParseException) __traits(initSymbol, ParseException).ptr;
}
@@ -116,7 +116,7 @@ pure @safe:
//throw new OverflowException( msg );
debug(info) printf( "overflow: %.*s\n", cast(int) msg.length, msg.ptr );
- throw cast(OverflowException) cast(void*) typeid(OverflowException).initializer;
+ throw cast(OverflowException) __traits(initSymbol, OverflowException).ptr;
}
diff --git a/libphobos/libdruntime/core/internal/array/construction.d b/libphobos/libdruntime/core/internal/array/construction.d
index 9c82237..ae71f51 100644
--- a/libphobos/libdruntime/core/internal/array/construction.d
+++ b/libphobos/libdruntime/core/internal/array/construction.d
@@ -14,16 +14,27 @@ 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
+ * makeWeaklyPure = unused; its purpose is to prevent the function from becoming
+ * strongly pure and risk being optimised out
* Returns:
* 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.
+ *
+ * The third parameter is never used, but is necessary in order for the
+ * function be treated as weakly pure, instead of strongly pure.
+ * This is needed because constructions such as the one below can be ignored by
+ * the compiler if `_d_arrayctor` is believed to be pure, because purity would
+ * mean the call to `_d_arrayctor` has no effects (no side effects and the
+ * return value is ignored), despite it actually modifying the contents of `a`.
+ * const S[2] b;
+ * const S[2] a = b; // this would get lowered to _d_arrayctor(a, b)
*/
-Tarr1 _d_arrayctor(Tarr1 : T1[], Tarr2 : T2[], T1, T2)(scope Tarr2 from) @trusted
- if (is(Unqual!T1 == Unqual!T2))
+Tarr _d_arrayctor(Tarr : T[], T)(return scope Tarr to, scope Tarr from, char* makeWeaklyPure = null) @trusted
{
pragma(inline, false);
import core.internal.traits : hasElaborateCopyConstructor;
@@ -32,14 +43,12 @@ Tarr1 _d_arrayctor(Tarr1 : T1[], Tarr2 : T2[], T1, T2)(scope Tarr2 from) @truste
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);
+ debug(PRINTF) printf("_d_arrayctor(from = %p,%d) size = %d\n", from.ptr, from.length, T.sizeof);
- Tarr1 to = void;
+ void[] vFrom = (cast(void*) from.ptr)[0..from.length];
+ void[] vTo = (cast(void*) to.ptr)[0..to.length];
- void[] vFrom = (cast(void*)from.ptr)[0..from.length];
- void[] vTo = (cast(void*)to.ptr)[0..to.length];
-
- // Force `enforceRawArraysConformable` to be `pure`
+ // Force `enforceRawArraysConformable` to remain weakly `pure`
void enforceRawArraysConformable(const char[] action, const size_t elementSize,
const void[] a1, const void[] a2) @trusted
{
@@ -50,9 +59,9 @@ Tarr1 _d_arrayctor(Tarr1 : T1[], Tarr2 : T2[], T1, T2)(scope Tarr2 from) @truste
(cast(Type)&enforceRawArraysConformableNogc)(action, elementSize, a1, a2, false);
}
- enforceRawArraysConformable("initialization", T1.sizeof, vFrom, vTo);
+ enforceRawArraysConformable("initialization", T.sizeof, vFrom, vTo);
- static if (hasElaborateCopyConstructor!T1)
+ static if (hasElaborateCopyConstructor!T)
{
size_t i;
try
@@ -66,7 +75,7 @@ Tarr1 _d_arrayctor(Tarr1 : T1[], Tarr2 : T2[], T1, T2)(scope Tarr2 from) @truste
*/
while (i--)
{
- auto elem = cast(Unqual!T1*)&to[i];
+ auto elem = cast(Unqual!T*) &to[i];
destroy(*elem);
}
@@ -76,7 +85,7 @@ Tarr1 _d_arrayctor(Tarr1 : T1[], Tarr2 : T2[], T1, T2)(scope Tarr2 from) @truste
else
{
// blit all elements at once
- memcpy(cast(void*) to.ptr, from.ptr, to.length * T1.sizeof);
+ memcpy(cast(void*) to.ptr, from.ptr, to.length * T.sizeof);
}
return to;
@@ -94,7 +103,7 @@ Tarr1 _d_arrayctor(Tarr1 : T1[], Tarr2 : T2[], T1, T2)(scope Tarr2 from) @truste
S[4] arr1;
S[4] arr2 = [S(0), S(1), S(2), S(3)];
- arr1 = _d_arrayctor!(typeof(arr1))(arr2[]);
+ _d_arrayctor(arr1[], arr2[]);
assert(counter == 4);
assert(arr1 == arr2);
@@ -117,7 +126,7 @@ Tarr1 _d_arrayctor(Tarr1 : T1[], Tarr2 : T2[], T1, T2)(scope Tarr2 from) @truste
S[4] arr1;
S[4] arr2 = [S(0), S(1), S(2), S(3)];
- arr1 = _d_arrayctor!(typeof(arr1))(arr2[]);
+ _d_arrayctor(arr1[], arr2[]);
assert(counter == 4);
assert(arr1 == arr2);
@@ -143,7 +152,7 @@ Tarr1 _d_arrayctor(Tarr1 : T1[], Tarr2 : T2[], T1, T2)(scope Tarr2 from) @truste
{
Throw[4] a;
Throw[4] b = [Throw(1), Throw(2), Throw(3), Throw(4)];
- a = _d_arrayctor!(typeof(a))(b[]);
+ _d_arrayctor(a[], b[]);
}
catch (Exception)
{
@@ -168,7 +177,7 @@ Tarr1 _d_arrayctor(Tarr1 : T1[], Tarr2 : T2[], T1, T2)(scope Tarr2 from) @truste
{
NoThrow[4] a;
NoThrow[4] b = [NoThrow(1), NoThrow(2), NoThrow(3), NoThrow(4)];
- a = _d_arrayctor!(typeof(a))(b[]);
+ _d_arrayctor(a[], b[]);
}
catch (Exception)
{
@@ -274,7 +283,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)];
- a = _d_arrayctor!(typeof(a))(b[]);
+ _d_arrayctor(a[], b[]);
}
catch (Exception)
{
diff --git a/libphobos/libdruntime/core/internal/convert.d b/libphobos/libdruntime/core/internal/convert.d
index 2789d29..a876fcc 100644
--- a/libphobos/libdruntime/core/internal/convert.d
+++ b/libphobos/libdruntime/core/internal/convert.d
@@ -801,7 +801,7 @@ const(ubyte)[] toUbyte(T)(const ref T val) if (is(T == delegate) || is(T : V*, V
}
@trusted pure nothrow @nogc
-const(ubyte)[] toUbyte(T)(const ref return scope T val) if (is(T == struct) || is(T == union))
+const(ubyte)[] toUbyte(T)(const return ref scope T val) if (is(T == struct) || is(T == union))
{
if (__ctfe)
{
@@ -826,7 +826,11 @@ const(ubyte)[] toUbyte(T)(const ref return scope T val) if (is(T == struct) || i
}
else
{
- return (cast(const(ubyte)*)&val)[0 .. T.sizeof];
+ // We're escaping a reference to `val` here because we cannot express
+ // ref return + scope, it's currently seen as ref + return scope
+ // https://issues.dlang.org/show_bug.cgi?id=22541
+ // Once fixed, the @system lambda should be removed
+ return (() @system => (cast(const(ubyte)*)&val)[0 .. T.sizeof])();
}
}
diff --git a/libphobos/libdruntime/core/internal/lifetime.d b/libphobos/libdruntime/core/internal/lifetime.d
index 7e9b5f2..a7446de 100644
--- a/libphobos/libdruntime/core/internal/lifetime.d
+++ b/libphobos/libdruntime/core/internal/lifetime.d
@@ -89,44 +89,35 @@ Emplaces T.init.
In contrast to `emplaceRef(chunk)`, there are no checks for disabled default
constructors etc.
+/
-template emplaceInitializer(T)
+void emplaceInitializer(T)(scope ref T chunk) nothrow pure @trusted
if (!is(T == const) && !is(T == immutable) && !is(T == inout))
{
- import core.internal.traits : hasElaborateAssign, Unqual;
+ import core.internal.traits : hasElaborateAssign;
- // Avoid stack allocation by hacking to get to the struct/union init symbol.
- static if (is(T == struct) || is(T == union))
+ static if (__traits(isZeroInit, T))
{
- pragma(mangle, "_D" ~ Unqual!T.mangleof[1..$] ~ "6__initZ")
- __gshared extern immutable T initializer;
+ import core.stdc.string : memset;
+ memset(cast(void*) &chunk, 0, T.sizeof);
}
-
- void emplaceInitializer(scope ref T chunk) nothrow pure @trusted
+ else static if (__traits(isScalar, T) ||
+ T.sizeof <= 16 && !hasElaborateAssign!T && __traits(compiles, (){ T chunk; chunk = T.init; }))
{
- static if (__traits(isZeroInit, T))
- {
- import core.stdc.string : memset;
- memset(cast(void*) &chunk, 0, T.sizeof);
- }
- else static if (__traits(isScalar, T) ||
- T.sizeof <= 16 && !hasElaborateAssign!T && __traits(compiles, (){ T chunk; chunk = T.init; }))
- {
- chunk = T.init;
- }
- else static if (__traits(isStaticArray, T))
- {
- // For static arrays there is no initializer symbol created. Instead, we emplace elements one-by-one.
- foreach (i; 0 .. T.length)
- {
- emplaceInitializer(chunk[i]);
- }
- }
- else
+ chunk = T.init;
+ }
+ else static if (__traits(isStaticArray, T))
+ {
+ // For static arrays there is no initializer symbol created. Instead, we emplace elements one-by-one.
+ foreach (i; 0 .. T.length)
{
- import core.stdc.string : memcpy;
- memcpy(cast(void*)&chunk, &initializer, T.sizeof);
+ emplaceInitializer(chunk[i]);
}
}
+ else
+ {
+ import core.stdc.string : memcpy;
+ const initializer = __traits(initSymbol, T);
+ memcpy(cast(void*)&chunk, initializer.ptr, initializer.length);
+ }
}
@safe unittest
diff --git a/libphobos/libdruntime/core/internal/string.d b/libphobos/libdruntime/core/internal/string.d
index 529fee4..64a9cc9 100644
--- a/libphobos/libdruntime/core/internal/string.d
+++ b/libphobos/libdruntime/core/internal/string.d
@@ -119,7 +119,7 @@ char[] signedToTempString(uint radix = 10)(long value, return scope char[] buf)
if (neg)
{
// about to do a slice without a bounds check
- auto trustedSlice(return char[] r) @trusted { assert(r.ptr > buf.ptr); return (r.ptr-1)[0..r.length+1]; }
+ auto trustedSlice(return scope char[] r) @trusted { assert(r.ptr > buf.ptr); return (r.ptr-1)[0..r.length+1]; }
r = trustedSlice(r);
r[0] = '-';
}
diff --git a/libphobos/libdruntime/core/internal/utf.d b/libphobos/libdruntime/core/internal/utf.d
index ca0f7f5..27bf7f2b 100644
--- a/libphobos/libdruntime/core/internal/utf.d
+++ b/libphobos/libdruntime/core/internal/utf.d
@@ -583,7 +583,7 @@ void validate(S)(const scope S s)
/* =================== Conversion to UTF8 ======================= */
@safe pure nothrow @nogc
-char[] toUTF8(return char[] buf, dchar c)
+char[] toUTF8(return scope char[] buf, dchar c)
in
{
assert(isValidDchar(c));
@@ -623,7 +623,7 @@ char[] toUTF8(return char[] buf, dchar c)
* Encodes string s into UTF-8 and returns the encoded string.
*/
@safe pure nothrow
-string toUTF8(return string s)
+string toUTF8(return scope string s)
in
{
validate(s);
@@ -692,7 +692,7 @@ string toUTF8(const scope dchar[] s)
/* =================== Conversion to UTF16 ======================= */
@safe pure nothrow @nogc
-wchar[] toUTF16(return wchar[] buf, dchar c)
+wchar[] toUTF16(return scope wchar[] buf, dchar c)
in
{
assert(isValidDchar(c));
@@ -784,7 +784,7 @@ wptr toUTF16z(const scope char[] s)
/** ditto */
@safe pure nothrow
-wstring toUTF16(return wstring s)
+wstring toUTF16(return scope wstring s)
in
{
validate(s);
@@ -864,7 +864,7 @@ dstring toUTF32(const scope wchar[] s)
/** ditto */
@safe pure nothrow
-dstring toUTF32(return dstring s)
+dstring toUTF32(return scope dstring s)
in
{
validate(s);
diff --git a/libphobos/libdruntime/core/lifetime.d b/libphobos/libdruntime/core/lifetime.d
index d93b891..b45e95f 100644
--- a/libphobos/libdruntime/core/lifetime.d
+++ b/libphobos/libdruntime/core/lifetime.d
@@ -103,8 +103,8 @@ T emplace(T, Args...)(T chunk, auto ref Args args)
" is abstract and it can't be emplaced");
// Initialize the object in its pre-ctor state
- enum classSize = __traits(classInstanceSize, T);
- (() @trusted => (cast(void*) chunk)[0 .. classSize] = typeid(T).initializer[])();
+ const initializer = __traits(initSymbol, T);
+ (() @trusted { (cast(void*) chunk)[0 .. initializer.length] = initializer[]; })();
static if (isInnerClass!T)
{
@@ -224,6 +224,31 @@ T emplace(T, Args...)(void[] chunk, auto ref Args args)
assert(c.i == 5);
}
+///
+@betterC
+@nogc pure nothrow @system unittest
+{
+ // works with -betterC too:
+
+ static extern (C++) class C
+ {
+ @nogc pure nothrow @safe:
+ int i = 3;
+ this(int i)
+ {
+ assert(this.i == 3);
+ this.i = i;
+ }
+ int virtualGetI() { return i; }
+ }
+
+ import core.internal.traits : classInstanceAlignment;
+
+ align(classInstanceAlignment!C) byte[__traits(classInstanceSize, C)] buffer;
+ C c = emplace!C(buffer[], 42);
+ assert(c.virtualGetI() == 42);
+}
+
@system unittest
{
class Outer
@@ -1921,7 +1946,7 @@ private void moveImpl(T)(scope ref T target, return scope ref T source)
static if (is(T == struct))
{
- // Unsafe when compiling without -dip1000
+ // Unsafe when compiling without -preview=dip1000
if ((() @trusted => &source == &target)()) return;
// Destroy target before overwriting it
static if (hasElaborateDestructor!T) target.__xdtor();
@@ -2099,7 +2124,7 @@ private void moveEmplaceImpl(T)(scope ref T target, return scope ref T source)
static if (is(T == struct))
{
- // Unsafe when compiling without -dip1000
+ // Unsafe when compiling without -preview=dip1000
assert((() @trusted => &source !is &target)(), "source and target must not be identical");
static if (hasElaborateAssign!T || !isAssignable!T)
@@ -2123,12 +2148,7 @@ private void moveEmplaceImpl(T)(scope ref T target, return scope ref T source)
static if (__traits(isZeroInit, T))
() @trusted { memset(&source, 0, sz); }();
else
- {
- import core.internal.lifetime : emplaceInitializer;
- ubyte[T.sizeof] init = void;
- emplaceInitializer(*(() @trusted { return cast(T*)init.ptr; }()));
- () @trusted { memcpy(&source, init.ptr, sz); }();
- }
+ () @trusted { memcpy(&source, __traits(initSymbol, T).ptr, sz); }();
}
}
else static if (__traits(isStaticArray, T))
@@ -2201,3 +2221,74 @@ pure nothrow @nogc @system unittest
static assert(!__traits(compiles, f(ncarray)));
f(move(ncarray));
}
+
+/**
+ * This is called for a delete statement where the value
+ * being deleted is a pointer to a struct with a destructor
+ * but doesn't have an overloaded delete operator.
+ *
+ * Params:
+ * p = pointer to the value to be deleted
+ */
+void _d_delstruct(T)(ref T *p)
+{
+ if (p)
+ {
+ debug(PRINTF) printf("_d_delstruct(%p)\n", p);
+
+ import core.memory : GC;
+
+ destroy(*p);
+ GC.free(p);
+ p = null;
+ }
+}
+
+@system unittest
+{
+ int dtors = 0;
+ struct S { ~this() { ++dtors; } }
+
+ S *s = new S();
+ _d_delstruct(s);
+
+ assert(s == null);
+ assert(dtors == 1);
+}
+
+@system unittest
+{
+ int innerDtors = 0;
+ int outerDtors = 0;
+
+ struct Inner { ~this() { ++innerDtors; } }
+ struct Outer
+ {
+ Inner *i1;
+ Inner *i2;
+
+ this(int x)
+ {
+ i1 = new Inner();
+ i2 = new Inner();
+ }
+
+ ~this()
+ {
+ ++outerDtors;
+
+ _d_delstruct(i1);
+ assert(i1 == null);
+
+ _d_delstruct(i2);
+ assert(i2 == null);
+ }
+ }
+
+ Outer *o = new Outer(0);
+ _d_delstruct(o);
+
+ assert(o == null);
+ assert(innerDtors == 2);
+ assert(outerDtors == 1);
+}
diff --git a/libphobos/libdruntime/core/memory.d b/libphobos/libdruntime/core/memory.d
index 3770c13..c4df0f2 100644
--- a/libphobos/libdruntime/core/memory.d
+++ b/libphobos/libdruntime/core/memory.d
@@ -270,7 +270,7 @@ extern(C):
* reentrant, and must be called once for every call to disable before
* automatic collections are enabled.
*/
- pragma(mangle, "gc_enable") static void enable() nothrow; /* FIXME pure */
+ pragma(mangle, "gc_enable") static void enable() nothrow pure;
/**
@@ -280,7 +280,7 @@ extern(C):
* such as during an out of memory condition. This function is reentrant,
* but enable must be called once for each call to disable.
*/
- pragma(mangle, "gc_disable") static void disable() nothrow; /* FIXME pure */
+ pragma(mangle, "gc_disable") static void disable() nothrow pure;
/**
@@ -290,14 +290,14 @@ extern(C):
* and then to reclaim free space. This action may need to suspend all
* running threads for at least part of the collection process.
*/
- pragma(mangle, "gc_collect") static void collect() nothrow; /* FIXME pure */
+ pragma(mangle, "gc_collect") static void collect() nothrow pure;
/**
* Indicates that the managed memory space be minimized by returning free
* physical memory to the operating system. The amount of free memory
* returned depends on the allocator design and on program behavior.
*/
- pragma(mangle, "gc_minimize") static void minimize() nothrow; /* FIXME pure */
+ pragma(mangle, "gc_minimize") static void minimize() nothrow pure;
extern(D):
@@ -551,7 +551,7 @@ extern(C):
* Throws:
* `OutOfMemoryError` on allocation failure.
*/
- pragma(mangle, "gc_realloc") static void* realloc(return void* p, size_t sz, uint ba = 0, const TypeInfo ti = null) pure nothrow;
+ pragma(mangle, "gc_realloc") static void* realloc(return scope void* p, size_t sz, uint ba = 0, const TypeInfo ti = null) pure nothrow;
// https://issues.dlang.org/show_bug.cgi?id=13111
///
@@ -635,7 +635,7 @@ extern(C):
* Returns:
* The actual number of bytes reserved or zero on error.
*/
- pragma(mangle, "gc_reserve") static size_t reserve(size_t sz) nothrow; /* FIXME pure */
+ pragma(mangle, "gc_reserve") static size_t reserve(size_t sz) nothrow pure;
/**
@@ -807,7 +807,7 @@ extern(C):
* }
* ---
*/
- pragma(mangle, "gc_addRoot") static void addRoot(const void* p) nothrow @nogc; /* FIXME pure */
+ pragma(mangle, "gc_addRoot") static void addRoot(const void* p) nothrow @nogc pure;
/**
@@ -818,7 +818,7 @@ extern(C):
* Params:
* p = A pointer into a GC-managed memory block or null.
*/
- pragma(mangle, "gc_removeRoot") static void removeRoot(const void* p) nothrow @nogc; /* FIXME pure */
+ pragma(mangle, "gc_removeRoot") static void removeRoot(const void* p) nothrow @nogc pure;
/**
@@ -849,7 +849,8 @@ extern(C):
* // rawMemory will be recognized on collection.
* ---
*/
- pragma(mangle, "gc_addRange") static void addRange(const void* p, size_t sz, const TypeInfo ti = null) @nogc nothrow; /* FIXME pure */
+ pragma(mangle, "gc_addRange")
+ static void addRange(const void* p, size_t sz, const TypeInfo ti = null) @nogc nothrow pure;
/**
@@ -861,7 +862,7 @@ extern(C):
* Params:
* p = A pointer to a valid memory address or to null.
*/
- pragma(mangle, "gc_removeRange") static void removeRange(const void* p) nothrow @nogc; /* FIXME pure */
+ pragma(mangle, "gc_removeRange") static void removeRange(const void* p) nothrow @nogc pure;
/**
diff --git a/libphobos/libdruntime/core/stdc/stdlib.d b/libphobos/libdruntime/core/stdc/stdlib.d
index 2f11a66..92f8f70 100644
--- a/libphobos/libdruntime/core/stdc/stdlib.d
+++ b/libphobos/libdruntime/core/stdc/stdlib.d
@@ -26,6 +26,10 @@ else version (TVOS)
else version (WatchOS)
version = Darwin;
+version (CRuntime_Glibc)
+ version = AlignedAllocSupported;
+else {}
+
extern (C):
@system:
@@ -166,6 +170,12 @@ void* realloc(void* ptr, size_t size);
///
void free(void* ptr);
+/// since C11
+version (AlignedAllocSupported)
+{
+ void* aligned_alloc(size_t alignment, size_t size);
+}
+
///
noreturn abort() @safe;
///
diff --git a/libphobos/libdruntime/core/stdc/string.d b/libphobos/libdruntime/core/stdc/string.d
index a26811c..f15ef85 100644
--- a/libphobos/libdruntime/core/stdc/string.d
+++ b/libphobos/libdruntime/core/stdc/string.d
@@ -35,31 +35,31 @@ nothrow:
@nogc:
///
-inout(void)* memchr(return inout void* s, int c, size_t n) pure;
+inout(void)* memchr(return scope inout void* s, int c, size_t n) pure;
///
int memcmp(scope const void* s1, scope const void* s2, size_t n) pure;
///
-void* memcpy(return void* s1, scope const void* s2, size_t n) pure;
+void* memcpy(return scope void* s1, scope const void* s2, size_t n) pure;
version (Windows)
{
///
int memicmp(scope const char* s1, scope const char* s2, size_t n);
}
///
-void* memmove(return void* s1, scope const void* s2, size_t n) pure;
+void* memmove(return scope void* s1, scope const void* s2, size_t n) pure;
///
-void* memset(return void* s, int c, size_t n) pure;
+void* memset(return scope void* s, int c, size_t n) pure;
///
-char* strcat(return char* s1, scope const char* s2) pure;
+char* strcat(return scope char* s1, scope const char* s2) pure;
///
-inout(char)* strchr(return inout(char)* s, int c) pure;
+inout(char)* strchr(return scope inout(char)* s, int c) pure;
///
int strcmp(scope const char* s1, scope const char* s2) pure;
///
int strcoll(scope const char* s1, scope const char* s2);
///
-char* strcpy(return char* s1, scope const char* s2) pure;
+char* strcpy(return scope char* s1, scope const char* s2) pure;
///
size_t strcspn(scope const char* s1, scope const char* s2) pure;
///
@@ -70,7 +70,7 @@ char* strerror(int errnum);
version (ReturnStrerrorR)
{
///
- const(char)* strerror_r(int errnum, return char* buf, size_t buflen);
+ const(char)* strerror_r(int errnum, return scope char* buf, size_t buflen);
}
// This one is
else
@@ -80,20 +80,20 @@ else
///
size_t strlen(scope const char* s) pure;
///
-char* strncat(return char* s1, scope const char* s2, size_t n) pure;
+char* strncat(return scope char* s1, scope const char* s2, size_t n) pure;
///
int strncmp(scope const char* s1, scope const char* s2, size_t n) pure;
///
-char* strncpy(return char* s1, scope const char* s2, size_t n) pure;
+char* strncpy(return scope char* s1, scope const char* s2, size_t n) pure;
///
-inout(char)* strpbrk(return inout(char)* s1, scope const char* s2) pure;
+inout(char)* strpbrk(return scope inout(char)* s1, scope const char* s2) pure;
///
-inout(char)* strrchr(return inout(char)* s, int c) pure;
+inout(char)* strrchr(return scope inout(char)* s, int c) pure;
///
size_t strspn(scope const char* s1, scope const char* s2) pure;
///
-inout(char)* strstr(return inout(char)* s1, scope const char* s2) pure;
+inout(char)* strstr(return scope inout(char)* s1, scope const char* s2) pure;
///
-char* strtok(return char* s1, scope const char* s2);
+char* strtok(return scope char* s1, scope const char* s2);
///
size_t strxfrm(scope char* s1, scope const char* s2, size_t n);
diff --git a/libphobos/libdruntime/core/stdc/wchar_.d b/libphobos/libdruntime/core/stdc/wchar_.d
index 6da5618..e8fb94b 100644
--- a/libphobos/libdruntime/core/stdc/wchar_.d
+++ b/libphobos/libdruntime/core/stdc/wchar_.d
@@ -213,13 +213,13 @@ c_ulong wcstoul(const scope wchar_t* nptr, wchar_t** endptr, int base);
ulong wcstoull(const scope wchar_t* nptr, wchar_t** endptr, int base);
///
-pure wchar_t* wcscpy(return wchar_t* s1, scope const wchar_t* s2);
+pure wchar_t* wcscpy(return scope wchar_t* s1, scope const wchar_t* s2);
///
-pure wchar_t* wcsncpy(return wchar_t* s1, scope const wchar_t* s2, size_t n);
+pure wchar_t* wcsncpy(return scope wchar_t* s1, scope const wchar_t* s2, size_t n);
///
-pure wchar_t* wcscat(return wchar_t* s1, scope const wchar_t* s2);
+pure wchar_t* wcscat(return scope wchar_t* s1, scope const wchar_t* s2);
///
-pure wchar_t* wcsncat(return wchar_t* s1, scope const wchar_t* s2, size_t n);
+pure wchar_t* wcsncat(return scope wchar_t* s1, scope const wchar_t* s2, size_t n);
///
pure int wcscmp(scope const wchar_t* s1, scope const wchar_t* s2);
///
@@ -229,32 +229,32 @@ pure int wcsncmp(scope const wchar_t* s1, scope const wchar_t* s2, size_t n);
///
size_t wcsxfrm(scope wchar_t* s1, scope const wchar_t* s2, size_t n);
///
-pure inout(wchar_t)* wcschr(return inout(wchar_t)* s, wchar_t c);
+pure inout(wchar_t)* wcschr(return scope inout(wchar_t)* s, wchar_t c);
///
pure size_t wcscspn(scope const wchar_t* s1, scope const wchar_t* s2);
///
-pure inout(wchar_t)* wcspbrk(return inout(wchar_t)* s1, scope const wchar_t* s2);
+pure inout(wchar_t)* wcspbrk(return scope inout(wchar_t)* s1, scope const wchar_t* s2);
///
-pure inout(wchar_t)* wcsrchr(return inout(wchar_t)* s, wchar_t c);
+pure inout(wchar_t)* wcsrchr(return scope inout(wchar_t)* s, wchar_t c);
///
pure size_t wcsspn(scope const wchar_t* s1, scope const wchar_t* s2);
///
-pure inout(wchar_t)* wcsstr(return inout(wchar_t)* s1, scope const wchar_t* s2);
+pure inout(wchar_t)* wcsstr(return scope inout(wchar_t)* s1, scope const wchar_t* s2);
///
-wchar_t* wcstok(return wchar_t* s1, scope const wchar_t* s2, wchar_t** ptr);
+wchar_t* wcstok(return scope wchar_t* s1, scope const wchar_t* s2, wchar_t** ptr);
///
pure size_t wcslen(scope const wchar_t* s);
///
-pure inout(wchar_t)* wmemchr(return inout wchar_t* s, wchar_t c, size_t n);
+pure inout(wchar_t)* wmemchr(return scope inout wchar_t* s, wchar_t c, size_t n);
///
pure int wmemcmp(scope const wchar_t* s1, scope const wchar_t* s2, size_t n);
///
-pure wchar_t* wmemcpy(return wchar_t* s1, scope const wchar_t* s2, size_t n);
+pure wchar_t* wmemcpy(return scope wchar_t* s1, scope const wchar_t* s2, size_t n);
///
-pure wchar_t* wmemmove(return wchar_t* s1, scope const wchar_t* s2, size_t n);
+pure wchar_t* wmemmove(return scope wchar_t* s1, scope const wchar_t* s2, size_t n);
///
-pure wchar_t* wmemset(return wchar_t* s, wchar_t c, size_t n);
+pure wchar_t* wmemset(return scope wchar_t* s, wchar_t c, size_t n);
///
size_t wcsftime(wchar_t* s, size_t maxsize, const scope wchar_t* format, const scope tm* timeptr);
diff --git a/libphobos/libdruntime/core/stdcpp/exception.d b/libphobos/libdruntime/core/stdcpp/exception.d
index f920057..d65cd8d 100644
--- a/libphobos/libdruntime/core/stdcpp/exception.d
+++ b/libphobos/libdruntime/core/stdcpp/exception.d
@@ -19,6 +19,8 @@ version (CppRuntime_Gcc)
version = GenericBaseException;
version (CppRuntime_Clang)
version = GenericBaseException;
+version (CppRuntime_Sun)
+ version = GenericBaseException;
extern (C++, "std"):
@nogc:
diff --git a/libphobos/libdruntime/core/sync/mutex.d b/libphobos/libdruntime/core/sync/mutex.d
index b153ab9..b848a14 100644
--- a/libphobos/libdruntime/core/sync/mutex.d
+++ b/libphobos/libdruntime/core/sync/mutex.d
@@ -189,7 +189,7 @@ class Mutex :
if (pthread_mutex_lock(&m_hndl) == 0)
return;
- SyncError syncErr = cast(SyncError) cast(void*) typeid(SyncError).initializer;
+ SyncError syncErr = cast(SyncError) __traits(initSymbol, SyncError).ptr;
syncErr.msg = "Unable to lock mutex.";
throw syncErr;
}
@@ -227,7 +227,7 @@ class Mutex :
if (pthread_mutex_unlock(&m_hndl) == 0)
return;
- SyncError syncErr = cast(SyncError) cast(void*) typeid(SyncError).initializer;
+ SyncError syncErr = cast(SyncError) __traits(initSymbol, SyncError).ptr;
syncErr.msg = "Unable to unlock mutex.";
throw syncErr;
}
diff --git a/libphobos/libdruntime/core/sys/bionic/string.d b/libphobos/libdruntime/core/sys/bionic/string.d
index cbee06c..10a5610 100644
--- a/libphobos/libdruntime/core/sys/bionic/string.d
+++ b/libphobos/libdruntime/core/sys/bionic/string.d
@@ -14,4 +14,4 @@ extern (C):
nothrow:
@nogc:
-pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
+pure void* memmem(return scope const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
diff --git a/libphobos/libdruntime/core/sys/darwin/mach/nlist.d b/libphobos/libdruntime/core/sys/darwin/mach/nlist.d
index 11e5ced..4d400f2 100644
--- a/libphobos/libdruntime/core/sys/darwin/mach/nlist.d
+++ b/libphobos/libdruntime/core/sys/darwin/mach/nlist.d
@@ -222,7 +222,7 @@ enum
*/
ubyte GET_LIBRARY_ORDINAL(uint n_desc) @safe { return ((n_desc) >> 8) & 0xff; }
/// Ditto
-ref ushort SET_LIBRARY_ORDINAL(return scope ref ushort n_desc, uint ordinal) @safe
+ref ushort SET_LIBRARY_ORDINAL(return ref ushort n_desc, uint ordinal) @safe
{
return n_desc = (((n_desc) & 0x00ff) | (((ordinal) & 0xff) << 8));
}
diff --git a/libphobos/libdruntime/core/sys/darwin/string.d b/libphobos/libdruntime/core/sys/darwin/string.d
index bd65fde..ac988b5 100644
--- a/libphobos/libdruntime/core/sys/darwin/string.d
+++ b/libphobos/libdruntime/core/sys/darwin/string.d
@@ -27,5 +27,5 @@ nothrow:
static if (__DARWIN_C_LEVEL >= __DARWIN_C_FULL)
{
// ^ __OSX_AVAILABLE_STARTING(__MAC_10_7, __IPHONE_4_3);
- pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
+ pure void* memmem(return scope const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
}
diff --git a/libphobos/libdruntime/core/sys/dragonflybsd/string.d b/libphobos/libdruntime/core/sys/dragonflybsd/string.d
index b64178f..4b84227 100644
--- a/libphobos/libdruntime/core/sys/dragonflybsd/string.d
+++ b/libphobos/libdruntime/core/sys/dragonflybsd/string.d
@@ -17,6 +17,6 @@ nothrow:
static if (__BSD_VISIBLE)
{
- pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
+ pure void* memmem(return scope const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
}
diff --git a/libphobos/libdruntime/core/sys/freebsd/string.d b/libphobos/libdruntime/core/sys/freebsd/string.d
index 3602ea8..459e911 100644
--- a/libphobos/libdruntime/core/sys/freebsd/string.d
+++ b/libphobos/libdruntime/core/sys/freebsd/string.d
@@ -17,5 +17,5 @@ nothrow:
static if (__BSD_VISIBLE)
{
- pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
+ pure void* memmem(return scope const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
}
diff --git a/libphobos/libdruntime/core/sys/linux/string.d b/libphobos/libdruntime/core/sys/linux/string.d
index 1b2c8d8..e3c94cf6 100644
--- a/libphobos/libdruntime/core/sys/linux/string.d
+++ b/libphobos/libdruntime/core/sys/linux/string.d
@@ -18,5 +18,5 @@ nothrow:
static if (__USE_GNU)
{
- pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
+ pure void* memmem(return scope const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
}
diff --git a/libphobos/libdruntime/core/sys/linux/syscalls.d b/libphobos/libdruntime/core/sys/linux/syscalls.d
deleted file mode 100644
index 8c65371..0000000
--- a/libphobos/libdruntime/core/sys/linux/syscalls.d
+++ /dev/null
@@ -1,745 +0,0 @@
-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 1ef16c1..4845746 100644
--- a/libphobos/libdruntime/core/sys/linux/unistd.d
+++ b/libphobos/libdruntime/core/sys/linux/unistd.d
@@ -1,20 +1,16 @@
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)
@@ -26,17 +22,3 @@ 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/netbsd/string.d b/libphobos/libdruntime/core/sys/netbsd/string.d
index ab9ced8..f1281da 100644
--- a/libphobos/libdruntime/core/sys/netbsd/string.d
+++ b/libphobos/libdruntime/core/sys/netbsd/string.d
@@ -17,5 +17,5 @@ nothrow:
static if (_NETBSD_SOURCE)
{
- pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
+ pure void* memmem(return scope const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
}
diff --git a/libphobos/libdruntime/core/sys/openbsd/string.d b/libphobos/libdruntime/core/sys/openbsd/string.d
index 131e677..4480c94 100644
--- a/libphobos/libdruntime/core/sys/openbsd/string.d
+++ b/libphobos/libdruntime/core/sys/openbsd/string.d
@@ -18,7 +18,7 @@ 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);
+ pure void* memmem(return scope 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);
diff --git a/libphobos/libdruntime/core/sys/posix/signal.d b/libphobos/libdruntime/core/sys/posix/signal.d
index 0dce8c5..32e5156 100644
--- a/libphobos/libdruntime/core/sys/posix/signal.d
+++ b/libphobos/libdruntime/core/sys/posix/signal.d
@@ -513,15 +513,21 @@ else version (DragonFlyBSD)
}
else version (Solaris)
{
+ //SIGABRT (defined in core.stdc.signal)
enum SIGALRM = 14;
enum SIGBUS = 10;
enum SIGCHLD = 18;
enum SIGCONT = 25;
+ //SIGFPE (defined in core.stdc.signal)
enum SIGHUP = 1;
+ //SIGILL (defined in core.stdc.signal)
+ //SIGINT (defined in core.stdc.signal)
enum SIGKILL = 9;
enum SIGPIPE = 13;
enum SIGQUIT = 3;
+ //SIGSEGV (defined in core.stdc.signal)
enum SIGSTOP = 23;
+ //SIGTERM (defined in core.stdc.signal)
enum SIGTSTP = 24;
enum SIGTTIN = 26;
enum SIGTTOU = 27;
@@ -1339,6 +1345,10 @@ else version (Solaris)
uint[4] __bits;
}
+ enum SIG_BLOCK = 1;
+ enum SIG_UNBLOCK = 2;
+ enum SIG_SETMASK = 3;
+
struct siginfo_t
{
int si_signo;
@@ -1427,6 +1437,18 @@ else version (Solaris)
___data __data;
}
+ enum SI_NOINFO = 32767;
+ enum SI_DTRACE = 2050;
+ enum SI_RCTL = 2049;
+ enum SI_USER = 0;
+ enum SI_LWP = -1;
+ enum SI_QUEUE = -2;
+ enum SI_TIMER = -3;
+ enum SI_ASYNCIO = -4;
+ enum SI_MESGQ = -5;
+
+ enum SIGIO = SIGPOLL;
+
int kill(pid_t, int);
int sigaction(int, const scope sigaction_t*, sigaction_t*);
int sigaddset(sigset_t*, int);
@@ -2833,9 +2855,9 @@ else version (Solaris)
enum SIGPROF = 29;
enum SIGSYS = 12;
enum SIGTRAP = 5;
- enum SIGVTALRM = 31;
+ enum SIGVTALRM = 28;
enum SIGXCPU = 30;
- enum SIGXFSZ = 25;
+ enum SIGXFSZ = 31;
enum
{
diff --git a/libphobos/libdruntime/core/sys/posix/string.d b/libphobos/libdruntime/core/sys/posix/string.d
index b9e1c1c..79d2562 100644
--- a/libphobos/libdruntime/core/sys/posix/string.d
+++ b/libphobos/libdruntime/core/sys/posix/string.d
@@ -31,11 +31,11 @@ public import core.sys.posix.locale : locale_t;
public import core.stdc.string;
/// Copy string until character found
-void* memccpy(return void* dst, scope const void* src, int c, size_t n) pure;
+void* memccpy(return scope void* dst, scope const void* src, int c, size_t n) pure;
/// Copy string (including terminating '\0')
-char* stpcpy(return char* dst, scope const char* src) pure;
+char* stpcpy(return scope char* dst, scope const char* src) pure;
/// Ditto
-char* stpncpy(return char* dst, const char* src, size_t len) pure;
+char* stpncpy(return scope char* dst, const char* src, size_t len) pure;
/// Compare strings according to current collation
int strcoll_l(scope const char* s1, scope const char* s2, locale_t locale);
///
@@ -47,6 +47,6 @@ size_t strnlen(scope const char* str, size_t maxlen) pure;
/// System signal messages
const(char)* strsignal(int);
/// Isolate sequential tokens in a null-terminated string
-char* strtok_r(return char* str, scope const char* sep, char** context) pure;
+char* strtok_r(return scope char* str, scope const char* sep, char** context) pure;
/// Transform a string under locale
size_t strxfrm_l(char* s1, scope const char* s2, size_t n, locale_t locale);
diff --git a/libphobos/libdruntime/core/sys/posix/sys/socket.d b/libphobos/libdruntime/core/sys/posix/sys/socket.d
index de51c6a..6e0cfd3 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/socket.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/socket.d
@@ -217,7 +217,7 @@ version (CRuntime_Glibc)
}
else
{
- extern (D) inout(ubyte)* CMSG_DATA( return inout(cmsghdr)* cmsg ) pure nothrow @nogc { return cast(ubyte*)( cmsg + 1 ); }
+ extern (D) inout(ubyte)* CMSG_DATA( return scope inout(cmsghdr)* cmsg ) pure nothrow @nogc { return cast(ubyte*)( cmsg + 1 ); }
}
private inout(cmsghdr)* __cmsg_nxthdr(inout(msghdr)*, inout(cmsghdr)*) pure nothrow @nogc;
diff --git a/libphobos/libdruntime/core/sys/solaris/sys/elf.d b/libphobos/libdruntime/core/sys/solaris/sys/elf.d
index 7da2631..7a46d52 100644
--- a/libphobos/libdruntime/core/sys/solaris/sys/elf.d
+++ b/libphobos/libdruntime/core/sys/solaris/sys/elf.d
@@ -393,7 +393,7 @@ enum SHF_LINK_ORDER = 0x80;
enum SHF_OS_NONCONFORMING = 0x100;
enum SHF_GROUP = 0x200;
enum SHF_TLS = 0x400;
-
+enum SHF_COMPRESSED = 0x800;
enum SHF_MASKOS = 0x0ff00000;
enum SHF_MASKPROC = 0xf0000000;
@@ -656,3 +656,6 @@ enum NT_ZONENAME = 21;
enum NT_FDINFO = 22;
enum NT_SPYMASTER = 23;
enum NT_NUM = 23;
+
+enum SHF_ORDERED = 0x40000000;
+enum SHF_EXCLUDE = 0x80000000;
diff --git a/libphobos/libdruntime/core/sys/solaris/sys/elf_386.d b/libphobos/libdruntime/core/sys/solaris/sys/elf_386.d
index 0c81985..9927b64 100644
--- a/libphobos/libdruntime/core/sys/solaris/sys/elf_386.d
+++ b/libphobos/libdruntime/core/sys/solaris/sys/elf_386.d
@@ -52,9 +52,6 @@ enum R_386_NUM = 39;
enum ELF_386_MAXPGSZ = 0x10000;
-enum SHF_ORDERED = 0x40000000;
-enum SHF_EXCLUDE = 0x80000000;
-
enum SHN_BEFORE = 0xff00;
enum SHN_AFTER = 0xff01;
diff --git a/libphobos/libdruntime/core/sys/solaris/sys/elf_SPARC.d b/libphobos/libdruntime/core/sys/solaris/sys/elf_SPARC.d
index 81d0234..e43bd40 100644
--- a/libphobos/libdruntime/core/sys/solaris/sys/elf_SPARC.d
+++ b/libphobos/libdruntime/core/sys/solaris/sys/elf_SPARC.d
@@ -118,9 +118,6 @@ enum ELF_SPARCV9_MAXPGSZ = 0x100000;
enum SHT_SPARC_GOTDATA = 0x70000000;
-enum SHF_ORDERED = 0x40000000;
-enum SHF_EXCLUDE = 0x80000000;
-
enum SHN_BEFORE = 0xff00;
enum SHN_AFTER = 0xff01;
diff --git a/libphobos/libdruntime/core/sys/windows/dbghelp.d b/libphobos/libdruntime/core/sys/windows/dbghelp.d
index 9848fb9..96698e8 100644
--- a/libphobos/libdruntime/core/sys/windows/dbghelp.d
+++ b/libphobos/libdruntime/core/sys/windows/dbghelp.d
@@ -39,7 +39,8 @@ extern(Windows)
alias BOOL function(HANDLE hProcess, DWORD64 Address, DWORD64 *Displacement, IMAGEHLP_SYMBOLA64 *Symbol) SymGetSymFromAddr64Func;
alias DWORD function(PCSTR DecoratedName, PSTR UnDecoratedName, DWORD UndecoratedLength, DWORD Flags) UnDecorateSymbolNameFunc;
alias DWORD64 function(HANDLE hProcess, HANDLE hFile, PCSTR ImageName, PCSTR ModuleName, DWORD64 BaseOfDll, DWORD SizeOfDll) SymLoadModule64Func;
- alias BOOL function(HANDLE HProcess, PTSTR SearchPath, DWORD SearchPathLength) SymGetSearchPathFunc;
+ alias BOOL function(HANDLE hProcess, PSTR SearchPath, DWORD SearchPathLength) SymGetSearchPathFunc;
+ alias BOOL function(HANDLE hProcess, PCSTR SearchPath) SymSetSearchPathFunc;
alias BOOL function(HANDLE hProcess, DWORD64 Address) SymUnloadModule64Func;
alias BOOL function(HANDLE hProcess, ULONG ActionCode, ulong CallbackContext, ulong UserContext) PSYMBOL_REGISTERED_CALLBACK64;
alias BOOL function(HANDLE hProcess, PSYMBOL_REGISTERED_CALLBACK64 CallbackFunction, ulong UserContext) SymRegisterCallback64Func;
@@ -61,6 +62,7 @@ struct DbgHelp
UnDecorateSymbolNameFunc UnDecorateSymbolName;
SymLoadModule64Func SymLoadModule64;
SymGetSearchPathFunc SymGetSearchPath;
+ SymSetSearchPathFunc SymSetSearchPath;
SymUnloadModule64Func SymUnloadModule64;
SymRegisterCallback64Func SymRegisterCallback64;
ImagehlpApiVersionFunc ImagehlpApiVersion;
@@ -84,6 +86,7 @@ struct DbgHelp
sm_inst.UnDecorateSymbolName = cast(UnDecorateSymbolNameFunc) GetProcAddress(sm_hndl,"UnDecorateSymbolName");
sm_inst.SymLoadModule64 = cast(SymLoadModule64Func) GetProcAddress(sm_hndl,"SymLoadModule64");
sm_inst.SymGetSearchPath = cast(SymGetSearchPathFunc) GetProcAddress(sm_hndl,"SymGetSearchPath");
+ sm_inst.SymSetSearchPath = cast(SymSetSearchPathFunc) GetProcAddress(sm_hndl,"SymSetSearchPath");
sm_inst.SymUnloadModule64 = cast(SymUnloadModule64Func) GetProcAddress(sm_hndl,"SymUnloadModule64");
sm_inst.SymRegisterCallback64 = cast(SymRegisterCallback64Func) GetProcAddress(sm_hndl, "SymRegisterCallback64");
sm_inst.ImagehlpApiVersion = cast(ImagehlpApiVersionFunc) GetProcAddress(sm_hndl, "ImagehlpApiVersion");
@@ -91,7 +94,8 @@ struct DbgHelp
sm_inst.SymSetOptions && sm_inst.SymFunctionTableAccess64 && sm_inst.SymGetLineFromAddr64 &&
sm_inst.SymGetModuleBase64 && sm_inst.SymGetModuleInfo64 && sm_inst.SymGetSymFromAddr64 &&
sm_inst.UnDecorateSymbolName && sm_inst.SymLoadModule64 && sm_inst.SymGetSearchPath &&
- sm_inst.SymUnloadModule64 && sm_inst.SymRegisterCallback64 && sm_inst.ImagehlpApiVersion);
+ sm_inst.SymSetSearchPath && sm_inst.SymUnloadModule64 && sm_inst.SymRegisterCallback64 &&
+ sm_inst.ImagehlpApiVersion);
return &sm_inst;
}
diff --git a/libphobos/libdruntime/core/thread/osthread.d b/libphobos/libdruntime/core/thread/osthread.d
index b7dde93..fe4d24f 100644
--- a/libphobos/libdruntime/core/thread/osthread.d
+++ b/libphobos/libdruntime/core/thread/osthread.d
@@ -719,7 +719,7 @@ class Thread : ThreadBase
// the effective maximum.
// maxupri
- result.PRIORITY_MIN = -clinfo[0];
+ result.PRIORITY_MIN = -cast(int)(clinfo[0]);
// by definition
result.PRIORITY_DEFAULT = 0;
}
@@ -2196,8 +2196,7 @@ extern (C) void thread_init() @nogc
status = sem_init( &suspendCount, 0, 0 );
assert( status == 0 );
}
- if (typeid(Thread).initializer.ptr)
- _mainThreadStore[] = typeid(Thread).initializer[];
+ _mainThreadStore[] = __traits(initSymbol, Thread)[];
Thread.sm_main = attachThread((cast(Thread)_mainThreadStore.ptr).__ctor());
}
diff --git a/libphobos/libdruntime/core/thread/threadbase.d b/libphobos/libdruntime/core/thread/threadbase.d
index 4592bf1..9cee4d8 100644
--- a/libphobos/libdruntime/core/thread/threadbase.d
+++ b/libphobos/libdruntime/core/thread/threadbase.d
@@ -771,10 +771,7 @@ package void thread_term_tpl(ThreadT, MainThreadStore)(ref MainThreadStore _main
// destruct manually as object.destroy is not @nogc
(cast(ThreadT) cast(void*) ThreadBase.sm_main).__dtor();
_d_monitordelete_nogc(ThreadBase.sm_main);
- if (typeid(ThreadT).initializer.ptr)
- _mainThreadStore[] = typeid(ThreadT).initializer[];
- else
- (cast(ubyte[])_mainThreadStore)[] = 0;
+ _mainThreadStore[] = __traits(initSymbol, ThreadT)[];
ThreadBase.sm_main = null;
assert(ThreadBase.sm_tbeg && ThreadBase.sm_tlen == 1);
diff --git a/libphobos/libdruntime/object.d b/libphobos/libdruntime/object.d
index a079e0e..fee19ae 100644
--- a/libphobos/libdruntime/object.d
+++ b/libphobos/libdruntime/object.d
@@ -3485,7 +3485,7 @@ enum immutable(void)* rtinfoHasPointers = cast(void*)1;
// Helper functions
-private inout(TypeInfo) getElement(return inout TypeInfo value) @trusted pure nothrow
+private inout(TypeInfo) getElement(return scope inout TypeInfo value) @trusted pure nothrow
{
TypeInfo element = cast() value;
for (;;)
@@ -4215,8 +4215,8 @@ void destroy(bool initialize = true, T)(T obj) if (is(T == class))
static if (initialize)
{
- enum classSize = __traits(classInstanceSize, T);
- (cast(void*)obj)[0 .. classSize] = typeid(T).initializer[];
+ const initializer = __traits(initSymbol, T);
+ (cast(void*)obj)[0 .. initializer.length] = initializer[];
}
}
else
@@ -4651,6 +4651,8 @@ public import core.internal.array.construction : _d_arrayctor;
public import core.internal.array.construction : _d_arraysetctor;
public import core.internal.array.capacity: _d_arraysetlengthTImpl;
+public import core.lifetime : _d_delstruct;
+
public import core.internal.dassert: _d_assert_fail;
public import core.internal.destruction: __ArrayDtor;
diff --git a/libphobos/libdruntime/rt/aaA.d b/libphobos/libdruntime/rt/aaA.d
index 6ff93f7..0c38622 100644
--- a/libphobos/libdruntime/rt/aaA.d
+++ b/libphobos/libdruntime/rt/aaA.d
@@ -287,7 +287,7 @@ TypeInfo_Struct fakeEntryTI(ref Impl aa, const TypeInfo keyti, const TypeInfo va
void* p = GC.malloc(sizeti + (2 + rtisize) * (void*).sizeof);
import core.stdc.string : memcpy;
- memcpy(p, typeid(TypeInfo_Struct).initializer().ptr, sizeti);
+ memcpy(p, __traits(initSymbol, TypeInfo_Struct).ptr, sizeti);
auto ti = cast(TypeInfo_Struct) p;
auto extra = cast(TypeInfo*)(p + sizeti);
@@ -853,7 +853,7 @@ struct Range
extern (C) pure nothrow @nogc @safe
{
- Range _aaRange(return AA aa)
+ Range _aaRange(return scope AA aa)
{
if (!aa)
return Range();
diff --git a/libphobos/libdruntime/rt/cast_.d b/libphobos/libdruntime/rt/cast_.d
index dcb4438..1604510 100644
--- a/libphobos/libdruntime/rt/cast_.d
+++ b/libphobos/libdruntime/rt/cast_.d
@@ -36,7 +36,7 @@ extern (D) private bool areClassInfosEqual(scope const ClassInfo a, scope const
* If it is null, return null.
* Else, undefined crash
*/
-Object _d_toObject(return void* p)
+Object _d_toObject(return scope void* p)
{
if (!p)
return null;
diff --git a/libphobos/libdruntime/rt/config.d b/libphobos/libdruntime/rt/config.d
index f7682f3..a6605f4 100644
--- a/libphobos/libdruntime/rt/config.d
+++ b/libphobos/libdruntime/rt/config.d
@@ -101,6 +101,9 @@ string rt_cmdlineOption(string opt, scope rt_configCallBack dg) @nogc nothrow
{
foreach (a; rt_args)
{
+ if (a == "--")
+ break;
+
if (a.length >= opt.length + 7 && a[0..6] == "--DRT-" &&
a[6 .. 6 + opt.length] == opt && a[6 + opt.length] == '=')
{
diff --git a/libphobos/libdruntime/rt/lifetime.d b/libphobos/libdruntime/rt/lifetime.d
index f1a9d87..1f7a81d 100644
--- a/libphobos/libdruntime/rt/lifetime.d
+++ b/libphobos/libdruntime/rt/lifetime.d
@@ -181,7 +181,7 @@ extern (C) void _d_delstruct(void** p, TypeInfo_Struct inf) @weak
}
// strip const/immutable/shared/inout from type info
-inout(TypeInfo) unqualify(return inout(TypeInfo) cti) pure nothrow @nogc
+inout(TypeInfo) unqualify(return scope inout(TypeInfo) cti) pure nothrow @nogc
{
TypeInfo ti = cast() cti;
while (ti)
@@ -381,7 +381,7 @@ size_t __arrayAllocLength(ref BlkInfo info, const TypeInfo tinext) pure nothrow
/**
get the start of the array for the given block
*/
-void *__arrayStart(return BlkInfo info) nothrow pure
+void *__arrayStart(return scope BlkInfo info) nothrow pure
{
return info.base + ((info.size & BIGLENGTHMASK) ? LARGEPREFIX : 0);
}
diff --git a/libphobos/libdruntime/rt/monitor_.d b/libphobos/libdruntime/rt/monitor_.d
index 6bfce63..763f439 100644
--- a/libphobos/libdruntime/rt/monitor_.d
+++ b/libphobos/libdruntime/rt/monitor_.d
@@ -264,7 +264,7 @@ struct Monitor
private:
-@property ref shared(Monitor*) monitor(return Object h) pure nothrow @nogc
+@property ref shared(Monitor*) monitor(return scope Object h) pure nothrow @nogc
{
return *cast(shared Monitor**)&h.__monitor;
}