mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-12-13 22:03:43 +08:00
libphobos: Merge phobos and druntime with upstream.
Commits merged from druntime. Fix struct tls_index definition on x32 https://github.com/dlang/druntime/pull/2354 Update SectionGroup signatures to match on all targets https://github.com/dlang/druntime/pull/2401 Fix issue 19128 - argument to alloca may be too large https://github.com/dlang/druntime/pull/2409 Define some common filesystem limits in core.stdc.limits https://github.com/dlang/druntime/pull/2460 Use version Darwin instead of OSX in core.sys.posix.aio https://github.com/dlang/druntime/pull/2470 Commits merged from phobos. Don't run HardFloat tests on SoftFloat systems https://github.com/dlang/phobos/pull/5358 Remove reliance on stdin, stdout, stderr being aliasable https://github.com/dlang/phobos/pull/5718 Solaris: add import clock_gettime to currStdTime https://github.com/dlang/phobos/pull/5807 Don't print debug messages when building unittests https://github.com/dlang/phobos/pull/6827 Add HPPA support to phobos Fixes https://gcc.gnu.org/PR89054 https://github.com/dlang/phobos/pull/6836 From-SVN: r268293
This commit is contained in:
parent
8f915edbe1
commit
685ae5b871
4
libphobos/libdruntime/MERGE
Normal file
4
libphobos/libdruntime/MERGE
Normal file
@ -0,0 +1,4 @@
|
||||
f2db21937e650553066c30f1a9d5a7d08a1b3573
|
||||
|
||||
The first line of this file holds the git revision number of the last
|
||||
merge done from the dlang/druntime repository.
|
@ -14,6 +14,15 @@
|
||||
|
||||
module core.stdc.limits;
|
||||
|
||||
version (OSX)
|
||||
version = Darwin;
|
||||
else version (iOS)
|
||||
version = Darwin;
|
||||
else version (TVOS)
|
||||
version = Darwin;
|
||||
else version (WatchOS)
|
||||
version = Darwin;
|
||||
|
||||
private import core.stdc.config;
|
||||
|
||||
extern (C):
|
||||
@ -21,6 +30,10 @@ extern (C):
|
||||
nothrow:
|
||||
@nogc:
|
||||
|
||||
//
|
||||
// Numerical limits
|
||||
//
|
||||
|
||||
///
|
||||
enum CHAR_BIT = 8;
|
||||
///
|
||||
@ -59,3 +72,113 @@ enum LLONG_MIN = long.min;
|
||||
enum LLONG_MAX = long.max;
|
||||
///
|
||||
enum ULLONG_MAX = ulong.max;
|
||||
|
||||
//
|
||||
// File system limits
|
||||
//
|
||||
|
||||
version (Darwin)
|
||||
{
|
||||
///
|
||||
enum MAX_CANON = 1024;
|
||||
///
|
||||
enum MAX_INPUT = 1024;
|
||||
///
|
||||
enum NAME_MAX = 255;
|
||||
///
|
||||
enum PATH_MAX = 1024;
|
||||
///
|
||||
enum PIPE_BUF = 512;
|
||||
}
|
||||
|
||||
version (DragonFlyBSD)
|
||||
{
|
||||
///
|
||||
enum MAX_CANON = 255;
|
||||
///
|
||||
enum MAX_INPUT = 255;
|
||||
///
|
||||
enum NAME_MAX = 255;
|
||||
///
|
||||
enum PATH_MAX = 1024;
|
||||
///
|
||||
enum PIPE_BUF = 512;
|
||||
}
|
||||
else version (FreeBSD)
|
||||
{
|
||||
///
|
||||
enum MAX_CANON = 255;
|
||||
///
|
||||
enum MAX_INPUT = 255;
|
||||
///
|
||||
enum NAME_MAX = 255;
|
||||
///
|
||||
enum PATH_MAX = 1024;
|
||||
///
|
||||
enum PIPE_BUF = 512;
|
||||
}
|
||||
else version (linux)
|
||||
{
|
||||
///
|
||||
enum MAX_CANON = 255;
|
||||
///
|
||||
enum MAX_INPUT = 255;
|
||||
///
|
||||
enum NAME_MAX = 255;
|
||||
///
|
||||
enum PATH_MAX = 4096;
|
||||
///
|
||||
enum PIPE_BUF = 4096;
|
||||
}
|
||||
else version (NetBSD)
|
||||
{
|
||||
///
|
||||
enum MAX_CANON = 255;
|
||||
///
|
||||
enum MAX_INPUT = 255;
|
||||
///
|
||||
enum NAME_MAX = 511;
|
||||
///
|
||||
enum PATH_MAX = 1024;
|
||||
///
|
||||
enum PIPE_BUF = 512;
|
||||
}
|
||||
else version (OpenBSD)
|
||||
{
|
||||
///
|
||||
enum MAX_CANON = 255;
|
||||
///
|
||||
enum MAX_INPUT = 255;
|
||||
///
|
||||
enum NAME_MAX = 255;
|
||||
///
|
||||
enum PATH_MAX = 1024;
|
||||
///
|
||||
enum PIPE_BUF = 512;
|
||||
}
|
||||
else version (Solaris)
|
||||
{
|
||||
///
|
||||
enum MAX_CANON = 256;
|
||||
///
|
||||
enum MAX_INPUT = 512;
|
||||
///
|
||||
enum NAME_MAX = 255;
|
||||
///
|
||||
enum PATH_MAX = 1024;
|
||||
///
|
||||
enum PIPE_BUF = 5120;
|
||||
}
|
||||
else version (Windows)
|
||||
{
|
||||
///
|
||||
enum MAX_CANON = 256;
|
||||
///
|
||||
enum MAX_INPUT = 256;
|
||||
///
|
||||
enum NAME_MAX = 256;
|
||||
///
|
||||
enum PATH_MAX = 260;
|
||||
///
|
||||
enum PIPE_BUF = 5120;
|
||||
}
|
||||
|
@ -11,6 +11,15 @@ module core.sys.posix.aio;
|
||||
private import core.sys.posix.signal;
|
||||
private import core.sys.posix.sys.types;
|
||||
|
||||
version (OSX)
|
||||
version = Darwin;
|
||||
else version (iOS)
|
||||
version = Darwin;
|
||||
else version (TVOS)
|
||||
version = Darwin;
|
||||
else version (WatchOS)
|
||||
version = Darwin;
|
||||
|
||||
version (Posix):
|
||||
|
||||
extern (C):
|
||||
@ -63,7 +72,7 @@ version (CRuntime_Glibc)
|
||||
}
|
||||
}
|
||||
}
|
||||
else version (OSX)
|
||||
else version (Darwin)
|
||||
{
|
||||
struct aiocb
|
||||
{
|
||||
@ -171,7 +180,7 @@ version (CRuntime_Glibc)
|
||||
AIO_ALLDONE
|
||||
}
|
||||
}
|
||||
else version (OSX)
|
||||
else version (Darwin)
|
||||
{
|
||||
enum
|
||||
{
|
||||
@ -209,7 +218,7 @@ version (CRuntime_Glibc)
|
||||
LIO_NOP
|
||||
}
|
||||
}
|
||||
else version (OSX)
|
||||
else version (Darwin)
|
||||
{
|
||||
enum
|
||||
{
|
||||
@ -246,7 +255,7 @@ version (CRuntime_Glibc)
|
||||
LIO_NOWAIT
|
||||
}
|
||||
}
|
||||
else version (OSX)
|
||||
else version (Darwin)
|
||||
{
|
||||
enum
|
||||
{
|
||||
|
@ -30,7 +30,12 @@ extern (C) void[] _d_arrayassign(TypeInfo ti, void[] from, void[] to)
|
||||
|
||||
// Need a temporary buffer tmp[] big enough to hold one element
|
||||
void[16] buf = void;
|
||||
void* ptmp = (elementSize > buf.sizeof) ? alloca(elementSize) : buf.ptr;
|
||||
void* ptmp = (elementSize > buf.sizeof) ? malloc(elementSize) : buf.ptr;
|
||||
scope (exit)
|
||||
{
|
||||
if (ptmp != buf.ptr)
|
||||
free(ptmp);
|
||||
}
|
||||
return _d_arrayassign_l(ti, from, to, ptmp);
|
||||
}
|
||||
|
||||
@ -206,24 +211,20 @@ extern (C) void* _d_arraysetassign(void* p, void* value, int count, TypeInfo ti)
|
||||
|
||||
auto element_size = ti.tsize;
|
||||
|
||||
//Need a temporary buffer tmp[] big enough to hold one element
|
||||
void[16] buf = void;
|
||||
void[] tmp;
|
||||
if (element_size > buf.sizeof)
|
||||
{
|
||||
tmp = alloca(element_size)[0 .. element_size];
|
||||
}
|
||||
else
|
||||
tmp = buf[];
|
||||
// Need a temporary buffer tmp[] big enough to hold one element
|
||||
immutable maxAllocaSize = 512;
|
||||
void *ptmp = (element_size > maxAllocaSize) ? malloc(element_size) : alloca(element_size);
|
||||
|
||||
foreach (i; 0 .. count)
|
||||
{
|
||||
memcpy(tmp.ptr, p, element_size);
|
||||
memcpy(ptmp, p, element_size);
|
||||
memcpy(p, value, element_size);
|
||||
ti.postblit(p);
|
||||
ti.destroy(tmp.ptr);
|
||||
ti.destroy(ptmp);
|
||||
p += element_size;
|
||||
}
|
||||
if (element_size > maxAllocaSize)
|
||||
free(ptmp);
|
||||
return pstart;
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,7 @@ version (Windows)
|
||||
private import core.stdc.wchar_;
|
||||
private import core.sys.windows.windows;
|
||||
|
||||
version (GNU) {}
|
||||
else pragma(lib, "shell32.lib"); // needed for CommandLineToArgvW
|
||||
pragma(lib, "shell32.lib"); // needed for CommandLineToArgvW
|
||||
}
|
||||
|
||||
version (FreeBSD)
|
||||
|
@ -18,6 +18,7 @@ static if (SharedELF):
|
||||
|
||||
// debug = PRINTF;
|
||||
import core.memory;
|
||||
import core.stdc.config;
|
||||
import core.stdc.stdio;
|
||||
import core.stdc.stdlib : calloc, exit, free, malloc, EXIT_FAILURE;
|
||||
import core.stdc.string : strlen;
|
||||
@ -955,8 +956,27 @@ version (Shared) void* handleForAddr(void* addr) nothrow @nogc
|
||||
*/
|
||||
struct tls_index
|
||||
{
|
||||
size_t ti_module;
|
||||
size_t ti_offset;
|
||||
version (CRuntime_Glibc)
|
||||
{
|
||||
// For x86_64, fields are of type uint64_t, this is important for x32
|
||||
// where tls_index would otherwise have the wrong size.
|
||||
// See https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/x86_64/dl-tls.h
|
||||
version (X86_64)
|
||||
{
|
||||
ulong ti_module;
|
||||
ulong ti_offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
c_ulong ti_module;
|
||||
c_ulong ti_offset;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
size_t ti_module;
|
||||
size_t ti_offset;
|
||||
}
|
||||
}
|
||||
|
||||
extern(C) void* __tls_get_addr(tls_index* ti) nothrow @nogc;
|
||||
|
@ -29,24 +29,24 @@ struct SectionGroup
|
||||
return dg(_sections);
|
||||
}
|
||||
|
||||
@property immutable(ModuleInfo*)[] modules() const
|
||||
@property immutable(ModuleInfo*)[] modules() const nothrow @nogc
|
||||
{
|
||||
return _moduleGroup.modules;
|
||||
}
|
||||
|
||||
@property ref inout(ModuleGroup) moduleGroup() inout
|
||||
@property ref inout(ModuleGroup) moduleGroup() inout nothrow @nogc
|
||||
{
|
||||
return _moduleGroup;
|
||||
}
|
||||
|
||||
@property immutable(FuncTable)[] ehTables() const
|
||||
@property immutable(FuncTable)[] ehTables() const nothrow @nogc
|
||||
{
|
||||
auto pbeg = cast(immutable(FuncTable)*)&__start_deh;
|
||||
auto pend = cast(immutable(FuncTable)*)&__stop_deh;
|
||||
return pbeg[0 .. pend - pbeg];
|
||||
}
|
||||
|
||||
@property inout(void[])[] gcRanges() inout
|
||||
@property inout(void[])[] gcRanges() inout nothrow @nogc
|
||||
{
|
||||
return _gcRanges[];
|
||||
}
|
||||
|
@ -31,17 +31,17 @@ struct SectionGroup
|
||||
return dg(_sections);
|
||||
}
|
||||
|
||||
@property immutable(ModuleInfo*)[] modules() const
|
||||
@property immutable(ModuleInfo*)[] modules() const nothrow @nogc
|
||||
{
|
||||
return _moduleGroup.modules;
|
||||
}
|
||||
|
||||
@property ref inout(ModuleGroup) moduleGroup() inout
|
||||
@property ref inout(ModuleGroup) moduleGroup() inout nothrow @nogc
|
||||
{
|
||||
return _moduleGroup;
|
||||
}
|
||||
|
||||
@property inout(void[])[] gcRanges() inout
|
||||
@property inout(void[])[] gcRanges() inout nothrow @nogc
|
||||
{
|
||||
return _gcRanges[];
|
||||
}
|
||||
|
@ -42,7 +42,7 @@ struct SectionGroup
|
||||
}
|
||||
|
||||
version (Win64)
|
||||
@property immutable(FuncTable)[] ehTables() const
|
||||
@property immutable(FuncTable)[] ehTables() const nothrow @nogc
|
||||
{
|
||||
auto pbeg = cast(immutable(FuncTable)*)&_deh_beg;
|
||||
auto pend = cast(immutable(FuncTable)*)&_deh_end;
|
||||
|
@ -1,4 +1,4 @@
|
||||
b022e552aaca84810e3dda3a18179440943c7096
|
||||
d4933a90b1e8446c04d64cd044658f2b33250bd3
|
||||
|
||||
The first line of this file holds the git revision number of the last
|
||||
merge done from the dlang/phobos repository.
|
||||
|
@ -220,7 +220,7 @@ public:
|
||||
return unixTimeToStdTime(core.stdc.time.time(null));
|
||||
else
|
||||
{
|
||||
import core.sys.solaris.time : CLOCK_REALTIME;
|
||||
import core.sys.solaris.time : clock_gettime, CLOCK_REALTIME;
|
||||
static if (clockType == ClockType.coarse) alias clockArg = CLOCK_REALTIME;
|
||||
else static if (clockType == ClockType.normal) alias clockArg = CLOCK_REALTIME;
|
||||
else static if (clockType == ClockType.precise) alias clockArg = CLOCK_REALTIME;
|
||||
|
@ -105,10 +105,6 @@ struct Mallocator
|
||||
test!Mallocator();
|
||||
}
|
||||
|
||||
version (Posix)
|
||||
@nogc nothrow
|
||||
private extern(C) int posix_memalign(void**, size_t, size_t);
|
||||
|
||||
version (Windows)
|
||||
{
|
||||
// DMD Win 32 bit, DigitalMars C standard library misses the _aligned_xxx
|
||||
@ -231,6 +227,7 @@ struct AlignedMallocator
|
||||
void[] alignedAllocate(size_t bytes, uint a) shared
|
||||
{
|
||||
import core.stdc.errno : ENOMEM, EINVAL;
|
||||
import core.sys.posix.stdlib : posix_memalign;
|
||||
assert(a.isGoodDynamicAlignment);
|
||||
void* result;
|
||||
auto code = posix_memalign(&result, a, bytes);
|
||||
|
@ -113,8 +113,12 @@ if (Targets.length >= 1 && allSatisfy!(isMutable, Targets))
|
||||
else
|
||||
{
|
||||
enum foundFunc = findCovariantFunction!(TargetMembers[i], Source, SourceMembers);
|
||||
static if (foundFunc == -1)
|
||||
pragma(msg, "Could not locate matching function for: " ~ TargetMembers[i].stringof);
|
||||
debug
|
||||
{
|
||||
static if (foundFunc == -1)
|
||||
pragma(msg, "Could not locate matching function for: ",
|
||||
TargetMembers[i].stringof);
|
||||
}
|
||||
enum hasRequiredMethods =
|
||||
foundFunc != -1 &&
|
||||
hasRequiredMethods!(i + 1);
|
||||
|
@ -4293,11 +4293,6 @@ string tempDir() @trusted
|
||||
DWORD len = GetTempPathW(buf.length, buf.ptr);
|
||||
if (len) cache = buf[0 .. len].to!string;
|
||||
}
|
||||
else version (Android)
|
||||
{
|
||||
// Don't check for a global temporary directory as
|
||||
// Android doesn't have one.
|
||||
}
|
||||
else version (Posix)
|
||||
{
|
||||
import std.process : environment;
|
||||
|
@ -160,6 +160,8 @@ version (MIPS32) version = MIPS_Any;
|
||||
version (MIPS64) version = MIPS_Any;
|
||||
version (AArch64) version = ARM_Any;
|
||||
version (ARM) version = ARM_Any;
|
||||
version (SPARC) version = SPARC_Any;
|
||||
version (SPARC64) version = SPARC_Any;
|
||||
|
||||
version (D_InlineAsm_X86)
|
||||
{
|
||||
@ -380,15 +382,22 @@ template floatTraits(T)
|
||||
enum ushort EXPMASK = 0x7FF0;
|
||||
enum ushort EXPSHIFT = 4;
|
||||
enum realFormat = RealFormat.ibmExtended;
|
||||
// the exponent byte is not unique
|
||||
|
||||
// For IBM doubledouble the larger magnitude double comes first.
|
||||
// It's really a double[2] and arrays don't index differently
|
||||
// between little and big-endian targets.
|
||||
enum DOUBLEPAIR_MSB = 0;
|
||||
enum DOUBLEPAIR_LSB = 1;
|
||||
|
||||
// The exponent/sign byte is for most significant part.
|
||||
version (LittleEndian)
|
||||
{
|
||||
enum EXPPOS_SHORT = 7; // [3] is also an exp short
|
||||
enum SIGNPOS_BYTE = 15;
|
||||
enum EXPPOS_SHORT = 3;
|
||||
enum SIGNPOS_BYTE = 7;
|
||||
}
|
||||
else
|
||||
{
|
||||
enum EXPPOS_SHORT = 0; // [4] is also an exp short
|
||||
enum EXPPOS_SHORT = 0;
|
||||
enum SIGNPOS_BYTE = 0;
|
||||
}
|
||||
}
|
||||
@ -420,19 +429,20 @@ T floorImpl(T)(const T x) @trusted pure nothrow @nogc
|
||||
{
|
||||
T rv;
|
||||
ushort[T.sizeof/2] vu;
|
||||
|
||||
// Other kinds of extractors for real formats.
|
||||
static if (F.realFormat == RealFormat.ieeeSingle)
|
||||
int vi;
|
||||
}
|
||||
floatBits y = void;
|
||||
y.rv = x;
|
||||
|
||||
// Find the exponent (power of 2)
|
||||
// Do this by shifting the raw value so that the exponent lies in the low bits,
|
||||
// then mask out the sign bit, and subtract the bias.
|
||||
static if (F.realFormat == RealFormat.ieeeSingle)
|
||||
{
|
||||
int exp = ((y.vu[F.EXPPOS_SHORT] >> 7) & 0xff) - 0x7f;
|
||||
|
||||
version (LittleEndian)
|
||||
int pos = 0;
|
||||
else
|
||||
int pos = 3;
|
||||
int exp = ((y.vi >> (T.mant_dig - 1)) & 0xff) - 0x7f;
|
||||
}
|
||||
else static if (F.realFormat == RealFormat.ieeeDouble)
|
||||
{
|
||||
@ -472,24 +482,43 @@ T floorImpl(T)(const T x) @trusted pure nothrow @nogc
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
exp = (T.mant_dig - 1) - exp;
|
||||
|
||||
// Zero 16 bits at a time.
|
||||
while (exp >= 16)
|
||||
static if (F.realFormat == RealFormat.ieeeSingle)
|
||||
{
|
||||
version (LittleEndian)
|
||||
y.vu[pos++] = 0;
|
||||
else
|
||||
y.vu[pos--] = 0;
|
||||
exp -= 16;
|
||||
if (exp < (T.mant_dig - 1))
|
||||
{
|
||||
// Clear all bits representing the fraction part.
|
||||
const uint fraction_mask = F.MANTISSAMASK_INT >> exp;
|
||||
|
||||
if ((y.vi & fraction_mask) != 0)
|
||||
{
|
||||
// If 'x' is negative, then first substract 1.0 from the value.
|
||||
if (y.vi < 0)
|
||||
y.vi += 0x00800000 >> exp;
|
||||
y.vi &= ~fraction_mask;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
exp = (T.mant_dig - 1) - exp;
|
||||
|
||||
// Clear the remaining bits.
|
||||
if (exp > 0)
|
||||
y.vu[pos] &= 0xffff ^ ((1 << exp) - 1);
|
||||
// Zero 16 bits at a time.
|
||||
while (exp >= 16)
|
||||
{
|
||||
version (LittleEndian)
|
||||
y.vu[pos++] = 0;
|
||||
else
|
||||
y.vu[pos--] = 0;
|
||||
exp -= 16;
|
||||
}
|
||||
|
||||
if ((x < 0.0) && (x != y.rv))
|
||||
y.rv -= 1.0;
|
||||
// Clear the remaining bits.
|
||||
if (exp > 0)
|
||||
y.vu[pos] &= 0xffff ^ ((1 << exp) - 1);
|
||||
|
||||
if ((x < 0.0) && (x != y.rv))
|
||||
y.rv -= 1.0;
|
||||
}
|
||||
|
||||
return y.rv;
|
||||
}
|
||||
@ -4870,10 +4899,7 @@ public:
|
||||
///
|
||||
version (GNU)
|
||||
{
|
||||
unittest
|
||||
{
|
||||
pragma(msg, "ieeeFlags test disabled, see LDC Issue #888");
|
||||
}
|
||||
// ieeeFlags test disabled, see LDC Issue #888.
|
||||
}
|
||||
else
|
||||
@system unittest
|
||||
@ -4904,10 +4930,7 @@ else
|
||||
|
||||
version (GNU)
|
||||
{
|
||||
unittest
|
||||
{
|
||||
pragma(msg, "ieeeFlags test disabled, see LDC Issue #888");
|
||||
}
|
||||
// ieeeFlags test disabled, see LDC Issue #888.
|
||||
}
|
||||
else
|
||||
@system unittest
|
||||
@ -4956,10 +4979,6 @@ else
|
||||
}
|
||||
}
|
||||
|
||||
version (X86_Any)
|
||||
{
|
||||
version = IeeeFlagsSupport;
|
||||
}
|
||||
version (X86_Any)
|
||||
{
|
||||
version = IeeeFlagsSupport;
|
||||
@ -5132,14 +5151,44 @@ struct FloatingPointControl
|
||||
| inexactException | subnormalException,
|
||||
}
|
||||
}
|
||||
else version (PPC_Any)
|
||||
{
|
||||
enum : ExceptionMask
|
||||
{
|
||||
inexactException = 0x0008,
|
||||
divByZeroException = 0x0010,
|
||||
underflowException = 0x0020,
|
||||
overflowException = 0x0040,
|
||||
invalidException = 0x0080,
|
||||
severeExceptions = overflowException | divByZeroException
|
||||
| invalidException,
|
||||
allExceptions = severeExceptions | underflowException
|
||||
| inexactException,
|
||||
}
|
||||
}
|
||||
else version (HPPA)
|
||||
{
|
||||
enum : ExceptionMask
|
||||
{
|
||||
inexactException = 0x01,
|
||||
underflowException = 0x02,
|
||||
overflowException = 0x04,
|
||||
divByZeroException = 0x08,
|
||||
invalidException = 0x10,
|
||||
severeExceptions = overflowException | divByZeroException
|
||||
| invalidException,
|
||||
allExceptions = severeExceptions | underflowException
|
||||
| inexactException,
|
||||
}
|
||||
}
|
||||
else version (MIPS_Any)
|
||||
{
|
||||
enum : ExceptionMask
|
||||
{
|
||||
inexactException = 0x0080,
|
||||
underflowException = 0x0100,
|
||||
overflowException = 0x0200,
|
||||
divByZeroException = 0x0400,
|
||||
overflowException = 0x0200,
|
||||
underflowException = 0x0100,
|
||||
invalidException = 0x0800,
|
||||
severeExceptions = overflowException | divByZeroException
|
||||
| invalidException,
|
||||
@ -5147,22 +5196,7 @@ struct FloatingPointControl
|
||||
| inexactException,
|
||||
}
|
||||
}
|
||||
else version (PPC_Any)
|
||||
{
|
||||
enum : ExceptionMask
|
||||
{
|
||||
inexactException = 0x08,
|
||||
divByZeroException = 0x10,
|
||||
underflowException = 0x20,
|
||||
overflowException = 0x40,
|
||||
invalidException = 0x80,
|
||||
severeExceptions = overflowException | divByZeroException
|
||||
| invalidException,
|
||||
allExceptions = severeExceptions | underflowException
|
||||
| inexactException,
|
||||
}
|
||||
}
|
||||
else version (SPARC64)
|
||||
else version (SPARC_Any)
|
||||
{
|
||||
enum : ExceptionMask
|
||||
{
|
||||
@ -5284,6 +5318,10 @@ private:
|
||||
{
|
||||
alias ControlState = uint;
|
||||
}
|
||||
else version (HPPA)
|
||||
{
|
||||
alias ControlState = uint;
|
||||
}
|
||||
else version (PPC_Any)
|
||||
{
|
||||
alias ControlState = uint;
|
||||
@ -5292,7 +5330,7 @@ private:
|
||||
{
|
||||
alias ControlState = uint;
|
||||
}
|
||||
else version (SPARC64)
|
||||
else version (SPARC_Any)
|
||||
{
|
||||
alias ControlState = ulong;
|
||||
}
|
||||
@ -5480,13 +5518,8 @@ private:
|
||||
}
|
||||
}
|
||||
|
||||
@system unittest
|
||||
version (D_HardFloat) @system unittest
|
||||
{
|
||||
// GCC floating point emulation doesn't allow changing
|
||||
// rounding modes, getting error bits etc
|
||||
version (GNU) version (D_SoftFloat)
|
||||
return;
|
||||
|
||||
void ensureDefaults()
|
||||
{
|
||||
assert(FloatingPointControl.rounding
|
||||
@ -5500,15 +5533,12 @@ private:
|
||||
}
|
||||
ensureDefaults();
|
||||
|
||||
version (D_HardFloat)
|
||||
{
|
||||
{
|
||||
FloatingPointControl ctrl;
|
||||
ctrl.rounding = FloatingPointControl.roundDown;
|
||||
assert(FloatingPointControl.rounding == FloatingPointControl.roundDown);
|
||||
}
|
||||
ensureDefaults();
|
||||
FloatingPointControl ctrl;
|
||||
ctrl.rounding = FloatingPointControl.roundDown;
|
||||
assert(FloatingPointControl.rounding == FloatingPointControl.roundDown);
|
||||
}
|
||||
ensureDefaults();
|
||||
|
||||
if (FloatingPointControl.hasExceptionTraps)
|
||||
{
|
||||
@ -5525,7 +5555,7 @@ private:
|
||||
ensureDefaults();
|
||||
}
|
||||
|
||||
@system unittest // rounding
|
||||
version (D_HardFloat) @system unittest // rounding
|
||||
{
|
||||
import std.meta : AliasSeq;
|
||||
|
||||
@ -6662,19 +6692,14 @@ if (isFloatingPoint!(F) && isIntegral!(G))
|
||||
|
||||
assert(pow(x, neg1) == 1 / x);
|
||||
|
||||
version (X86_64)
|
||||
{
|
||||
pragma(msg, "test disabled on x86_64, see bug 5628");
|
||||
}
|
||||
else version (ARM)
|
||||
{
|
||||
pragma(msg, "test disabled on ARM, see bug 5628");
|
||||
}
|
||||
else version (GNU)
|
||||
{
|
||||
pragma(msg, "test disabled on GNU, see bug 5628");
|
||||
}
|
||||
else
|
||||
// Test disabled on most targets.
|
||||
// See https://issues.dlang.org/show_bug.cgi?id=5628
|
||||
version (X86_64) enum BUG5628 = false;
|
||||
else version (ARM) enum BUG5628 = false;
|
||||
else version (GNU) enum BUG5628 = false;
|
||||
else enum BUG5628 = true;
|
||||
|
||||
static if (BUG5628)
|
||||
{
|
||||
assert(pow(xd, neg2) == 1 / (x * x));
|
||||
assert(pow(xf, neg8) == 1 / ((x * x) * (x * x) * (x * x) * (x * x)));
|
||||
|
@ -659,7 +659,7 @@ if (is(T == char) || is(T == ubyte))
|
||||
s.send(httpOK(req.bdy));
|
||||
});
|
||||
auto res = post(host ~ "/path", ["name1" : "value1", "name2" : "value2"]);
|
||||
assert(res == "name1=value1&name2=value2");
|
||||
assert(res == "name1=value1&name2=value2" || res == "name2=value2&name1=value1");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4517,8 +4517,15 @@ Initialize with a message and an error code.
|
||||
}
|
||||
}
|
||||
|
||||
enum StdFileHandle: string
|
||||
{
|
||||
stdin = "core.stdc.stdio.stdin",
|
||||
stdout = "core.stdc.stdio.stdout",
|
||||
stderr = "core.stdc.stdio.stderr",
|
||||
}
|
||||
|
||||
// Undocumented but public because the std* handles are aliasing it.
|
||||
@property ref File makeGlobal(alias handle)()
|
||||
@property ref File makeGlobal(StdFileHandle _iob)()
|
||||
{
|
||||
__gshared File.Impl impl;
|
||||
__gshared File result;
|
||||
@ -4537,7 +4544,9 @@ Initialize with a message and an error code.
|
||||
break;
|
||||
if (atomicOp!"+="(spinlock, 1) == 1)
|
||||
{
|
||||
impl.handle = handle;
|
||||
with (StdFileHandle)
|
||||
assert(_iob == stdin || _iob == stdout || _iob == stderr);
|
||||
impl.handle = mixin(_iob);
|
||||
result._p = &impl;
|
||||
atomicOp!"+="(spinlock, uint.max / 2);
|
||||
break;
|
||||
@ -4554,7 +4563,7 @@ Initialize with a message and an error code.
|
||||
it is thread un-safe to reassign `stdin` to a different `File` instance
|
||||
than the default.
|
||||
*/
|
||||
alias stdin = makeGlobal!(core.stdc.stdio.stdin);
|
||||
alias stdin = makeGlobal!(StdFileHandle.stdin);
|
||||
|
||||
///
|
||||
@safe unittest
|
||||
@ -4582,7 +4591,7 @@ alias stdin = makeGlobal!(core.stdc.stdio.stdin);
|
||||
it is thread un-safe to reassign `stdout` to a different `File` instance
|
||||
than the default.
|
||||
*/
|
||||
alias stdout = makeGlobal!(core.stdc.stdio.stdout);
|
||||
alias stdout = makeGlobal!(StdFileHandle.stdout);
|
||||
|
||||
/**
|
||||
The standard error stream.
|
||||
@ -4591,7 +4600,7 @@ alias stdout = makeGlobal!(core.stdc.stdio.stdout);
|
||||
it is thread un-safe to reassign `stderr` to a different `File` instance
|
||||
than the default.
|
||||
*/
|
||||
alias stderr = makeGlobal!(core.stdc.stdio.stderr);
|
||||
alias stderr = makeGlobal!(StdFileHandle.stderr);
|
||||
|
||||
@system unittest
|
||||
{
|
||||
|
@ -28,10 +28,11 @@ immutable
|
||||
{
|
||||
win32 = 1, /// Microsoft 32 bit Windows systems
|
||||
win64, /// Microsoft 64 bit Windows systems
|
||||
linux, /// All Linux Systems
|
||||
linux, /// All Linux Systems, except for Android
|
||||
osx, /// Mac OS X
|
||||
freeBSD, /// FreeBSD
|
||||
netBSD, /// NetBSD
|
||||
dragonFlyBSD, /// DragonFlyBSD
|
||||
solaris, /// Solaris
|
||||
android, /// Android
|
||||
otherPosix /// Other Posix Systems
|
||||
@ -45,6 +46,7 @@ immutable
|
||||
else version (OSX) OS os = OS.osx;
|
||||
else version (FreeBSD) OS os = OS.freeBSD;
|
||||
else version (NetBSD) OS os = OS.netBSD;
|
||||
else version (DragonFlyBSD) OS os = OS.dragonFlyBSD;
|
||||
else version (Posix) OS os = OS.otherPosix;
|
||||
else static assert(0, "Unknown OS.");
|
||||
|
||||
|
@ -403,7 +403,8 @@ package string urlEncode(in string[string] values)
|
||||
string[string] a;
|
||||
assert(urlEncode(a) == "");
|
||||
assert(urlEncode(["name1" : "value1"]) == "name1=value1");
|
||||
assert(urlEncode(["name1" : "value1", "name2" : "value2"]) == "name1=value1&name2=value2");
|
||||
auto enc = urlEncode(["name1" : "value1", "name2" : "value2"]);
|
||||
assert(enc == "name1=value1&name2=value2" || enc == "name2=value2&name1=value1");
|
||||
}
|
||||
|
||||
/***************************
|
||||
|
Loading…
Reference in New Issue
Block a user