diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2022-06-13 10:41:57 +0200 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2022-06-13 11:38:10 +0200 |
commit | ec486b739b83ffdbe40c5ececb20d16c94d6b0d0 (patch) | |
tree | 9a3c04628df45a6dca9288e2c44b089c957e426d /libphobos | |
parent | 13ea4a6e830da1f245136601e636dec62e74d1a7 (diff) | |
download | gcc-ec486b739b83ffdbe40c5ececb20d16c94d6b0d0.zip gcc-ec486b739b83ffdbe40c5ececb20d16c94d6b0d0.tar.gz gcc-ec486b739b83ffdbe40c5ececb20d16c94d6b0d0.tar.bz2 |
d: Merge upstream dmd 821ed393d, druntime 454471d8, phobos 1206fc94f.
D front-end changes:
- Import latest bug fixes to mainline.
D runtime changes:
- Fix duplicate Elf64_Dyn definitions on Solaris.
- _d_newThrowable has been converted to a template.
Phobos changes:
- Import latest bug fixes to mainline.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd 821ed393d.
* expr.cc (ExprVisitor::visit (NewExp *)): Remove handled of
allocating `@nogc' throwable object.
* runtime.def (NEWTHROW): Remove.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime 454471d8.
* libdruntime/Makefile.am (DRUNTIME_DSOURCES): Add
core/sync/package.d.
* libdruntime/Makefile.in: Regenerate.
* src/MERGE: Merge upstream phobos 1206fc94f.
Diffstat (limited to 'libphobos')
24 files changed, 203 insertions, 395 deletions
diff --git a/libphobos/libdruntime/MERGE b/libphobos/libdruntime/MERGE index d503bae..8b2839d 100644 --- a/libphobos/libdruntime/MERGE +++ b/libphobos/libdruntime/MERGE @@ -1,4 +1,4 @@ -f89da31331ef5df50d3bc7a26efd1b7acdefde8c +454471d8077d12ec6bf0ae8fcd9571aad1bce7be 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 260bb63..d963aa9 100644 --- a/libphobos/libdruntime/Makefile.am +++ b/libphobos/libdruntime/Makefile.am @@ -200,9 +200,9 @@ DRUNTIME_DSOURCES = core/atomic.d core/attribute.d core/bitop.d \ core/stdc/tgmath.d core/stdc/time.d core/stdc/wchar_.d \ core/stdc/wctype.d core/sync/barrier.d core/sync/condition.d \ core/sync/config.d core/sync/event.d core/sync/exception.d \ - core/sync/mutex.d core/sync/rwmutex.d core/sync/semaphore.d \ - core/thread/context.d core/thread/fiber.d core/thread/osthread.d \ - core/thread/package.d core/thread/threadbase.d \ + core/sync/mutex.d core/sync/package.d core/sync/rwmutex.d \ + core/sync/semaphore.d core/thread/context.d core/thread/fiber.d \ + core/thread/osthread.d core/thread/package.d core/thread/threadbase.d \ core/thread/threadgroup.d core/thread/types.d core/time.d \ core/vararg.d core/volatile.d gcc/attribute.d gcc/attributes.d \ gcc/backtrace.d gcc/builtins.d gcc/deh.d gcc/emutls.d gcc/gthread.d \ diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in index b7e2f34..45e086a 100644 --- a/libphobos/libdruntime/Makefile.in +++ b/libphobos/libdruntime/Makefile.in @@ -226,17 +226,18 @@ am__objects_1 = core/atomic.lo core/attribute.lo core/bitop.lo \ core/stdc/tgmath.lo core/stdc/time.lo core/stdc/wchar_.lo \ core/stdc/wctype.lo core/sync/barrier.lo \ core/sync/condition.lo core/sync/config.lo core/sync/event.lo \ - core/sync/exception.lo core/sync/mutex.lo core/sync/rwmutex.lo \ - core/sync/semaphore.lo core/thread/context.lo \ - core/thread/fiber.lo core/thread/osthread.lo \ - core/thread/package.lo core/thread/threadbase.lo \ - core/thread/threadgroup.lo core/thread/types.lo core/time.lo \ - core/vararg.lo core/volatile.lo gcc/attribute.lo \ - gcc/attributes.lo gcc/backtrace.lo gcc/builtins.lo gcc/deh.lo \ - gcc/emutls.lo gcc/gthread.lo gcc/sections/common.lo \ - gcc/sections/elf.lo gcc/sections/macho.lo \ - gcc/sections/package.lo gcc/sections/pecoff.lo \ - gcc/unwind/arm.lo gcc/unwind/arm_common.lo gcc/unwind/c6x.lo \ + core/sync/exception.lo core/sync/mutex.lo core/sync/package.lo \ + core/sync/rwmutex.lo core/sync/semaphore.lo \ + core/thread/context.lo core/thread/fiber.lo \ + core/thread/osthread.lo core/thread/package.lo \ + core/thread/threadbase.lo core/thread/threadgroup.lo \ + core/thread/types.lo core/time.lo core/vararg.lo \ + core/volatile.lo gcc/attribute.lo gcc/attributes.lo \ + gcc/backtrace.lo gcc/builtins.lo gcc/deh.lo gcc/emutls.lo \ + gcc/gthread.lo gcc/sections/common.lo gcc/sections/elf.lo \ + gcc/sections/macho.lo gcc/sections/package.lo \ + gcc/sections/pecoff.lo gcc/unwind/arm.lo \ + gcc/unwind/arm_common.lo gcc/unwind/c6x.lo \ gcc/unwind/generic.lo gcc/unwind/package.lo gcc/unwind/pe.lo \ object.lo rt/aApply.lo rt/aApplyR.lo rt/aaA.lo rt/adi.lo \ rt/arrayassign.lo rt/arraycat.lo rt/cast_.lo rt/config.lo \ @@ -866,9 +867,9 @@ DRUNTIME_DSOURCES = core/atomic.d core/attribute.d core/bitop.d \ core/stdc/tgmath.d core/stdc/time.d core/stdc/wchar_.d \ core/stdc/wctype.d core/sync/barrier.d core/sync/condition.d \ core/sync/config.d core/sync/event.d core/sync/exception.d \ - core/sync/mutex.d core/sync/rwmutex.d core/sync/semaphore.d \ - core/thread/context.d core/thread/fiber.d core/thread/osthread.d \ - core/thread/package.d core/thread/threadbase.d \ + core/sync/mutex.d core/sync/package.d core/sync/rwmutex.d \ + core/sync/semaphore.d core/thread/context.d core/thread/fiber.d \ + core/thread/osthread.d core/thread/package.d core/thread/threadbase.d \ core/thread/threadgroup.d core/thread/types.d core/time.d \ core/vararg.d core/volatile.d gcc/attribute.d gcc/attributes.d \ gcc/backtrace.d gcc/builtins.d gcc/deh.d gcc/emutls.d gcc/gthread.d \ @@ -1305,6 +1306,7 @@ core/sync/config.lo: core/sync/$(am__dirstamp) core/sync/event.lo: core/sync/$(am__dirstamp) core/sync/exception.lo: core/sync/$(am__dirstamp) core/sync/mutex.lo: core/sync/$(am__dirstamp) +core/sync/package.lo: core/sync/$(am__dirstamp) core/sync/rwmutex.lo: core/sync/$(am__dirstamp) core/sync/semaphore.lo: core/sync/$(am__dirstamp) core/thread/$(am__dirstamp): diff --git a/libphobos/libdruntime/core/attribute.d b/libphobos/libdruntime/core/attribute.d index 69b20f0..8a1dc8a 100644 --- a/libphobos/libdruntime/core/attribute.d +++ b/libphobos/libdruntime/core/attribute.d @@ -76,14 +76,14 @@ else * The attribute can only be attached to methods or constructors which * have Objective-C linkage. That is, a method or a constructor in a * class or interface declared as $(D_CODE extern(Objective-C)). - * ), + * ) * - * $(LI It cannot be attached to a method or constructor that is a template), + * $(LI It cannot be attached to a method or constructor that is a template) * * $(LI * The number of colons in the string need to match the number of * arguments the method accept. - * ), + * ) * * $(LI It can only be used once in a method declaration) * ) @@ -181,21 +181,21 @@ version (UdaOptional) * $(UL * $(LI * There can only be one such attribute per symbol. - * ), + * ) * $(LI * The attribute can only be attached to an `extern(C++)` symbol * (`struct`, `class`, `enum`, function, and their templated counterparts). - * ), + * ) * $(LI * The attribute cannot be applied to C++ namespaces. * This is to prevent confusion with the C++ semantic, which allows it to * be applied to namespaces. - * ), + * ) * $(LI * The string arguments must only contain valid characters * for C++ name mangling which currently include alphanumerics * and the underscore character. - * ), + * ) * ) * * This UDA is not transitive, and inner scope do not inherit outer scopes' @@ -252,11 +252,11 @@ version (UdaGNUAbiTag) struct gnuAbiTag * $(LI * the expression is the top-level expression in a statement or the * left-hand expression in a comma expression, and - * ), + * ) * $(LI * the expression is not an assignment (`=`, `+=`, etc.), increment * (`++`), or decrement (`--`) expression. - * ), + * ) * ) * * If the declaration of a `struct` or `union` type has the `@mustuse` diff --git a/libphobos/libdruntime/core/internal/array/equality.d b/libphobos/libdruntime/core/internal/array/equality.d index b12e2f2..d3fdd65 100644 --- a/libphobos/libdruntime/core/internal/array/equality.d +++ b/libphobos/libdruntime/core/internal/array/equality.d @@ -21,8 +21,7 @@ bool __equals(T1, T2)(scope const T1[] lhs, scope const T2[] rhs) @nogc nothrow pure @trusted if (__traits(isScalar, T1) && __traits(isScalar, T2)) { - if (lhs.length != rhs.length) - return false; + const length = lhs.length; static if (T1.sizeof == T2.sizeof // Signedness needs to match for types that promote to int. @@ -31,20 +30,21 @@ if (__traits(isScalar, T1) && __traits(isScalar, T2)) && (T1.sizeof >= 4 || __traits(isUnsigned, T1) == __traits(isUnsigned, T2)) && !__traits(isFloating, T1) && !__traits(isFloating, T2)) { - if (!__ctfe) + if (__ctfe) + return length == rhs.length && isEqual(lhs.ptr, rhs.ptr, length); + else { // This would improperly allow equality of integers and pointers // but the CTFE branch will stop this function from compiling then. import core.stdc.string : memcmp; - return lhs.length == 0 || - 0 == memcmp(cast(const void*) lhs.ptr, cast(const void*) rhs.ptr, lhs.length * T1.sizeof); + return length == rhs.length && + (!length || 0 == memcmp(cast(const void*) lhs.ptr, cast(const void*) rhs.ptr, length * T1.sizeof)); } } - - foreach (const i; 0 .. lhs.length) - if (lhs.ptr[i] != rhs.ptr[i]) - return false; - return true; + else + { + return length == rhs.length && isEqual(lhs.ptr, rhs.ptr, length); + } } bool __equals(T1, T2)(scope T1[] lhs, scope T2[] rhs) @@ -89,6 +89,19 @@ if (!__traits(isScalar, T1) || !__traits(isScalar, T2)) } } +/****************************** + * Helper function for __equals(). + * Outlined to enable __equals() to be inlined, as dmd cannot inline loops. + */ +private +bool isEqual(T1, T2)(scope const T1* t1, scope const T2* t2, size_t length) +{ + foreach (const i; 0 .. length) + if (t1[i] != t2[i]) + return false; + return true; +} + @safe unittest { assert(__equals([], [])); diff --git a/libphobos/libdruntime/core/lifetime.d b/libphobos/libdruntime/core/lifetime.d index 6502e59..371308d 100644 --- a/libphobos/libdruntime/core/lifetime.d +++ b/libphobos/libdruntime/core/lifetime.d @@ -2648,16 +2648,19 @@ if (!Init.length || } /** - * Allocate an exception of type `T` from the exception pool and call its constructor. - * It has the same interface as `rt.lifetime._d_newclass()`. - * `T` must be Throwable or derived from it, must declare an explicit ctor - * and cannot be a COM or C++ class. + * Allocate an exception of type `T` from the exception pool. + * `T` must be `Throwable` or derived from it and cannot be a COM or C++ class. + * + * Note: + * This function does not call the constructor of `T` because that would require + * `forward!args`, which causes errors with -dip1008. This inconvenience will be + * removed once -dip1008 works as intended. + * * Returns: - * constructed instance of the type + * allocated instance of type `T` */ -T _d_newThrowable(T, Args...)(auto ref Args args) @trusted - if (is(T : Throwable) && is(typeof(T.__ctor(forward!args))) && - __traits(getLinkage, T) == "D") +T _d_newThrowable(T)() @trusted + if (is(T : Throwable) && __traits(getLinkage, T) == "D") { debug(PRINTF) printf("_d_newThrowable(%s)\n", cast(char*) T.stringof); @@ -2687,33 +2690,22 @@ T _d_newThrowable(T, Args...)(auto ref Args args) @trusted (cast(Throwable) p).refcount() = 1; - auto t = cast(T) p; - t.__ctor(forward!args); - - return t; + return cast(T) p; } @system unittest { class E : Exception { - int x; - - this(int x, string msg = "", Throwable nextInChain = null) + this(string msg = "", Throwable nextInChain = null) { super(msg, nextInChain); - this.x = x; } } - auto exc = _d_newThrowable!Exception("Exception"); - assert(exc.refcount() == 1); - assert(exc.msg == "Exception"); - - static assert(!__traits(compiles, _d_newThrowable!E())); + Throwable exc = _d_newThrowable!Exception(); + Throwable e = _d_newThrowable!E(); - auto e = _d_newThrowable!E(42, "E", null); + assert(exc.refcount() == 1); assert(e.refcount() == 1); - assert(e.x == 42); - assert(e.msg == "E"); } diff --git a/libphobos/libdruntime/core/stdcpp/xutility.d b/libphobos/libdruntime/core/stdcpp/xutility.d index fa61701..0142d0b9 100644 --- a/libphobos/libdruntime/core/stdcpp/xutility.d +++ b/libphobos/libdruntime/core/stdcpp/xutility.d @@ -23,14 +23,27 @@ else enum StdNamespace = "std"; } +/** + * Possible values of the `__cplusplus` macro provided by C++ compilers + * + * For foolproofness, use ordering comparison, e.g. `__cplusplus >= CppStdRevision.cpp17`. + */ enum CppStdRevision : uint { cpp98 = 199711, cpp11 = 201103, cpp14 = 201402, - cpp17 = 201703 + cpp17 = 201703, + cpp20 = 202002, } +/** + * Returns the target C++ version, encoded as C++ compilers do + * + * C++ compilers provide a `__cplusplus` macro which returns an integer + * representing the targetted standard. This manifest provides the same + * interface, retrieved from the compiler via a `__traits`. + */ enum __cplusplus = __traits(getTargetInfo, "cppStd"); // wrangle C++ features diff --git a/libphobos/libdruntime/core/sys/dragonflybsd/sys/elf32.d b/libphobos/libdruntime/core/sys/dragonflybsd/sys/elf32.d index 2662fdb..c796cd8 100644 --- a/libphobos/libdruntime/core/sys/dragonflybsd/sys/elf32.d +++ b/libphobos/libdruntime/core/sys/dragonflybsd/sys/elf32.d @@ -18,6 +18,16 @@ alias Elf32_Word Elf32_Hashelt; alias Elf32_Word Elf32_Size; alias Elf32_Sword Elf32_Ssize; +struct Elf32_Dyn +{ + Elf32_Sword d_tag; + union _d_un + { + Elf32_Word d_val; + Elf32_Addr d_ptr; + } _d_un d_un; +} + alias Elf_Note Elf32_Nhdr; struct Elf32_Cap diff --git a/libphobos/libdruntime/core/sys/dragonflybsd/sys/elf64.d b/libphobos/libdruntime/core/sys/dragonflybsd/sys/elf64.d index 6431bd2..89e3ca3 100644 --- a/libphobos/libdruntime/core/sys/dragonflybsd/sys/elf64.d +++ b/libphobos/libdruntime/core/sys/dragonflybsd/sys/elf64.d @@ -18,6 +18,16 @@ alias Elf64_Word Elf64_Hashelt; alias Elf64_Xword Elf64_Size; alias Elf64_Sxword Elf64_Ssize; +struct Elf64_Dyn +{ + Elf64_Sxword d_tag; + union _d_un + { + Elf64_Xword d_val; + Elf64_Addr d_ptr; + } _d_un d_un; +} + extern (D) pure { auto ELF64_R_TYPE_DATA(I)(I i) { return (cast(Elf64_Xword) i << 32) >> 40; } diff --git a/libphobos/libdruntime/core/sys/elf/package.d b/libphobos/libdruntime/core/sys/elf/package.d index 5de897a..69e5209 100644 --- a/libphobos/libdruntime/core/sys/elf/package.d +++ b/libphobos/libdruntime/core/sys/elf/package.d @@ -617,26 +617,6 @@ enum PF_R = (1 << 2); enum PF_MASKOS = 0x0ff00000; enum PF_MASKPROC = 0xf0000000; -struct Elf32_Dyn -{ - Elf32_Sword d_tag; - union _d_un - { - Elf32_Word d_val; - Elf32_Addr d_ptr; - } _d_un d_un; -} - -struct Elf64_Dyn -{ - Elf64_Sxword d_tag; - union _d_un - { - Elf64_Xword d_val; - Elf64_Addr d_ptr; - } _d_un d_un; -} - enum DT_NULL = 0; enum DT_NEEDED = 1; enum DT_PLTRELSZ = 2; diff --git a/libphobos/libdruntime/core/sys/freebsd/sys/elf32.d b/libphobos/libdruntime/core/sys/freebsd/sys/elf32.d index 134cdf0..4e8ae28 100644 --- a/libphobos/libdruntime/core/sys/freebsd/sys/elf32.d +++ b/libphobos/libdruntime/core/sys/freebsd/sys/elf32.d @@ -18,6 +18,16 @@ alias Elf32_Word Elf32_Hashelt; alias Elf32_Word Elf32_Size; alias Elf32_Sword Elf32_Ssize; +struct Elf32_Dyn +{ + Elf32_Sword d_tag; + union _d_un + { + Elf32_Word d_val; + Elf32_Addr d_ptr; + } _d_un d_un; +} + alias Elf_Note Elf32_Nhdr; struct Elf32_Cap diff --git a/libphobos/libdruntime/core/sys/freebsd/sys/elf64.d b/libphobos/libdruntime/core/sys/freebsd/sys/elf64.d index 6952821..c56460c 100644 --- a/libphobos/libdruntime/core/sys/freebsd/sys/elf64.d +++ b/libphobos/libdruntime/core/sys/freebsd/sys/elf64.d @@ -18,6 +18,16 @@ alias Elf64_Word Elf64_Hashelt; alias Elf64_Xword Elf64_Size; alias Elf64_Sxword Elf64_Ssize; +struct Elf64_Dyn +{ + Elf64_Sxword d_tag; + union _d_un + { + Elf64_Xword d_val; + Elf64_Addr d_ptr; + } _d_un d_un; +} + extern (D) { auto ELF64_R_TYPE_DATA(I)(I i) { return (cast(Elf64_Xword) i << 32) >> 40; } diff --git a/libphobos/libdruntime/core/sys/linux/elf.d b/libphobos/libdruntime/core/sys/linux/elf.d index 2cd93317..168b936 100644 --- a/libphobos/libdruntime/core/sys/linux/elf.d +++ b/libphobos/libdruntime/core/sys/linux/elf.d @@ -75,6 +75,26 @@ enum NT_ARM_HW_WATCH = 0x403; enum NT_VERSION = 1; +struct Elf32_Dyn +{ + Elf32_Sword d_tag; + union _d_un + { + Elf32_Word d_val; + Elf32_Addr d_ptr; + } _d_un d_un; +} + +struct Elf64_Dyn +{ + Elf64_Sxword d_tag; + union _d_un + { + Elf64_Xword d_val; + Elf64_Addr d_ptr; + } _d_un d_un; +} + enum NT_GNU_ABI_TAG = 1; enum NT_GNU_HWCAP = 2; enum NT_GNU_BUILD_ID = 3; diff --git a/libphobos/libdruntime/core/sys/netbsd/sys/elf32.d b/libphobos/libdruntime/core/sys/netbsd/sys/elf32.d index ce7d8ba..48386f6 100644 --- a/libphobos/libdruntime/core/sys/netbsd/sys/elf32.d +++ b/libphobos/libdruntime/core/sys/netbsd/sys/elf32.d @@ -18,6 +18,16 @@ alias Elf32_Word Elf32_Hashelt; alias Elf32_Word Elf32_Size; alias Elf32_Sword Elf32_Ssize; +struct Elf32_Dyn +{ + Elf32_Sword d_tag; + union _d_un + { + Elf32_Word d_val; + Elf32_Addr d_ptr; + } _d_un d_un; +} + alias Elf_Note Elf32_Nhdr; struct Elf32_Cap diff --git a/libphobos/libdruntime/core/sys/netbsd/sys/elf64.d b/libphobos/libdruntime/core/sys/netbsd/sys/elf64.d index 7fa9a8b..3eeaa90 100644 --- a/libphobos/libdruntime/core/sys/netbsd/sys/elf64.d +++ b/libphobos/libdruntime/core/sys/netbsd/sys/elf64.d @@ -18,6 +18,16 @@ alias Elf64_Word Elf64_Hashelt; alias Elf64_Xword Elf64_Size; alias Elf64_Sxword Elf64_Ssize; +struct Elf64_Dyn +{ + Elf64_Sxword d_tag; + union _d_un + { + Elf64_Xword d_val; + Elf64_Addr d_ptr; + } _d_un d_un; +} + extern (D) { auto ELF64_R_TYPE_DATA(I)(I i) { return (cast(Elf64_Xword) i << 32) >> 40; } diff --git a/libphobos/libdruntime/core/sys/openbsd/sys/elf32.d b/libphobos/libdruntime/core/sys/openbsd/sys/elf32.d index 342282b..c561121 100644 --- a/libphobos/libdruntime/core/sys/openbsd/sys/elf32.d +++ b/libphobos/libdruntime/core/sys/openbsd/sys/elf32.d @@ -19,6 +19,16 @@ alias Elf32_Word Elf32_Hashelt; alias Elf32_Word Elf32_Size; alias Elf32_Sword Elf32_Ssize; +struct Elf32_Dyn +{ + Elf32_Sword d_tag; + union _d_un + { + Elf32_Word d_val; + Elf32_Addr d_ptr; + } _d_un d_un; +} + alias Elf_Note Elf32_Nhdr; struct Elf32_Cap diff --git a/libphobos/libdruntime/core/sys/openbsd/sys/elf64.d b/libphobos/libdruntime/core/sys/openbsd/sys/elf64.d index b76d669..47f84d4 100644 --- a/libphobos/libdruntime/core/sys/openbsd/sys/elf64.d +++ b/libphobos/libdruntime/core/sys/openbsd/sys/elf64.d @@ -19,6 +19,16 @@ alias Elf64_Word Elf64_Hashelt; alias Elf64_Xword Elf64_Size; alias Elf64_Sxword Elf64_Ssize; +struct Elf64_Dyn +{ + Elf64_Sxword d_tag; + union _d_un + { + Elf64_Xword d_val; + Elf64_Addr d_ptr; + } _d_un d_un; +} + extern (D) pure { auto ELF64_R_TYPE_DATA(I)(I i) { return (cast(Elf64_Xword) i << 32) >> 40; } diff --git a/libphobos/libdruntime/core/sys/solaris/sys/elftypes.d b/libphobos/libdruntime/core/sys/solaris/sys/elftypes.d index a43cc5a..fe8cfef 100644 --- a/libphobos/libdruntime/core/sys/solaris/sys/elftypes.d +++ b/libphobos/libdruntime/core/sys/solaris/sys/elftypes.d @@ -11,18 +11,12 @@ nothrow: import core.stdc.stdint; -alias uint32_t Elf32_Addr; -alias uint16_t Elf32_Half; -alias uint32_t Elf32_Off; -alias int32_t Elf32_Sword; -alias uint32_t Elf32_Word; +public import core.sys.elf : + Elf32_Addr, Elf32_Half, Elf32_Off, + Elf32_Sword, Elf32_Word, + Elf64_Addr, Elf64_Half, Elf64_Off, + Elf64_Sword, Elf64_Sxword, + Elf64_Word, Elf64_Xword; -alias uint64_t Elf64_Addr; -alias uint16_t Elf64_Half; -alias uint64_t Elf64_Off; -alias int32_t Elf64_Sword; -alias int64_t Elf64_Sxword; -alias uint32_t Elf64_Word; -alias uint64_t Elf64_Xword; alias uint64_t Elf64_Lword; alias uint64_t Elf32_Lword; diff --git a/libphobos/libdruntime/core/sys/solaris/sys/link.d b/libphobos/libdruntime/core/sys/solaris/sys/link.d index d9d47c0..9176b17 100644 --- a/libphobos/libdruntime/core/sys/solaris/sys/link.d +++ b/libphobos/libdruntime/core/sys/solaris/sys/link.d @@ -10,6 +10,7 @@ extern (C): nothrow: public import core.sys.solaris.sys.elftypes; +public import core.sys.elf; import core.stdc.config; struct Elf32_Dyn @@ -33,45 +34,8 @@ struct Elf64_Dyn } _d_un d_un; } -enum DT_NULL = 0; -enum DT_NEEDED = 1; -enum DT_PLTRELSZ = 2; -enum DT_PLTGOT = 3; -enum DT_HASH = 4; -enum DT_STRTAB = 5; -enum DT_SYMTAB = 6; -enum DT_RELA = 7; -enum DT_RELASZ = 8; -enum DT_RELAENT = 9; -enum DT_STRSZ = 10; -enum DT_SYMENT = 11; -enum DT_INIT = 12; -enum DT_FINI = 13; -enum DT_SONAME = 14; -enum DT_RPATH = 15; -enum DT_SYMBOLIC = 16; -enum DT_REL = 17; -enum DT_RELSZ = 18; -enum DT_RELENT = 19; -enum DT_PLTREL = 20; -enum DT_DEBUG = 21; -enum DT_TEXTREL = 22; -enum DT_JMPREL = 23; -enum DT_BIND_NOW = 24; -enum DT_INIT_ARRAY = 25; -enum DT_FINI_ARRAY = 26; -enum DT_INIT_ARRAYSZ = 27; -enum DT_FINI_ARRAYSZ = 28; -enum DT_RUNPATH = 29; -enum DT_FLAGS = 30; - -enum DT_ENCODING = 32; -enum DT_PREINIT_ARRAY = 32; -enum DT_PREINIT_ARRAYSZ = 33; - enum DT_MAXPOSTAGS = 34; -enum DT_LOOS = 0x6000000d; enum DT_SUNW_AUXILIARY = 0x6000000d; enum DT_SUNW_RTLDINF = 0x6000000e; enum DT_SUNW_FILTER = 0x6000000f; @@ -92,205 +56,15 @@ enum DT_SUNW_LDMACH = 0x6000001b; enum DT_SUNW_CAPCHAINENT = 0x6000001d; enum DT_SUNW_CAPCHAINSZ = 0x6000001f; -enum DT_HIOS = 0x6ffff000; - enum DT_DEPRECATED_SPARC_REGISTER = 0x7000001; -enum DT_VALRNGLO = 0x6ffffd00; - -enum DT_GNU_PRELINKED = 0x6ffffdf5; -enum DT_GNU_CONFLICTSZ = 0x6ffffdf6; -enum DT_GNU_LIBLISTSZ = 0x6ffffdf7; -enum DT_CHECKSUM = 0x6ffffdf8; -enum DT_PLTPADSZ = 0x6ffffdf9; -enum DT_MOVEENT = 0x6ffffdfa; -enum DT_MOVESZ = 0x6ffffdfb; -enum DT_FEATURE_1 = 0x6ffffdfc; -enum DT_POSFLAG_1 = 0x6ffffdfd; -enum DT_SYMINSZ = 0x6ffffdfe; -enum DT_SYMINENT = 0x6ffffdff; -enum DT_VALRNGHI = 0x6ffffdff; - -enum DT_ADDRRNGLO = 0x6ffffe00; - -enum DT_GNU_HASH = 0x6ffffef5; -enum DT_TLSDESC_PLT = 0x6ffffef6; -enum DT_TLSDESC_GOT = 0x6ffffef7; -enum DT_GNU_CONFLICT = 0x6ffffef8; -enum DT_GNU_LIBLIST = 0x6ffffef9; - -enum DT_CONFIG = 0x6ffffefa; -enum DT_DEPAUDIT = 0x6ffffefb; -enum DT_AUDIT = 0x6ffffefc; -enum DT_PLTPAD = 0x6ffffefd; -enum DT_MOVETAB = 0x6ffffefe; -enum DT_SYMINFO = 0x6ffffeff; -enum DT_ADDRRNGHI = 0x6ffffeff; - -enum DT_VERSYM = 0x6ffffff0; - -enum DT_RELACOUNT = 0x6ffffff9; -enum DT_RELCOUNT = 0x6ffffffa; -enum DT_FLAGS_1 = 0x6ffffffb; -enum DT_VERDEF = 0x6ffffffc; -enum DT_VERDEFNUM = 0x6ffffffd; -enum DT_VERNEED = 0x6ffffffe; -enum DT_VERNEEDNUM = 0x6fffffff; - -enum DT_LOPROC = 0x70000000; -enum DT_AUXILIARY = 0x7ffffffd; enum DT_USED = 0x7ffffffe; -enum DT_FILTER = 0x7fffffff; -enum DT_HIPROC = 0x7fffffff; -enum DF_ORIGIN = 0x00000001; -enum DF_SYMBOLIC = 0x00000002; -enum DF_TEXTREL = 0x00000004; -enum DF_BIND_NOW = 0x00000008; -enum DF_STATIC_TLS = 0x00000010; - -enum DF_P1_LAZYLOAD = 0x00000001; -enum DF_P1_GROUPPERM = 0x00000002; enum DF_P1_DEFERRED = 0x00000004; -enum DF_1_NOW = 0x00000001; -enum DF_1_GLOBAL = 0x00000002; -enum DF_1_GROUP = 0x00000004; -enum DF_1_NODELETE = 0x00000008; -enum DF_1_LOADFLTR = 0x00000010; -enum DF_1_INITFIRST = 0x00000020; -enum DF_1_NOOPEN = 0x00000040; -enum DF_1_ORIGIN = 0x00000080; -enum DF_1_DIRECT = 0x00000100; -enum DF_1_TRANS = 0x00000200; -enum DF_1_INTERPOSE = 0x00000400; -enum DF_1_NODEFLIB = 0x00000800; -enum DF_1_NODUMP = 0x00001000; -enum DF_1_CONFALT = 0x00002000; -enum DF_1_ENDFILTEE = 0x00004000; -enum DF_1_DISPRELDNE = 0x00008000; -enum DF_1_DISPRELPND = 0x00010000; -enum DF_1_NODIRECT = 0x00020000; -enum DF_1_IGNMULDEF = 0x00040000; -enum DF_1_NOKSYMS = 0x00080000; -enum DF_1_NOHDR = 0x00100000; -enum DF_1_EDITED = 0x00200000; -enum DF_1_NORELOC = 0x00400000; -enum DF_1_SYMINTPOSE = 0x00800000; -enum DF_1_GLOBAUDIT = 0x01000000; -enum DF_1_SINGLETON = 0x02000000; - -enum DTF_1_PARINIT = 0x00000001; -enum DTF_1_CONFEXP = 0x00000002; - -struct Elf32_Verdef -{ - Elf32_Half vd_version; - Elf32_Half vd_flags; - Elf32_Half vd_ndx; - Elf32_Half vd_cnt; - Elf32_Word vd_hash; - Elf32_Word vd_aux; - Elf32_Word vd_next; -} - -struct Elf32_Verdaux -{ - Elf32_Word vda_name; - Elf32_Word vda_next; -} - -struct Elf32_Verneed -{ - Elf32_Half vn_version; - Elf32_Half vn_cnt; - Elf32_Word vn_file; - Elf32_Word vn_aux; - Elf32_Word vn_next; -} - -struct Elf32_Vernaux -{ - Elf32_Word vna_hash; - Elf32_Half vna_flags; - Elf32_Half vna_other; - Elf32_Word vna_name; - Elf32_Word vna_next; -} - -alias Elf32_Half Elf32_Versym; - -struct Elf32_Syminfo -{ - Elf32_Half si_boundto; - Elf32_Half si_flags; -} - -struct Elf64_Verdef -{ - Elf64_Half vd_version; - Elf64_Half vd_flags; - Elf64_Half vd_ndx; - Elf64_Half vd_cnt; - Elf64_Word vd_hash; - Elf64_Word vd_aux; - Elf64_Word vd_next; -} - -struct Elf64_Verdaux -{ - Elf64_Word vda_name; - Elf64_Word vda_next; -} - -struct Elf64_Verneed -{ - Elf64_Half vn_version; - Elf64_Half vn_cnt; - Elf64_Word vn_file; - Elf64_Word vn_aux; - Elf64_Word vn_next; -} - -struct Elf64_Vernaux -{ - Elf64_Word vna_hash; - Elf64_Half vna_flags; - Elf64_Half vna_other; - Elf64_Word vna_name; - Elf64_Word vna_next; -} - -alias Elf64_Half Elf64_Versym; - -struct Elf64_Syminfo -{ - Elf64_Half si_boundto; - Elf64_Half si_flags; -} - -enum VER_NDX_LOCAL = 0; -enum VER_NDX_GLOBAL = 1; -enum VER_NDX_LORESERVE = 0xff00; -enum VER_NDX_ELIMINATE = 0xff01; - -enum VER_FLG_BASE = 0x1; -enum VER_FLG_WEAK = 0x2; enum VER_FLG_INFO = 0x4; -enum VER_DEF_NONE = 0; -enum VER_DEF_CURRENT = 1; -enum VER_DEF_NUM = 2; - -enum VER_NEED_NONE = 0; -enum VER_NEED_CURRENT = 1; -enum VER_NEED_NUM = 2; - -enum SYMINFO_FLG_DIRECT = 0x0001; enum SYMINFO_FLG_FILTER = 0x0002; -enum SYMINFO_FLG_PASSTHRU = SYMINFO_FLG_FILTER; -enum SYMINFO_FLG_COPY = 0x0004; -enum SYMINFO_FLG_LAZYLOAD = 0x0008; enum SYMINFO_FLG_DIRECTBIND = 0x0010; enum SYMINFO_FLG_NOEXTDIRECT = 0x0020; enum SYMINFO_FLG_AUXILIARY = 0x0040; @@ -298,15 +72,8 @@ enum SYMINFO_FLG_INTERPOSE = 0x0080; enum SYMINFO_FLG_CAP = 0x0100; enum SYMINFO_FLG_DEFERRED = 0x0200; -enum SYMINFO_BT_SELF = 0xffff; -enum SYMINFO_BT_PARENT = 0xfffe; enum SYMINFO_BT_NONE = 0xfffd; enum SYMINFO_BT_EXTERN = 0xfffc; -enum SYMINFO_BT_LOWRESERVE = 0xff00; - -enum SYMINFO_NONE = 0; -enum SYMINFO_CURRENT = 1; -enum SYMINFO_NUM = 2; alias link_map Link_map; diff --git a/libphobos/libdruntime/core/thread/threadbase.d b/libphobos/libdruntime/core/thread/threadbase.d index 505be00..217a33a 100644 --- a/libphobos/libdruntime/core/thread/threadbase.d +++ b/libphobos/libdruntime/core/thread/threadbase.d @@ -109,7 +109,7 @@ class ThreadBase } this(void delegate() dg, size_t sz = 0) @trusted pure nothrow @nogc - in( cast(void delegate() const) dg) + in( cast(const void delegate()) dg) { this(sz); m_call = dg; diff --git a/libphobos/libdruntime/rt/ehalloc.d b/libphobos/libdruntime/rt/ehalloc.d index 1dcd69a..65f92e3 100644 --- a/libphobos/libdruntime/rt/ehalloc.d +++ b/libphobos/libdruntime/rt/ehalloc.d @@ -18,51 +18,6 @@ debug(PRINTF) import core.stdc.stdio; } -/********************************************** - * Allocate an exception of type `ci` from the exception pool. - * It has the same interface as `rt.lifetime._d_newclass()`. - * The class type must be Throwable or derived from it, - * and cannot be a COM or C++ class. The compiler must enforce - * this. - * Returns: - * default initialized instance of the type - */ - -extern (C) Throwable _d_newThrowable(const TypeInfo_Class ci) -{ - debug(PRINTF) printf("_d_newThrowable(ci = %p, %s)\n", ci, cast(char *)ci.name); - - assert(!(ci.m_flags & TypeInfo_Class.ClassFlags.isCOMclass)); - assert(!(ci.m_flags & TypeInfo_Class.ClassFlags.isCPPclass)); - - import core.stdc.stdlib : malloc; - auto init = ci.initializer; - void* p = malloc(init.length); - if (!p) - { - import core.exception : onOutOfMemoryError; - onOutOfMemoryError(); - } - - debug(PRINTF) printf(" p = %p\n", p); - - // initialize it - p[0 .. init.length] = init[]; - - if (!(ci.m_flags & TypeInfo_Class.ClassFlags.noPointers)) - { - // Inform the GC about the pointers in the object instance - import core.memory : GC; - - GC.addRange(p, init.length, ci); - } - - debug(PRINTF) printf("initialization done\n"); - Throwable t = cast(Throwable)p; - t.refcount() = 1; - return t; -} - /******************************************** * Delete exception instance `t` from the exception pool. diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE index ddf730e..30e9e80 100644 --- a/libphobos/src/MERGE +++ b/libphobos/src/MERGE @@ -1,4 +1,4 @@ -d46814c86392007ebb4fb73cb684ef9e8caa605a +1206fc94f967b0183667a109049cbf596deaa696 The first line of this file holds the git revision number of the last merge done from the dlang/phobos repository. diff --git a/libphobos/src/std/mmfile.d b/libphobos/src/std/mmfile.d index e4000d4..f8f8a90 100644 --- a/libphobos/src/std/mmfile.d +++ b/libphobos/src/std/mmfile.d @@ -71,13 +71,13 @@ class MmFile * - On POSIX, $(REF ErrnoException, std, exception). * - On Windows, $(REF WindowsException, std, windows, syserror). */ - this(string filename) + this(string filename) scope { this(filename, Mode.read, 0, null); } version (linux) this(File file, Mode mode = Mode.read, ulong size = 0, - void* address = null, size_t window = 0) + void* address = null, size_t window = 0) scope { // Save a copy of the File to make sure the fd stays open. this.file = file; @@ -85,7 +85,7 @@ class MmFile } version (linux) private this(int fildes, Mode mode, ulong size, - void* address, size_t window) + void* address, size_t window) scope { int oflag; int fmode; @@ -169,7 +169,7 @@ class MmFile * - On Windows, $(REF WindowsException, std, windows, syserror). */ this(string filename, Mode mode, ulong size, void* address, - size_t window = 0) + size_t window = 0) scope { this.filename = filename; this.mMode = mode; @@ -364,7 +364,7 @@ class MmFile /** * Flushes pending output and closes the memory mapped file. */ - ~this() + ~this() scope { debug (MMFILE) printf("MmFile.~this()\n"); unmap(); diff --git a/libphobos/src/std/sumtype.d b/libphobos/src/std/sumtype.d index 869c36f..f3d3152 100644 --- a/libphobos/src/std/sumtype.d +++ b/libphobos/src/std/sumtype.d @@ -1313,6 +1313,7 @@ version (D_BetterC) {} else // Types with invariants // Disabled in BetterC due to use of exceptions version (D_BetterC) {} else +version (D_Invariants) @system unittest { import std.exception : assertThrown; @@ -1330,22 +1331,13 @@ version (D_BetterC) {} else invariant { assert(i >= 0); } } - // Only run test if contract checking is enabled - try - { - S probe = S(-1); - assert(&probe); - } - catch (AssertError _) - { - SumType!S x; - x.match!((ref v) { v.i = -1; }); - assertThrown!AssertError(assert(&x)); + SumType!S x; + x.match!((ref v) { v.i = -1; }); + assertThrown!AssertError(assert(&x)); - SumType!C y = new C(); - y.match!((ref v) { v.i = -1; }); - assertThrown!AssertError(assert(&y)); - } + SumType!C y = new C(); + y.match!((ref v) { v.i = -1; }); + assertThrown!AssertError(assert(&y)); } // Calls value postblit on self-assignment |