From 85041a5b7755dc7b9d74b183e933d89152997886 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Wed, 28 Nov 2018 17:54:07 +0000 Subject: [PATCH] Merge libphobos upstream version 2.076.1 Updated the library version to 76:3:0. libphobos/ChangeLog: 2018-11-28 Iain Buclaw * Makefile.in: Rebuild. * configure: Rebuild. * configure.ac (DRUNTIME_SOVERSION): Remove. (PHOBOS_SOVERSION): Remove. (libtool_VERSION): Add. * libdruntime/Makefile.am: Use libtool_VERSION. * libdruntime/Makefile.in: Rebuild. * src/Makefile.am: Use libtool_VERSION. * src/Makefile.in: Rebuild. * testsuite/Makefile.in: Rebuild. From-SVN: r266572 --- libphobos/ChangeLog | 13 ++++++++++++ libphobos/Makefile.in | 3 +-- libphobos/configure | 11 ++++------ libphobos/configure.ac | 6 ++---- libphobos/libdruntime/Makefile.am | 2 +- libphobos/libdruntime/Makefile.in | 5 ++--- libphobos/libdruntime/object.d | 35 +++++++++++++++++++++++++++---- libphobos/src/Makefile.am | 2 +- libphobos/src/Makefile.in | 5 ++--- libphobos/src/std/complex.d | 5 ++++- libphobos/src/std/math.d | 14 +++++++++---- libphobos/src/std/random.d | 6 +++--- libphobos/testsuite/Makefile.in | 3 +-- 13 files changed, 75 insertions(+), 35 deletions(-) diff --git a/libphobos/ChangeLog b/libphobos/ChangeLog index e95639dbe07..ad8f7ee278d 100644 --- a/libphobos/ChangeLog +++ b/libphobos/ChangeLog @@ -1,3 +1,16 @@ +2018-11-28 Iain Buclaw + + * Makefile.in: Rebuild. + * configure: Rebuild. + * configure.ac (DRUNTIME_SOVERSION): Remove. + (PHOBOS_SOVERSION): Remove. + (libtool_VERSION): Add. + * libdruntime/Makefile.am: Use libtool_VERSION. + * libdruntime/Makefile.in: Rebuild. + * src/Makefile.am: Use libtool_VERSION. + * src/Makefile.in: Rebuild. + * testsuite/Makefile.in: Rebuild. + 2018-11-22 Johannes Pfau PR d/87824 diff --git a/libphobos/Makefile.in b/libphobos/Makefile.in index 2f073d64629..a54821d6799 100644 --- a/libphobos/Makefile.in +++ b/libphobos/Makefile.in @@ -216,7 +216,6 @@ DCFG_HAVE_LIBATOMIC = @DCFG_HAVE_LIBATOMIC@ DCFG_MINFO_BRACKETING = @DCFG_MINFO_BRACKETING@ DCFG_THREAD_MODEL = @DCFG_THREAD_MODEL@ DEFS = @DEFS@ -DRUNTIME_SOVERSION = @DRUNTIME_SOVERSION@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -261,7 +260,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -PHOBOS_SOVERSION = @PHOBOS_SOVERSION@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -308,6 +306,7 @@ libphobos_builddir = @libphobos_builddir@ libphobos_srcdir = @libphobos_srcdir@ libphobos_toolexecdir = @libphobos_toolexecdir@ libphobos_toolexeclibdir = @libphobos_toolexeclibdir@ +libtool_VERSION = @libtool_VERSION@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ diff --git a/libphobos/configure b/libphobos/configure index 9b3dc92ae47..d247d9adc1f 100755 --- a/libphobos/configure +++ b/libphobos/configure @@ -634,8 +634,7 @@ am__EXEEXT_TRUE LTLIBOBJS LIBOBJS GDCFLAGSX -PHOBOS_SOVERSION -DRUNTIME_SOVERSION +libtool_VERSION SPEC_PHOBOS_DEPS gdc_include_dir libphobos_toolexeclibdir @@ -11509,7 +11508,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11512 "configure" +#line 11511 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11615,7 +11614,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11618 "configure" +#line 11617 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -14874,9 +14873,7 @@ SPEC_PHOBOS_DEPS="$LIBS" # Libdruntime / phobos soname version -DRUNTIME_SOVERSION="76:2:0" -PHOBOS_SOVERSION="76:2:0" - +libtool_VERSION=76:3:0 # Set default flags (after DRUNTIME_WERROR!) diff --git a/libphobos/configure.ac b/libphobos/configure.ac index 1e931d4395f..67eab27e821 100644 --- a/libphobos/configure.ac +++ b/libphobos/configure.ac @@ -148,10 +148,8 @@ SPEC_PHOBOS_DEPS="$LIBS" AC_SUBST(SPEC_PHOBOS_DEPS) # Libdruntime / phobos soname version -DRUNTIME_SOVERSION="76:2:0" -PHOBOS_SOVERSION="76:2:0" -AC_SUBST([DRUNTIME_SOVERSION]) -AC_SUBST([PHOBOS_SOVERSION]) +libtool_VERSION=76:3:0 +AC_SUBST(libtool_VERSION) # Set default flags (after DRUNTIME_WERROR!) if test -z "$GDCFLAGS"; then diff --git a/libphobos/libdruntime/Makefile.am b/libphobos/libdruntime/Makefile.am index 2a4d341a579..e14cc031eea 100644 --- a/libphobos/libdruntime/Makefile.am +++ b/libphobos/libdruntime/Makefile.am @@ -104,7 +104,7 @@ endif toolexeclib_LTLIBRARIES = libgdruntime.la libgdruntime_la_SOURCES = $(ALL_DRUNTIME_SOURCES) libgdruntime_la_LIBTOOLFLAGS = -libgdruntime_la_LDFLAGS = -Xcompiler -nophoboslib -version-info $(DRUNTIME_SOVERSION) +libgdruntime_la_LDFLAGS = -Xcompiler -nophoboslib -version-info $(libtool_VERSION) libgdruntime_la_LIBADD = $(LIBATOMIC) $(LIBBACKTRACE) # For static unittest, link objects directly diff --git a/libphobos/libdruntime/Makefile.in b/libphobos/libdruntime/Makefile.in index eaa7664c8f1..d07a8f98099 100644 --- a/libphobos/libdruntime/Makefile.in +++ b/libphobos/libdruntime/Makefile.in @@ -553,7 +553,6 @@ DCFG_HAVE_LIBATOMIC = @DCFG_HAVE_LIBATOMIC@ DCFG_MINFO_BRACKETING = @DCFG_MINFO_BRACKETING@ DCFG_THREAD_MODEL = @DCFG_THREAD_MODEL@ DEFS = @DEFS@ -DRUNTIME_SOVERSION = @DRUNTIME_SOVERSION@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -598,7 +597,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -PHOBOS_SOVERSION = @PHOBOS_SOVERSION@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -645,6 +643,7 @@ libphobos_builddir = @libphobos_builddir@ libphobos_srcdir = @libphobos_srcdir@ libphobos_toolexecdir = @libphobos_toolexecdir@ libphobos_toolexeclibdir = @libphobos_toolexeclibdir@ +libtool_VERSION = @libtool_VERSION@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ @@ -760,7 +759,7 @@ DRUNTIME_TEST_LOBJECTS = $(filter-out rt/util/typeinfo.t.lo \ toolexeclib_LTLIBRARIES = libgdruntime.la libgdruntime_la_SOURCES = $(ALL_DRUNTIME_SOURCES) libgdruntime_la_LIBTOOLFLAGS = -libgdruntime_la_LDFLAGS = -Xcompiler -nophoboslib -version-info $(DRUNTIME_SOVERSION) +libgdruntime_la_LDFLAGS = -Xcompiler -nophoboslib -version-info $(libtool_VERSION) libgdruntime_la_LIBADD = $(LIBATOMIC) $(LIBBACKTRACE) # For static unittest, link objects directly diff --git a/libphobos/libdruntime/object.d b/libphobos/libdruntime/object.d index 3510ee464ff..2fe27a195df 100644 --- a/libphobos/libdruntime/object.d +++ b/libphobos/libdruntime/object.d @@ -3468,14 +3468,13 @@ if (__traits(isScalar, T)) // comparisons in the semantic analysis phase of CmpExp. The ordering // comparison is lowered to a call to this template. int __cmp(T1, T2)(T1[] s1, T2[] s2) -if (!__traits(isScalar, T1)) +if (!__traits(isScalar, T1) && !__traits(isScalar, T2)) { import core.internal.traits : Unqual; alias U1 = Unqual!T1; alias U2 = Unqual!T2; - static assert(is(U1 == U2), "Internal error."); - static if (is(U1 == void)) + static if (is(U1 == void) && is(U2 == void)) static @trusted ref inout(ubyte) at(inout(void)[] r, size_t i) { return (cast(inout(ubyte)*) r.ptr)[i]; } else static @trusted ref R at(R)(R[] r, size_t i) { return r.ptr[i]; } @@ -3506,8 +3505,11 @@ if (!__traits(isScalar, T1)) { // TODO: fix this legacy bad behavior, see // https://issues.dlang.org/show_bug.cgi?id=17244 + static assert(is(U1 == U2), "Internal error."); import core.stdc.string : memcmp; - return (() @trusted => memcmp(&at(s1, u), &at(s2, u), U1.sizeof))(); + auto c = (() @trusted => memcmp(&at(s1, u), &at(s2, u), U1.sizeof))(); + if (c != 0) + return c; } } return s1.length < s2.length ? -1 : (s1.length > s2.length); @@ -3566,9 +3568,15 @@ if (!__traits(isScalar, T1)) { T[2] a = [T.max, T.max]; T[2] b = [T.min_normal, T.min_normal]; + T[2] c = [T.max, T.min_normal]; + T[1] d = [T.max]; assert(__cmp(a, b) > 0); assert(__cmp(b, a) < 0); + assert(__cmp(a, c) > 0); + assert(__cmp(a, d) > 0); + assert(__cmp(d, c) < 0); + assert(__cmp(c, c) == 0); } compareMinMax!real; @@ -3602,6 +3610,24 @@ if (!__traits(isScalar, T1)) assert(__cmp(b, a) < 0); } +// arrays of arrays with mixed modifiers +@safe unittest +{ + // https://issues.dlang.org/show_bug.cgi?id=17876 + bool less1(immutable size_t[][] a, size_t[][] b) { return a < b; } + bool less2(const void[][] a, void[][] b) { return a < b; } + bool less3(inout size_t[][] a, size_t[][] b) { return a < b; } + + immutable size_t[][] a = [[1, 2], [3, 4]]; + size_t[][] b = [[1, 2], [3, 5]]; + assert(less1(a, b)); + assert(less3(a, b)); + + auto va = [cast(immutable void[])a[0], a[1]]; + auto vb = [cast(void[])b[0], b[1]]; + assert(less2(va, vb)); +} + // objects @safe unittest { @@ -3642,6 +3668,7 @@ if (!__traits(isScalar, T1)) assert(__cmp([c1, c1][], [c2, c2][]) < 0); assert(__cmp([c2, c2], [c1, c1]) > 0); + assert(__cmp([c2, c2], [c2, c1]) > 0); } // Compiler hook into the runtime implementation of array (vector) operations. diff --git a/libphobos/src/Makefile.am b/libphobos/src/Makefile.am index c5b36aea0cb..3ced3ae21c8 100644 --- a/libphobos/src/Makefile.am +++ b/libphobos/src/Makefile.am @@ -57,7 +57,7 @@ toolexeclib_DATA = libgphobos.spec toolexeclib_LTLIBRARIES = libgphobos.la libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES) $(ZLIB_SRC) libgphobos_la_LIBTOOLFLAGS = -libgphobos_la_LDFLAGS = -Xcompiler -nophoboslib -version-info $(PHOBOS_SOVERSION) +libgphobos_la_LDFLAGS = -Xcompiler -nophoboslib -version-info $(libtool_VERSION) libgphobos_la_LIBADD = ../libdruntime/libgdruntime.la libgphobos_la_DEPENDENCIES = libgphobos.spec diff --git a/libphobos/src/Makefile.in b/libphobos/src/Makefile.in index 08470abba3e..f0c8f8760b4 100644 --- a/libphobos/src/Makefile.in +++ b/libphobos/src/Makefile.in @@ -507,7 +507,6 @@ DCFG_HAVE_LIBATOMIC = @DCFG_HAVE_LIBATOMIC@ DCFG_MINFO_BRACKETING = @DCFG_MINFO_BRACKETING@ DCFG_THREAD_MODEL = @DCFG_THREAD_MODEL@ DEFS = @DEFS@ -DRUNTIME_SOVERSION = @DRUNTIME_SOVERSION@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -552,7 +551,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -PHOBOS_SOVERSION = @PHOBOS_SOVERSION@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -599,6 +597,7 @@ libphobos_builddir = @libphobos_builddir@ libphobos_srcdir = @libphobos_srcdir@ libphobos_toolexecdir = @libphobos_toolexecdir@ libphobos_toolexeclibdir = @libphobos_toolexeclibdir@ +libtool_VERSION = @libtool_VERSION@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ @@ -698,7 +697,7 @@ toolexeclib_DATA = libgphobos.spec toolexeclib_LTLIBRARIES = libgphobos.la libgphobos_la_SOURCES = $(ALL_PHOBOS_SOURCES) $(ZLIB_SRC) libgphobos_la_LIBTOOLFLAGS = -libgphobos_la_LDFLAGS = -Xcompiler -nophoboslib -version-info $(PHOBOS_SOVERSION) +libgphobos_la_LDFLAGS = -Xcompiler -nophoboslib -version-info $(libtool_VERSION) libgphobos_la_LIBADD = ../libdruntime/libgdruntime.la libgphobos_la_DEPENDENCIES = libgphobos.spec diff --git a/libphobos/src/std/complex.d b/libphobos/src/std/complex.d index 77638229220..b0780512ed3 100644 --- a/libphobos/src/std/complex.d +++ b/libphobos/src/std/complex.d @@ -853,7 +853,10 @@ Complex!T cos(T)(Complex!T z) @safe pure nothrow @nogc import std.math; assert(cos(complex(0.0)) == 1.0); assert(cos(complex(1.3L)) == std.math.cos(1.3L)); - assert(cos(complex(0, 5.2L)) == cosh(5.2L)); + auto c1 = cos(complex(0, 5.2L)); + auto c2 = cosh(5.2L); + assert(feqrel(c1.re, c2.re) >= real.mant_dig - 1 && + feqrel(c1.im, c2.im) >= real.mant_dig - 1); } diff --git a/libphobos/src/std/math.d b/libphobos/src/std/math.d index 84cf4a73927..7bb4d7c23db 100644 --- a/libphobos/src/std/math.d +++ b/libphobos/src/std/math.d @@ -177,7 +177,7 @@ version (StaticallyHaveSSE) { private enum bool haveSSE = true; } -else +else version (X86) { static import core.cpuid; private alias haveSSE = core.cpuid.sse; @@ -887,7 +887,7 @@ Lret: {} -9.889929415807650724957118893791829849557E-1L ]; static immutable real[7] Q = [ - 8.650244186622719093893836740197250197602E10L + 8.650244186622719093893836740197250197602E10L, -4.152206921457208101480801635640958361612E10L, 2.758476078803232151774723646710890525496E9L, -5.733709132766856723608447733926138506824E7L, @@ -3141,7 +3141,8 @@ float ldexp(float n, int exp) @safe pure nothrow @nogc { return ldexp(cast(real) @safe pure nothrow @nogc unittest { - static if (floatTraits!(real).realFormat == RealFormat.ieeeExtended) + static if (floatTraits!(real).realFormat == RealFormat.ieeeExtended || + floatTraits!(real).realFormat == RealFormat.ieeeQuadruple) { assert(ldexp(1.0L, -16384) == 0x1p-16384L); assert(ldexp(1.0L, -16382) == 0x1p-16382L); @@ -4453,6 +4454,7 @@ long lrint(real x) @trusted pure nothrow @nogc const j = sign ? -OF : OF; x = (j + x) - j; + const exp = (vu[F.EXPPOS_SHORT] & F.EXPMASK) - (F.EXPBIAS + 1); const implicitOne = 1UL << 48; auto vl = cast(ulong*)(&x); vl[MANTISSA_MSB] &= implicitOne - 1; @@ -4460,7 +4462,6 @@ long lrint(real x) @trusted pure nothrow @nogc long result; - const exp = (vu[F.EXPPOS_SHORT] & F.EXPMASK) - (F.EXPBIAS + 1); if (exp < 0) result = 0; else if (exp <= 48) @@ -5337,6 +5338,7 @@ private: } else version (AArch64) { + ControlState cont; asm pure nothrow @nogc { "mrs %0, FPCR;" : "=r" cont; @@ -6668,6 +6670,10 @@ if (isFloatingPoint!(F) && isIntegral!(G)) { pragma(msg, "test disabled on ARM, see bug 5628"); } + else version (GNU) + { + pragma(msg, "test disabled on GNU, see bug 5628"); + } else { assert(pow(xd, neg2) == 1 / (x * x)); diff --git a/libphobos/src/std/random.d b/libphobos/src/std/random.d index b3116e1827e..f4c64d4a36d 100644 --- a/libphobos/src/std/random.d +++ b/libphobos/src/std/random.d @@ -64,15 +64,15 @@ import std.traits; // Generate a uniformly-distributed integer in the range [0, 14] // If no random generator is passed, the global `rndGen` would be used auto i = uniform(0, 15, rnd); - assert(i == 12); + assert(i >= 0 && i < 15); // Generate a uniformly-distributed real in the range [0, 100) auto r = uniform(0.0L, 100.0L, rnd); - assert(r == 79.65429843861011285); + assert(r >= 0 && r < 100); // Generate a 32-bit random number auto u = uniform!uint(rnd); - assert(u == 4083286876); + static assert(is(typeof(u) == uint)); } version (unittest) diff --git a/libphobos/testsuite/Makefile.in b/libphobos/testsuite/Makefile.in index e3fd03b848a..33950c5c953 100644 --- a/libphobos/testsuite/Makefile.in +++ b/libphobos/testsuite/Makefile.in @@ -162,7 +162,6 @@ DCFG_HAVE_LIBATOMIC = @DCFG_HAVE_LIBATOMIC@ DCFG_MINFO_BRACKETING = @DCFG_MINFO_BRACKETING@ DCFG_THREAD_MODEL = @DCFG_THREAD_MODEL@ DEFS = @DEFS@ -DRUNTIME_SOVERSION = @DRUNTIME_SOVERSION@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ @@ -207,7 +206,6 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ -PHOBOS_SOVERSION = @PHOBOS_SOVERSION@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ @@ -254,6 +252,7 @@ libphobos_builddir = @libphobos_builddir@ libphobos_srcdir = @libphobos_srcdir@ libphobos_toolexecdir = @libphobos_toolexecdir@ libphobos_toolexeclibdir = @libphobos_toolexeclibdir@ +libtool_VERSION = @libtool_VERSION@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ -- 2.30.2