-5e4492c45172110b035591f5961b9f9f5adf6f13
+d37ef985a97eb446371ab4b2315a52b87233fbf3
The first line of this file holds the git revision number of the last
merge done from the dlang/druntime repository.
core/sys/dragonflybsd/sys/mman.d core/sys/dragonflybsd/sys/socket.d \
core/sys/dragonflybsd/time.d
-DRUNTIME_DSOURCES_FREEBSD = core/sys/freebsd/dlfcn.d \
- core/sys/freebsd/execinfo.d core/sys/freebsd/netinet/in_.d \
- core/sys/freebsd/pthread_np.d core/sys/freebsd/string.d \
- core/sys/freebsd/sys/_bitset.d core/sys/freebsd/sys/_cpuset.d \
- core/sys/freebsd/sys/cdefs.d core/sys/freebsd/sys/elf.d \
- core/sys/freebsd/sys/elf32.d core/sys/freebsd/sys/elf64.d \
- core/sys/freebsd/sys/elf_common.d core/sys/freebsd/sys/event.d \
- core/sys/freebsd/sys/link_elf.d core/sys/freebsd/sys/mman.d \
- core/sys/freebsd/sys/mount.d core/sys/freebsd/time.d \
- core/sys/freebsd/unistd.d
+DRUNTIME_DSOURCES_FREEBSD = core/sys/freebsd/config.d \
+ core/sys/freebsd/dlfcn.d core/sys/freebsd/execinfo.d \
+ core/sys/freebsd/netinet/in_.d core/sys/freebsd/pthread_np.d \
+ core/sys/freebsd/string.d core/sys/freebsd/sys/_bitset.d \
+ core/sys/freebsd/sys/_cpuset.d core/sys/freebsd/sys/cdefs.d \
+ core/sys/freebsd/sys/elf.d core/sys/freebsd/sys/elf32.d \
+ core/sys/freebsd/sys/elf64.d core/sys/freebsd/sys/elf_common.d \
+ core/sys/freebsd/sys/event.d core/sys/freebsd/sys/link_elf.d \
+ core/sys/freebsd/sys/mman.d core/sys/freebsd/sys/mount.d \
+ core/sys/freebsd/time.d core/sys/freebsd/unistd.d
DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \
core/sys/linux/dlfcn.d core/sys/linux/elf.d core/sys/linux/epoll.d \
am__objects_9 = core/sys/bionic/fcntl.lo core/sys/bionic/string.lo \
core/sys/bionic/unistd.lo
@DRUNTIME_OS_ANDROID_TRUE@am__objects_10 = $(am__objects_9)
-am__objects_11 = core/sys/freebsd/dlfcn.lo \
+am__objects_11 = core/sys/freebsd/config.lo core/sys/freebsd/dlfcn.lo \
core/sys/freebsd/execinfo.lo core/sys/freebsd/netinet/in_.lo \
core/sys/freebsd/pthread_np.lo core/sys/freebsd/string.lo \
core/sys/freebsd/sys/_bitset.lo \
core/sys/dragonflybsd/sys/mman.d core/sys/dragonflybsd/sys/socket.d \
core/sys/dragonflybsd/time.d
-DRUNTIME_DSOURCES_FREEBSD = core/sys/freebsd/dlfcn.d \
- core/sys/freebsd/execinfo.d core/sys/freebsd/netinet/in_.d \
- core/sys/freebsd/pthread_np.d core/sys/freebsd/string.d \
- core/sys/freebsd/sys/_bitset.d core/sys/freebsd/sys/_cpuset.d \
- core/sys/freebsd/sys/cdefs.d core/sys/freebsd/sys/elf.d \
- core/sys/freebsd/sys/elf32.d core/sys/freebsd/sys/elf64.d \
- core/sys/freebsd/sys/elf_common.d core/sys/freebsd/sys/event.d \
- core/sys/freebsd/sys/link_elf.d core/sys/freebsd/sys/mman.d \
- core/sys/freebsd/sys/mount.d core/sys/freebsd/time.d \
- core/sys/freebsd/unistd.d
+DRUNTIME_DSOURCES_FREEBSD = core/sys/freebsd/config.d \
+ core/sys/freebsd/dlfcn.d core/sys/freebsd/execinfo.d \
+ core/sys/freebsd/netinet/in_.d core/sys/freebsd/pthread_np.d \
+ core/sys/freebsd/string.d core/sys/freebsd/sys/_bitset.d \
+ core/sys/freebsd/sys/_cpuset.d core/sys/freebsd/sys/cdefs.d \
+ core/sys/freebsd/sys/elf.d core/sys/freebsd/sys/elf32.d \
+ core/sys/freebsd/sys/elf64.d core/sys/freebsd/sys/elf_common.d \
+ core/sys/freebsd/sys/event.d core/sys/freebsd/sys/link_elf.d \
+ core/sys/freebsd/sys/mman.d core/sys/freebsd/sys/mount.d \
+ core/sys/freebsd/time.d core/sys/freebsd/unistd.d
DRUNTIME_DSOURCES_LINUX = core/sys/linux/config.d \
core/sys/linux/dlfcn.d core/sys/linux/elf.d core/sys/linux/epoll.d \
core/sys/freebsd/$(am__dirstamp):
@$(MKDIR_P) core/sys/freebsd
@: > core/sys/freebsd/$(am__dirstamp)
+core/sys/freebsd/config.lo: core/sys/freebsd/$(am__dirstamp)
core/sys/freebsd/dlfcn.lo: core/sys/freebsd/$(am__dirstamp)
core/sys/freebsd/execinfo.lo: core/sys/freebsd/$(am__dirstamp)
core/sys/freebsd/netinet/$(am__dirstamp):
F // D
U // C
W // Windows
- V // Pascal
R // C++
FuncAttrs:
popFront();
put( "extern (Windows) " );
break;
- case 'V': // Pascal
- popFront();
- put( "extern (Pascal) " );
- break;
case 'R': // C++
popFront();
put( "extern (C++) " );
private template hasPlainMangling(FT) if (is(FT == function))
{
enum lnk = __traits(getLinkage, FT);
- // C || Pascal || Windows
- enum hasPlainMangling = lnk == "C" || lnk == "Pascal" || lnk == "Windows";
+ // C || Windows
+ enum hasPlainMangling = lnk == "C" || lnk == "Windows";
}
@safe pure nothrow unittest
{
static extern(D) void fooD();
static extern(C) void fooC();
- static extern(Pascal) void fooP();
static extern(Windows) void fooW();
static extern(C++) void fooCPP();
}
static assert(check!(typeof(fooD))(true, false, false));
static assert(check!(typeof(fooC))(false, false, true));
- static assert(check!(typeof(fooP))(false, false, true));
static assert(check!(typeof(fooW))(false, false, true));
static assert(check!(typeof(fooCPP))(false, true, false));
static assert(__traits(compiles, mangleFunc!(typeof(&fooD))("")));
static assert(__traits(compiles, mangleFunc!(typeof(&fooC))("")));
- static assert(__traits(compiles, mangleFunc!(typeof(&fooP))("")));
static assert(__traits(compiles, mangleFunc!(typeof(&fooW))("")));
static assert(!__traits(compiles, mangleFunc!(typeof(&fooCPP))("")));
}
"pure @safe void testexpansion.s!(testexpansion.s!(int).s(int).Result).s(testexpansion.s!(int).s(int).Result).Result.foo()"],
["_D13testexpansion__T1sTSQw__TQjTiZQoFiZ6ResultZQBbFQBcZQq3fooMFNaNfZv",
"pure @safe void testexpansion.s!(testexpansion.s!(int).s(int).Result).s(testexpansion.s!(int).s(int).Result).Result.foo()"],
- // ambiguity on 'V', template value argument or pascal function
+ // formerly ambiguous on 'V', template value argument or pascal function
+ // pascal functions have now been removed (in v2.095.0)
["_D3std4conv__T7enumRepTyAaTEQBa12experimental9allocator15building_blocks15stats_collector7OptionsVQCti64ZQDnyQDh",
"immutable(char[]) std.conv.enumRep!(immutable(char[]), std.experimental.allocator.building_blocks.stats_collector.Options, 64).enumRep"],
// symbol back reference to location with symbol back reference
{
if (__ctfe)
{
- static if (T.mant_dig == float.mant_dig || T.mant_dig == double.mant_dig)
+ static if (floatFormat!T == FloatFormat.Float || floatFormat!T == FloatFormat.Double)
{
static if (is(T : ireal)) // https://issues.dlang.org/show_bug.cgi?id=19932
const f = val.im;
static if (T.mant_dig == 24)
enum floatFormat = FloatFormat.Float;
else static if (T.mant_dig == 53)
- enum floatFormat = FloatFormat.Double;
+ {
+ // Double precision, or real == double
+ static if (T.sizeof == double.sizeof)
+ enum floatFormat = FloatFormat.Double;
+ // 80-bit real with rounding precision set to 53 bits.
+ else static if (T.sizeof == real.sizeof)
+ enum floatFormat = FloatFormat.Real80;
+ }
else static if (T.mant_dig == 64)
enum floatFormat = FloatFormat.Real80;
else static if (T.mant_dig == 106)
--- /dev/null
+/**
+ * D header file for FreeBSD
+ *
+ * Authors: Iain Buclaw
+ */
+module core.sys.freebsd.config;
+
+version (FreeBSD):
+
+public import core.sys.posix.config;
+
+// https://svnweb.freebsd.org/base/head/sys/sys/param.h?view=markup
+// __FreeBSD_version numbers are documented in the Porter's Handbook.
+// NOTE: When adding newer versions of FreeBSD, verify all current versioned
+// bindings are still compatible with the release.
+ version (FreeBSD_12) enum __FreeBSD_version = 1202000;
+else version (FreeBSD_11) enum __FreeBSD_version = 1104000;
+else version (FreeBSD_10) enum __FreeBSD_version = 1004000;
+else version (FreeBSD_9) enum __FreeBSD_version = 903000;
+else version (FreeBSD_8) enum __FreeBSD_version = 804000;
+else static assert(false, "Unsupported version of FreeBSD");
+
+// First version of FreeBSD to support 64-bit stat buffer.
+enum INO64_FIRST = 1200031;
nothrow:
@nogc:
+import core.sys.freebsd.config;
import core.stdc.stdint; // intptr_t, uintptr_t
import core.sys.posix.time; // timespec
EVFILT_SYSCOUNT = 11,
}
-extern(D) void EV_SET(kevent_t* kevp, typeof(kevent_t.tupleof) args)
+static if (__FreeBSD_version >= 1200000)
{
- *kevp = kevent_t(args);
+ struct kevent_t
+ {
+ uintptr_t ident;
+ short filter;
+ ushort flags;
+ uint fflags;
+ long data;
+ void* udata;
+ ulong[4] ext;
+ }
+}
+else
+{
+ struct kevent_t
+ {
+ uintptr_t ident; /* identifier for this event */
+ short filter; /* filter for event */
+ ushort flags;
+ uint fflags;
+ intptr_t data;
+ void *udata; /* opaque user data identifier */
+ }
}
-struct kevent_t
+extern(D) void EV_SET(kevent_t* kevp, typeof(kevent_t.tupleof) args)
{
- uintptr_t ident; /* identifier for this event */
- short filter; /* filter for event */
- ushort flags;
- uint fflags;
- intptr_t data;
- void *udata; /* opaque user data identifier */
+ *kevp = kevent_t(args);
}
enum
version (FreeBSD):
+import core.sys.freebsd.config;
import core.stdc.config : c_long;
import core.sys.posix.sys.stat : stat_t;
import core.sys.posix.sys.types : uid_t;
}
enum MFSNAMELEN = 16;
-enum MNAMELEN = 88;
-enum STATFS_VERSION = 0x20030518;
+
+static if (__FreeBSD_version >= 1200000)
+{
+ enum MNAMELEN = 1024;
+ enum STATFS_VERSION = 0x20140518;
+}
+else
+{
+ enum MNAMELEN = 88;
+ enum STATFS_VERSION = 0x20030518;
+}
struct statfs_t
{
}
else version (FreeBSD)
{
+ import core.sys.freebsd.config;
+
// https://github.com/freebsd/freebsd/blob/master/sys/sys/dirent.h
enum
{
DT_WHT = 14
}
- align(4)
- struct dirent
+ static if (__FreeBSD_version >= 1200000)
{
- uint d_fileno;
- ushort d_reclen;
- ubyte d_type;
- ubyte d_namlen;
- char[256] d_name = 0;
+ struct dirent
+ {
+ ino_t d_fileno;
+ off_t d_off;
+ ushort d_reclen;
+ ubyte d_type;
+ ubyte d_pad0;
+ ushort d_namlen;
+ ushort d_pad1;
+ char[256] d_name = 0;
+ }
+ }
+ else
+ {
+ align(4)
+ struct dirent
+ {
+ uint d_fileno;
+ ushort d_reclen;
+ ubyte d_type;
+ ubyte d_namlen;
+ char[256] d_name = 0;
+ }
}
alias void* DIR;
}
else version (FreeBSD)
{
- // https://github.com/freebsd/freebsd/blob/master/sys/sys/stat.h
+ import core.sys.freebsd.config;
- struct stat_t
+ // https://github.com/freebsd/freebsd/blob/master/sys/sys/stat.h
+ static if (__FreeBSD_version >= INO64_FIRST)
{
- dev_t st_dev;
- ino_t st_ino;
- mode_t st_mode;
- nlink_t st_nlink;
- uid_t st_uid;
- gid_t st_gid;
- dev_t st_rdev;
+ struct stat_t
+ {
+ dev_t st_dev;
+ ino_t st_ino;
+ nlink_t st_nlink;
+ mode_t st_mode;
+ short st_padding0;
+ uid_t st_uid;
+ gid_t st_gid;
+ int st_padding1;
+ dev_t st_rdev;
- time_t st_atime;
- c_long __st_atimensec;
- time_t st_mtime;
- c_long __st_mtimensec;
- time_t st_ctime;
- c_long __st_ctimensec;
+ version (X86) int st_atim_ext;
+ timespec st_atim;
- off_t st_size;
- blkcnt_t st_blocks;
- blksize_t st_blksize;
- fflags_t st_flags;
- uint st_gen;
- int st_lspare;
+ version (X86) int st_mtim_ext;
+ timespec st_mtim;
+
+ version (X86) int st_ctim_ext;
+ timespec st_ctim;
- time_t st_birthtime;
- c_long st_birthtimensec;
+ version (X86) int st_btim_ext;
+ timespec st_birthtim;
- ubyte[16 - timespec.sizeof] padding;
+ off_t st_size;
+ blkcnt_t st_blocks;
+ blksize_t st_blksize;
+ fflags_t st_flags;
+ ulong st_gen;
+ ulong[10] st_spare;
+
+ extern(D) @safe @property inout pure nothrow
+ {
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
+ ref inout(time_t) st_birthtime() return { return st_birthtim.tv_sec; }
+ }
+ }
+ }
+ else
+ {
+ struct stat_t
+ {
+ uint st_dev;
+ uint st_ino;
+ mode_t st_mode;
+ ushort st_nlink;
+ uid_t st_uid;
+ gid_t st_gid;
+ uint st_rdev;
+ timespec st_atim;
+ timespec st_mtim;
+ timespec st_ctim;
+ off_t st_size;
+ blkcnt_t st_blocks;
+ blksize_t st_blksize;
+ fflags_t st_flags;
+ uint st_gen;
+ int st_lspare;
+ timespec st_birthtim;
+ ubyte[16 - timespec.sizeof] padding;
+
+ extern(D) @safe @property inout pure nothrow
+ {
+ ref inout(time_t) st_atime() return { return st_atim.tv_sec; }
+ ref inout(time_t) st_mtime() return { return st_mtim.tv_sec; }
+ ref inout(time_t) st_ctime() return { return st_ctim.tv_sec; }
+ ref inout(time_t) st_birthtime() return { return st_birthtim.tv_sec; }
+ }
+ }
}
enum S_IRUSR = 0x100; // octal 0000400
}
else version (FreeBSD)
{
+ import core.sys.freebsd.config;
+
// https://github.com/freebsd/freebsd/blob/master/sys/sys/_types.h
alias long blkcnt_t;
alias uint blksize_t;
- alias uint dev_t;
+
+ static if (__FreeBSD_version >= 1200000)
+ {
+ alias ulong dev_t;
+ alias ulong ino_t;
+ alias ulong nlink_t;
+ }
+ else
+ {
+ alias uint dev_t;
+ alias uint ino_t;
+ alias ushort nlink_t;
+ }
+
alias uint gid_t;
- alias uint ino_t;
alias ushort mode_t;
- alias ushort nlink_t;
alias long off_t;
alias int pid_t;
//size_t (defined in core.stdc.stddef)
lockMutex(cast(Mutex*)&gcs.mtx);
if (atomicLoad!(MemoryOrder.raw)(*cast(shared) pcs) is null)
{
- auto cs = new shared D_CRITICAL_SECTION;
+ auto cs = new shared(D_CRITICAL_SECTION);
initMutex(cast(Mutex*)&cs.mtx);
atomicStore!(MemoryOrder.rel)(*cast(shared) pcs, cs);
}
* Source: $(DRUNTIMESRC src/rt/_dmain2.d)
*/
-/* NOTE: This file has been patched from the original DMD distribution to
- * work with the GDC compiler.
- */
module rt.dmain2;
private
version (CRuntime_Microsoft)
{
// enable full precision for reals
- version (GNU)
+ version (D_InlineAsm_X86_64)
{
- size_t fpu_cw;
- asm { "fstcw %0" : "=m" (fpu_cw); }
- fpu_cw |= 0b11_00_111111; // 11: use 64 bit extended-precision
- // 111111: mask all FP exceptions
- asm { "fldcw %0" : "=m" (fpu_cw); }
- }
- else version (Win64)
asm
{
push RAX;
fldcw word ptr [RSP];
pop RAX;
}
- else version (Win32)
+ }
+ else version (D_InlineAsm_X86)
{
asm
{
{
if (IsDebuggerPresent())
trapExceptions = false;
- version (GNU)
- {
- /* IsDebuggerPresent doesn't detect GDC. Would be nice to have
- some way of detecting valid console output */
- trapExceptions = true;
- }
}
void tryExec(scope void delegate() dg)