summaryrefslogtreecommitdiff
path: root/libphobos/libdruntime
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2025-01-05 14:40:13 +0100
committerIain Buclaw <ibuclaw@gdcproject.org>2025-01-05 14:40:13 +0100
commitf5351b38a8aff438b41cae0d133fd38d56d8cd1f (patch)
tree6c3ebcd181efe8e57c3e6fe4af8f595996b713ff /libphobos/libdruntime
parenta676a516701789730aa482bcef4adcb683ba0140 (diff)
d: Merge upstream dmd, druntime 66b93fc24a, phobos 0c28620c3
Synchronizing with the upstream release of v2.109.1. D front-end changes: - Import dmd v2.109.1. - Copying from `const(void)[]' to `void[]' is now disallowed with `-fpreview=fiximmutableconv'. - Import expressions are now treated as hex strings. - Using boolean values other than 0 or 1 in `@safe' code is now deprecated. D runtime changes: - Import dmd v2.109.1. Phobos changes: - Import dmd v2.109.1. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 66b93fc24a. * dmd/VERSION: Bump version to v2.109.1. * d-builtins.cc (build_frontend_type): Update for new front-end interface. (matches_builtin_type): Likewise. * d-codegen.cc (identity_compare_p): Likewise. (call_side_effect_free_p): Likewise. * d-convert.cc (convert_expr): Likewise. (check_valist_conversion): Likewise. * d-lang.cc (d_types_compatible_p): Likewise. * d-target.cc (Target::isVectorTypeSupported): Likewise. (Target::isReturnOnStack): Likewise. (Target::preferPassByRef): Likewise. * decl.cc (class DeclVisitor): Likewise. * expr.cc (class ExprVisitor): Likewise. * typeinfo.cc (class TypeInfoVisitor): Likewise. * types.cc (class TypeVisitor): Likewise. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 66b93fc24a. * src/MERGE: Merge upstream phobos 0c28620c3. * src/Makefile.am (PHOBOS_DSOURCES): Add std/internal/test/sumtype_example_overloads.d. * src/Makefile.in: Regenerate.
Diffstat (limited to 'libphobos/libdruntime')
-rw-r--r--libphobos/libdruntime/MERGE2
-rw-r--r--libphobos/libdruntime/core/checkedint.d4
-rw-r--r--libphobos/libdruntime/core/internal/newaa.d2
-rw-r--r--libphobos/libdruntime/core/internal/parseoptions.d3
-rw-r--r--libphobos/libdruntime/core/internal/traits.d23
-rw-r--r--libphobos/libdruntime/core/lifetime.d6
-rw-r--r--libphobos/libdruntime/core/runtime.d4
-rw-r--r--libphobos/libdruntime/core/stdcpp/allocator.d6
-rw-r--r--libphobos/libdruntime/core/stdcpp/array.d4
-rw-r--r--libphobos/libdruntime/core/stdcpp/exception.d4
-rw-r--r--libphobos/libdruntime/core/stdcpp/memory.d4
-rw-r--r--libphobos/libdruntime/core/stdcpp/string.d8
-rw-r--r--libphobos/libdruntime/core/stdcpp/string_view.d4
-rw-r--r--libphobos/libdruntime/core/stdcpp/typeinfo.d4
-rw-r--r--libphobos/libdruntime/core/stdcpp/xutility.d6
-rw-r--r--libphobos/libdruntime/core/sys/posix/dirent.d13
-rw-r--r--libphobos/libdruntime/core/sys/posix/dlfcn.d18
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/stat.d5
-rw-r--r--libphobos/libdruntime/core/sys/posix/sys/statvfs.d50
-rw-r--r--libphobos/libdruntime/core/sys/windows/stacktrace.d8
-rw-r--r--libphobos/libdruntime/core/thread/osthread.d2
-rw-r--r--libphobos/libdruntime/core/thread/threadbase.d2
-rw-r--r--libphobos/libdruntime/gcc/sections/elf.d12
-rw-r--r--libphobos/libdruntime/gcc/sections/macho.d12
-rw-r--r--libphobos/libdruntime/gcc/sections/pecoff.d12
-rw-r--r--libphobos/libdruntime/rt/aaA.d4
-rw-r--r--libphobos/libdruntime/rt/dmain2.d9
-rw-r--r--libphobos/libdruntime/rt/lifetime.d4
-rw-r--r--libphobos/libdruntime/rt/sections.d2
29 files changed, 145 insertions, 92 deletions
diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE
index 77e8562abcc..d458bea5e1a 100644
--- a/libphobos/libdruntime/MERGE
+++ b/libphobos/libdruntime/MERGE
@@ -1,4 +1,4 @@
-07bc5b9b3c81cc0d4314e0040de981124b363ea5
+66b93fc24a7ab5e2a8aa7f53c613df4abddc188b
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.
diff --git a/libphobos/libdruntime/core/checkedint.d b/libphobos/libdruntime/core/checkedint.d
index 49a5c11d137..4c40b9957a9 100644
--- a/libphobos/libdruntime/core/checkedint.d
+++ b/libphobos/libdruntime/core/checkedint.d
@@ -186,8 +186,8 @@ unittest
{
bool overflow;
immutable uint r = addu (uint.max - i, uint.max - i, overflow);
- assert (r == 2 * (uint.max - i));
- assert (overflow);
+ assert(r == 2 * (uint.max - i));
+ assert(overflow);
}
bool overflow;
diff --git a/libphobos/libdruntime/core/internal/newaa.d b/libphobos/libdruntime/core/internal/newaa.d
index 2fd93651a22..7c858f33522 100644
--- a/libphobos/libdruntime/core/internal/newaa.d
+++ b/libphobos/libdruntime/core/internal/newaa.d
@@ -102,7 +102,7 @@ AAShell makeAA(K, V)(V[K] src) @trusted
dim = dim * GROW_FAC;
// used during runtime.
- size_t delegate(scope const void *) nothrow hashFn = (scope const void* val) {
+ typeof(Impl.hashFn) hashFn = (scope const void* val) {
auto x = cast(K*)val;
return hashOf(*x);
};
diff --git a/libphobos/libdruntime/core/internal/parseoptions.d b/libphobos/libdruntime/core/internal/parseoptions.d
index 2bf1da2fbfa..2dd3ec8375b 100644
--- a/libphobos/libdruntime/core/internal/parseoptions.d
+++ b/libphobos/libdruntime/core/internal/parseoptions.d
@@ -219,13 +219,12 @@ do
return overflowedError(optname, str);
i++;
- break;
}
else // unexpected non-digit character
{
i = 0;
- break;
}
+ break;
}
}
diff --git a/libphobos/libdruntime/core/internal/traits.d b/libphobos/libdruntime/core/internal/traits.d
index 0b2eb1f21a7..f0d9ebc9a81 100644
--- a/libphobos/libdruntime/core/internal/traits.d
+++ b/libphobos/libdruntime/core/internal/traits.d
@@ -51,7 +51,7 @@ unittest
static assert(is(BaseElemOf!(int[1][2]) == int));
static assert(is(BaseElemOf!(int[1][]) == int[1][]));
static assert(is(BaseElemOf!(int[][1]) == int[]));
- static enum E : int[2]{ test = [0, 1] }
+ enum E : int[2]{ test = [0, 1] }
static assert(is(BaseElemOf!(E) == int));
}
@@ -809,30 +809,23 @@ unittest
template hasUDA(alias symbol, alias attribute)
{
- alias attrs = __traits(getAttributes, symbol);
+ enum isAttr(T) = is(T == attribute);
- static foreach (a; attrs)
- {
- static if (is(a == attribute))
- {
- enum hasUDA = true;
- }
- }
-
- static if (!__traits(compiles, (hasUDA == true)))
- enum hasUDA = false;
+ enum hasUDA = anySatisfy!(isAttr, __traits(getAttributes, symbol));
}
unittest
{
- struct SomeUDA{}
+ enum SomeUDA;
struct Test
{
int woUDA;
- @SomeUDA int withUDA;
+ @SomeUDA int oneUDA;
+ @SomeUDA @SomeUDA int twoUDAs;
}
- static assert(hasUDA!(Test.withUDA, SomeUDA));
+ static assert(hasUDA!(Test.oneUDA, SomeUDA));
+ static assert(hasUDA!(Test.twoUDAs, SomeUDA));
static assert(!hasUDA!(Test.woUDA, SomeUDA));
}
diff --git a/libphobos/libdruntime/core/lifetime.d b/libphobos/libdruntime/core/lifetime.d
index 9e563ad43a3..f3dab3624ac 100644
--- a/libphobos/libdruntime/core/lifetime.d
+++ b/libphobos/libdruntime/core/lifetime.d
@@ -104,7 +104,7 @@ T emplace(T, Args...)(T chunk, auto ref Args args)
// Initialize the object in its pre-ctor state
const initializer = __traits(initSymbol, T);
- (() @trusted { (cast(void*) chunk)[0 .. initializer.length] = initializer[]; })();
+ () @trusted { (cast(void*) chunk)[0 .. initializer.length] = cast(void[]) initializer[]; }();
static if (isInnerClass!T)
{
@@ -2683,7 +2683,7 @@ T _d_newThrowable(T)() @trusted
debug(PRINTF) printf(" p = %p\n", p);
// initialize it
- p[0 .. init.length] = init[];
+ p[0 .. init.length] = cast(void[]) init[];
import core.internal.traits : hasIndirections;
if (hasIndirections!T)
@@ -2776,7 +2776,7 @@ if (is(T == class))
}
// initialize it
- p[0 .. init.length] = init[];
+ p[0 .. init.length] = cast(void[]) init[];
debug(PRINTF) printf("initialization done\n");
return cast(T) p;
diff --git a/libphobos/libdruntime/core/runtime.d b/libphobos/libdruntime/core/runtime.d
index 4ff728cc38c..182886175a6 100644
--- a/libphobos/libdruntime/core/runtime.d
+++ b/libphobos/libdruntime/core/runtime.d
@@ -613,7 +613,7 @@ extern (C) UnitTestResult runModuleUnitTests()
static extern (C) void unittestSegvHandler( int signum, siginfo_t* info, void* ptr ) nothrow
{
- static enum MAXFRAMES = 128;
+ enum MAXFRAMES = 128;
void*[MAXFRAMES] callstack;
auto numframes = backtrace( callstack.ptr, MAXFRAMES );
@@ -942,7 +942,7 @@ else static if (hasExecinfo) private class DefaultTraceInfo : Throwable.TraceInf
private:
int numframes;
- static enum MAXFRAMES = 128;
+ enum MAXFRAMES = 128;
void*[MAXFRAMES] callstack = void;
private:
diff --git a/libphobos/libdruntime/core/stdcpp/allocator.d b/libphobos/libdruntime/core/stdcpp/allocator.d
index abf97c48b0b..a574cd39e8b 100644
--- a/libphobos/libdruntime/core/stdcpp/allocator.d
+++ b/libphobos/libdruntime/core/stdcpp/allocator.d
@@ -147,7 +147,7 @@ extern(D):
///
enum size_t max_size = size_t.max / T.sizeof;
}
- else version (CppRuntime_Gcc)
+ else version (CppRuntime_GNU)
{
///
T* allocate(size_t count, const(void)* = null) @nogc
@@ -174,7 +174,7 @@ extern(D):
///
enum size_t max_size = (ptrdiff_t.max < size_t.max ? cast(size_t)ptrdiff_t.max : size_t.max) / T.sizeof;
}
- else version (CppRuntime_Clang)
+ else version (CppRuntime_LLVM)
{
///
T* allocate(size_t count, const(void)* = null) @nogc
@@ -360,7 +360,7 @@ version (CppRuntime_Microsoft)
}
}
}
-version (CppRuntime_Clang)
+version (CppRuntime_LLVM)
{
// Helper for container swap
package(core.stdcpp) void __swap_allocator(Alloc)(ref Alloc __a1, ref Alloc __a2)
diff --git a/libphobos/libdruntime/core/stdcpp/array.d b/libphobos/libdruntime/core/stdcpp/array.d
index 4cb0c56ec5f..912587c6c75 100644
--- a/libphobos/libdruntime/core/stdcpp/array.d
+++ b/libphobos/libdruntime/core/stdcpp/array.d
@@ -74,7 +74,7 @@ pure nothrow @nogc:
private:
T[N ? N : 1] _Elems;
}
- else version (CppRuntime_Gcc)
+ else version (CppRuntime_GNU)
{
///
inout(T)* data() inout @safe { static if (N > 0) { return &_M_elems[0]; } else { return null; } }
@@ -94,7 +94,7 @@ pure nothrow @nogc:
_Placeholder _M_placeholder;
}
}
- else version (CppRuntime_Clang)
+ else version (CppRuntime_LLVM)
{
///
inout(T)* data() inout @trusted { static if (N > 0) { return &__elems_[0]; } else { return cast(inout(T)*)__elems_.ptr; } }
diff --git a/libphobos/libdruntime/core/stdcpp/exception.d b/libphobos/libdruntime/core/stdcpp/exception.d
index 4774b98615b..bd3be0937f6 100644
--- a/libphobos/libdruntime/core/stdcpp/exception.d
+++ b/libphobos/libdruntime/core/stdcpp/exception.d
@@ -15,9 +15,9 @@ module core.stdcpp.exception;
import core.stdcpp.xutility : __cplusplus, CppStdRevision;
import core.attribute : weak;
-version (CppRuntime_Gcc)
+version (CppRuntime_GNU)
version = GenericBaseException;
-version (CppRuntime_Clang)
+version (CppRuntime_LLVM)
version = GenericBaseException;
version (CppRuntime_Sun)
version = GenericBaseException;
diff --git a/libphobos/libdruntime/core/stdcpp/memory.d b/libphobos/libdruntime/core/stdcpp/memory.d
index bd7976cfbc5..d7b6f173878 100644
--- a/libphobos/libdruntime/core/stdcpp/memory.d
+++ b/libphobos/libdruntime/core/stdcpp/memory.d
@@ -123,7 +123,7 @@ nothrow pure @safe @nogc:
_Compressed_pair!(Deleter, pointer) _Mypair;
}
- else version (CppRuntime_Gcc)
+ else version (CppRuntime_GNU)
{
///
ref inout(deleter_type) get_deleter() inout nothrow { return _M_t.get!1; }
@@ -136,7 +136,7 @@ nothrow pure @safe @nogc:
tuple!(pointer, Deleter) _M_t;
}
- else version (CppRuntime_Clang)
+ else version (CppRuntime_LLVM)
{
///
ref inout(deleter_type) get_deleter() inout nothrow { return __ptr_.second; }
diff --git a/libphobos/libdruntime/core/stdcpp/string.d b/libphobos/libdruntime/core/stdcpp/string.d
index 722b82fe418..0315867da60 100644
--- a/libphobos/libdruntime/core/stdcpp/string.d
+++ b/libphobos/libdruntime/core/stdcpp/string.d
@@ -31,7 +31,7 @@ version (Darwin)
version = _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT;
}
-version (CppRuntime_Gcc)
+version (CppRuntime_GNU)
{
version (_GLIBCXX_USE_CXX98_ABI)
{
@@ -894,7 +894,7 @@ extern(D):
_String_alloc!(_String_base_types!(T, Alloc)) _Base;
}
- else version (CppRuntime_Gcc)
+ else version (CppRuntime_GNU)
{
version (_GLIBCXX_USE_CXX98_ABI)
{
@@ -1873,10 +1873,10 @@ extern(D):
__d[0 .. __n] = __s[0 .. __n];
}
}
- else version (CppRuntime_Clang)
+ else version (CppRuntime_LLVM)
{
//----------------------------------------------------------------------------------
- // Clang/libc++ implementation
+ // libc++ implementation
//----------------------------------------------------------------------------------
///
diff --git a/libphobos/libdruntime/core/stdcpp/string_view.d b/libphobos/libdruntime/core/stdcpp/string_view.d
index 47f58b014ef..fd79a121be5 100644
--- a/libphobos/libdruntime/core/stdcpp/string_view.d
+++ b/libphobos/libdruntime/core/stdcpp/string_view.d
@@ -99,7 +99,7 @@ private:
alias __data = _Mydata;
alias __size = _Mysize;
}
- else version (CppRuntime_Gcc)
+ else version (CppRuntime_GNU)
{
size_t _M_len;
const(T)* _M_str;
@@ -107,7 +107,7 @@ private:
alias __data = _M_str;
alias __size = _M_len;
}
- else version (CppRuntime_Clang)
+ else version (CppRuntime_LLVM)
{
const value_type* __data;
size_type __size;
diff --git a/libphobos/libdruntime/core/stdcpp/typeinfo.d b/libphobos/libdruntime/core/stdcpp/typeinfo.d
index b8478b39414..463a813bc96 100644
--- a/libphobos/libdruntime/core/stdcpp/typeinfo.d
+++ b/libphobos/libdruntime/core/stdcpp/typeinfo.d
@@ -56,7 +56,7 @@ version (CppRuntime_Microsoft)
//virtual ~this();
}
}
-else version (CppRuntime_Gcc)
+else version (CppRuntime_GNU)
{
import core.stdcpp.exception;
@@ -110,7 +110,7 @@ else version (CppRuntime_Gcc)
@weak override const(char)* what() const nothrow { return "bad typeid"; }
}
}
-else version (CppRuntime_Clang)
+else version (CppRuntime_LLVM)
{
import core.stdcpp.exception;
diff --git a/libphobos/libdruntime/core/stdcpp/xutility.d b/libphobos/libdruntime/core/stdcpp/xutility.d
index 0142d0b9455..5e2e711ba67 100644
--- a/libphobos/libdruntime/core/stdcpp/xutility.d
+++ b/libphobos/libdruntime/core/stdcpp/xutility.d
@@ -13,7 +13,7 @@ module core.stdcpp.xutility;
@nogc:
-version (CppRuntime_Clang)
+version (CppRuntime_LLVM)
{
import core.internal.traits : AliasSeq;
enum StdNamespace = AliasSeq!("std", "__1");
@@ -349,7 +349,7 @@ package:
void _Xoverflow_error(const(char)* message) nothrow;
void _Xruntime_error(const(char)* message) nothrow;
}
-else version (CppRuntime_Clang)
+else version (CppRuntime_LLVM)
{
import core.stdcpp.type_traits : is_empty;
@@ -379,7 +379,7 @@ extern(C++, "std"):
@property ref inout(_T2) __value2_() inout nothrow @trusted @nogc { return *__get_base2(); }
}
}
-version (CppRuntime_Gcc)
+version (CppRuntime_GNU)
{
import core.atomic;
diff --git a/libphobos/libdruntime/core/sys/posix/dirent.d b/libphobos/libdruntime/core/sys/posix/dirent.d
index c7e8649d6c5..cb76573a95b 100644
--- a/libphobos/libdruntime/core/sys/posix/dirent.d
+++ b/libphobos/libdruntime/core/sys/posix/dirent.d
@@ -42,7 +42,18 @@ struct dirent
}
*/
-version (linux)
+version (CRuntime_Bionic)
+{
+ struct dirent
+ {
+ ulong d_ino;
+ long d_off;
+ ushort d_reclen;
+ ubyte d_type;
+ char[256] d_name = 0;
+ }
+}
+else version (linux)
{
struct dirent
{
diff --git a/libphobos/libdruntime/core/sys/posix/dlfcn.d b/libphobos/libdruntime/core/sys/posix/dlfcn.d
index f457c1f22b7..76542c64c8a 100644
--- a/libphobos/libdruntime/core/sys/posix/dlfcn.d
+++ b/libphobos/libdruntime/core/sys/posix/dlfcn.d
@@ -372,12 +372,20 @@ else version (Solaris)
}
else version (CRuntime_Bionic)
{
- enum
+ enum RTLD_LOCAL = 0;
+ enum RTLD_LAZY = 0x00001;
+ enum RTLD_NOLOAD = 0x00004;
+ enum RTLD_NODELETE = 0x01000;
+
+ version (D_LP64)
+ {
+ enum RTLD_NOW = 0x00002;
+ enum RTLD_GLOBAL = 0x00100;
+ }
+ else // NDK: 'LP32 is broken for historical reasons'
{
- RTLD_NOW = 0,
- RTLD_LAZY = 1,
- RTLD_LOCAL = 0,
- RTLD_GLOBAL = 2
+ enum RTLD_NOW = 0;
+ enum RTLD_GLOBAL = 0x00002;
}
int dladdr(const scope void*, Dl_info*);
diff --git a/libphobos/libdruntime/core/sys/posix/sys/stat.d b/libphobos/libdruntime/core/sys/posix/sys/stat.d
index b89478fe7d7..328f620a42a 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/stat.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/stat.d
@@ -33,6 +33,11 @@ version (RISCV64) version = RISCV_Any;
version (SPARC) version = SPARC_Any;
version (SPARC64) version = SPARC_Any;
+// Android uses 64-bit offsets for stat, but 32-bit offsets for most
+// other types on 32-bit architectures.
+version (CRuntime_Bionic)
+ private enum __USE_FILE_OFFSET64 = true;
+
version (Posix):
extern (C) nothrow @nogc:
diff --git a/libphobos/libdruntime/core/sys/posix/sys/statvfs.d b/libphobos/libdruntime/core/sys/posix/sys/statvfs.d
index eae0e5c95c6..9405a6d5387 100644
--- a/libphobos/libdruntime/core/sys/posix/sys/statvfs.d
+++ b/libphobos/libdruntime/core/sys/posix/sys/statvfs.d
@@ -84,7 +84,57 @@ version (CRuntime_Glibc) {
int statvfs (const char * file, statvfs_t* buf);
int fstatvfs (int fildes, statvfs_t *buf);
}
+}
+else version (CRuntime_Musl)
+{
+ struct statvfs_t
+ {
+ c_ulong f_bsize;
+ c_ulong f_frsize;
+ fsblkcnt_t f_blocks;
+ fsblkcnt_t f_bfree;
+ fsblkcnt_t f_bavail;
+ fsfilcnt_t f_files;
+ fsfilcnt_t f_ffree;
+ fsfilcnt_t f_favail;
+ static if (true /+__BYTE_ORDER == __LITTLE_ENDIAN+/)
+ {
+ c_ulong f_fsid;
+ byte[2*int.sizeof-c_long.sizeof] __padding;
+ }
+ else
+ {
+ byte[2*int.sizeof-c_long.sizeof] __padding;
+ c_ulong f_fsid;
+ }
+ c_ulong f_flag;
+ c_ulong f_namemax;
+ uint f_type;
+ int[5] __reserved;
+ }
+
+ enum FFlag
+ {
+ ST_RDONLY = 1, /* Mount read-only. */
+ ST_NOSUID = 2,
+ ST_NODEV = 4, /* Disallow access to device special files. */
+ ST_NOEXEC = 8, /* Disallow program execution. */
+ ST_SYNCHRONOUS = 16, /* Writes are synced at once. */
+ ST_MANDLOCK = 64, /* Allow mandatory locks on an FS. */
+ ST_WRITE = 128, /* Write on file/directory/symlink. */
+ ST_APPEND = 256, /* Append-only file. */
+ ST_IMMUTABLE = 512, /* Immutable file. */
+ ST_NOATIME = 1024, /* Do not update access times. */
+ ST_NODIRATIME = 2048, /* Do not update directory access times. */
+ ST_RELATIME = 4096 /* Update atime relative to mtime/ctime. */
+
+ }
+
+ int statvfs (const char * file, statvfs_t* buf);
+ int fstatvfs (int fildes, statvfs_t *buf);
+ alias statvfs statvfs64;
+ alias fstatvfs fstatvfs64;
}
else version (NetBSD)
{
diff --git a/libphobos/libdruntime/core/sys/windows/stacktrace.d b/libphobos/libdruntime/core/sys/windows/stacktrace.d
index 29ffc1b0785..04aafd3f602 100644
--- a/libphobos/libdruntime/core/sys/windows/stacktrace.d
+++ b/libphobos/libdruntime/core/sys/windows/stacktrace.d
@@ -48,9 +48,9 @@ public:
if (context is null)
{
version (Win64)
- static enum INTERNALFRAMES = 3;
+ enum INTERNALFRAMES = 3;
else version (Win32)
- static enum INTERNALFRAMES = 2;
+ enum INTERNALFRAMES = 2;
skip += INTERNALFRAMES; //skip the stack frames within the StackTrace class
}
@@ -58,9 +58,9 @@ public:
{
//When a exception context is given the first stack frame is repeated for some reason
version (Win64)
- static enum INTERNALFRAMES = 1;
+ enum INTERNALFRAMES = 1;
else version (Win32)
- static enum INTERNALFRAMES = 1;
+ enum INTERNALFRAMES = 1;
skip += INTERNALFRAMES;
}
diff --git a/libphobos/libdruntime/core/thread/osthread.d b/libphobos/libdruntime/core/thread/osthread.d
index 0bdb45a343f..307048135b8 100644
--- a/libphobos/libdruntime/core/thread/osthread.d
+++ b/libphobos/libdruntime/core/thread/osthread.d
@@ -2211,7 +2211,7 @@ extern (C) void thread_init() @nogc nothrow
status = sem_init( &suspendCount, 0, 0 );
assert( status == 0 );
}
- _mainThreadStore[] = __traits(initSymbol, Thread)[];
+ _mainThreadStore[] = cast(void[]) __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 f593387c755..58dd259e30d 100644
--- a/libphobos/libdruntime/core/thread/threadbase.d
+++ b/libphobos/libdruntime/core/thread/threadbase.d
@@ -778,7 +778,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);
- _mainThreadStore[] = __traits(initSymbol, ThreadT)[];
+ _mainThreadStore[] = cast(void[]) __traits(initSymbol, ThreadT)[];
ThreadBase.sm_main = null;
assert(ThreadBase.sm_tbeg && ThreadBase.sm_tlen == 1);
diff --git a/libphobos/libdruntime/gcc/sections/elf.d b/libphobos/libdruntime/gcc/sections/elf.d
index 1a3ff409d58..bbebedf345e 100644
--- a/libphobos/libdruntime/gcc/sections/elf.d
+++ b/libphobos/libdruntime/gcc/sections/elf.d
@@ -162,17 +162,10 @@ private:
}
/****
- * Boolean flag set to true while the runtime is initialized.
- */
-__gshared bool _isRuntimeInitialized;
-
-
-/****
* Gets called on program startup just before GC is initialized.
*/
void initSections() nothrow @nogc
{
- _isRuntimeInitialized = true;
}
@@ -181,7 +174,6 @@ void initSections() nothrow @nogc
*/
void finiSections() nothrow @nogc
{
- _isRuntimeInitialized = false;
}
alias ScanDG = void delegate(void* pbeg, void* pend) nothrow;
@@ -482,7 +474,7 @@ extern(C) void _d_dso_registry(CompilerDSOData* data)
}
// don't initialize modules before rt_init was called (see Bugzilla 11378)
- if (_isRuntimeInitialized)
+ if (isRuntimeInitialized())
{
registerGCRanges(pdso);
// rt_loadLibrary will run tls ctors, so do this only for dlopen
@@ -497,7 +489,7 @@ extern(C) void _d_dso_registry(CompilerDSOData* data)
*data._slot = null;
// don't finalizes modules after rt_term was called (see Bugzilla 11378)
- if (_isRuntimeInitialized)
+ if (isRuntimeInitialized())
{
// rt_unloadLibrary already ran tls dtors, so do this only for dlclose
immutable runTlsDtors = !_rtLoading;
diff --git a/libphobos/libdruntime/gcc/sections/macho.d b/libphobos/libdruntime/gcc/sections/macho.d
index 645c0f48350..7211fa77390 100644
--- a/libphobos/libdruntime/gcc/sections/macho.d
+++ b/libphobos/libdruntime/gcc/sections/macho.d
@@ -30,6 +30,7 @@ import core.sys.darwin.dlfcn;
import core.sys.darwin.mach.dyld;
import core.sys.darwin.mach.getsect;
import core.sys.posix.pthread;
+import rt.dmain2;
import rt.minfo;
import core.internal.container.array;
import core.internal.container.hashtab;
@@ -96,16 +97,10 @@ private:
}
/****
- * Boolean flag set to true while the runtime is initialized.
- */
-__gshared bool _isRuntimeInitialized;
-
-/****
* Gets called on program startup just before GC is initialized.
*/
void initSections() nothrow @nogc
{
- _isRuntimeInitialized = true;
}
/***
@@ -113,7 +108,6 @@ void initSections() nothrow @nogc
*/
void finiSections() nothrow @nogc
{
- _isRuntimeInitialized = false;
}
alias ScanDG = void delegate(void* pbeg, void* pend) nothrow;
@@ -379,7 +373,7 @@ extern(C) void _d_dso_registry(CompilerDSOData* data)
}
// don't initialize modules before rt_init was called
- if (_isRuntimeInitialized)
+ if (isRuntimeInitialized())
{
registerGCRanges(pdso);
// rt_loadLibrary will run tls ctors, so do this only for dlopen
@@ -394,7 +388,7 @@ extern(C) void _d_dso_registry(CompilerDSOData* data)
*data._slot = null;
// don't finalizes modules after rt_term was called (see Bugzilla 11378)
- if (_isRuntimeInitialized)
+ if (isRuntimeInitialized())
{
// rt_unloadLibrary already ran tls dtors, so do this only for dlclose
immutable runTlsDtors = !_rtLoading;
diff --git a/libphobos/libdruntime/gcc/sections/pecoff.d b/libphobos/libdruntime/gcc/sections/pecoff.d
index 038e37398ed..fb49f6201e0 100644
--- a/libphobos/libdruntime/gcc/sections/pecoff.d
+++ b/libphobos/libdruntime/gcc/sections/pecoff.d
@@ -29,6 +29,7 @@ import core.stdc.stdlib;
import core.sys.windows.winbase;
import core.sys.windows.windef;
import core.sys.windows.winnt;
+import rt.dmain2;
import rt.minfo;
import core.internal.container.array;
import core.internal.container.hashtab;
@@ -95,16 +96,10 @@ private:
}
/****
- * Boolean flag set to true while the runtime is initialized.
- */
-__gshared bool _isRuntimeInitialized;
-
-/****
* Gets called on program startup just before GC is initialized.
*/
void initSections() nothrow @nogc
{
- _isRuntimeInitialized = true;
}
/***
@@ -112,7 +107,6 @@ void initSections() nothrow @nogc
*/
void finiSections() nothrow @nogc
{
- _isRuntimeInitialized = false;
}
alias ScanDG = void delegate(void* pbeg, void* pend) nothrow;
@@ -372,7 +366,7 @@ extern(C) void _d_dso_registry(CompilerDSOData* data)
}
// don't initialize modules before rt_init was called
- if (_isRuntimeInitialized)
+ if (isRuntimeInitialized())
{
registerGCRanges(pdso);
// rt_loadLibrary will run tls ctors, so do this only for dlopen
@@ -387,7 +381,7 @@ extern(C) void _d_dso_registry(CompilerDSOData* data)
*data._slot = null;
// don't finalizes modules after rt_term was called (see Bugzilla 11378)
- if (_isRuntimeInitialized)
+ if (isRuntimeInitialized())
{
// rt_unloadLibrary already ran tls dtors, so do this only for dlclose
immutable runTlsDtors = !_rtLoading;
diff --git a/libphobos/libdruntime/rt/aaA.d b/libphobos/libdruntime/rt/aaA.d
index 5903d9cd754..26c16d3af0a 100644
--- a/libphobos/libdruntime/rt/aaA.d
+++ b/libphobos/libdruntime/rt/aaA.d
@@ -688,7 +688,7 @@ extern (C) inout(void[]) _aaValues(inout AA aa, const size_t keysz, const size_t
{
if (!b.filled)
continue;
- pval[0 .. valsz] = b.entry[off .. valsz + off];
+ pval[0 .. valsz] = cast(void[]) b.entry[off .. valsz + off];
pval += valsz;
}
// postblit is done in object.values
@@ -710,7 +710,7 @@ extern (C) inout(void[]) _aaKeys(inout AA aa, const size_t keysz, const TypeInfo
{
if (!b.filled)
continue;
- pkey[0 .. keysz] = b.entry[0 .. keysz];
+ pkey[0 .. keysz] = cast(void[]) b.entry[0 .. keysz];
pkey += keysz;
}
// postblit is done in object.keys
diff --git a/libphobos/libdruntime/rt/dmain2.d b/libphobos/libdruntime/rt/dmain2.d
index 5ac053cef15..052b859fd49 100644
--- a/libphobos/libdruntime/rt/dmain2.d
+++ b/libphobos/libdruntime/rt/dmain2.d
@@ -102,7 +102,7 @@ alias void delegate(Throwable) ExceptionHandler;
/**
* Keep track of how often rt_init/rt_term were called.
*/
-shared size_t _initCount;
+private shared size_t _initCount;
/**********************************************
* Initialize druntime.
@@ -177,6 +177,13 @@ extern (C) int rt_term()
return 0;
}
+/**
+ * Indicates whether druntime has been or is being initialized.
+ */
+bool isRuntimeInitialized() @nogc nothrow {
+ return atomicLoad!(MemoryOrder.raw)(_initCount) != 0;
+}
+
/**********************************************
* Trace handler
*/
diff --git a/libphobos/libdruntime/rt/lifetime.d b/libphobos/libdruntime/rt/lifetime.d
index 4a071f3d81b..676f88d5ae4 100644
--- a/libphobos/libdruntime/rt/lifetime.d
+++ b/libphobos/libdruntime/rt/lifetime.d
@@ -129,7 +129,7 @@ extern (C) Object _d_newclass(const ClassInfo ci) @weak
}
// initialize it
- p[0 .. init.length] = init[];
+ p[0 .. init.length] = cast(void[]) init[];
debug(PRINTF) printf("initialization done\n");
return cast(Object) p;
@@ -1294,7 +1294,7 @@ extern (C) void rt_finalize2(void* p, bool det = true, bool resetMemory = true)
if (resetMemory)
{
auto w = (*pc).initializer;
- p[0 .. w.length] = w[];
+ p[0 .. w.length] = cast(void[]) w[];
}
}
catch (Exception e)
diff --git a/libphobos/libdruntime/rt/sections.d b/libphobos/libdruntime/rt/sections.d
index 6a155520340..a7b75d4ba81 100644
--- a/libphobos/libdruntime/rt/sections.d
+++ b/libphobos/libdruntime/rt/sections.d
@@ -57,7 +57,7 @@ else version (Darwin)
else version (CRuntime_Microsoft)
public import rt.sections_win64;
else version (CRuntime_Bionic)
- public import rt.sections_android;
+ public import rt.sections_elf_shared;
else version (CRuntime_UClibc)
public import rt.sections_elf_shared;
else