Fix some safety annotation issues.

This commit is contained in:
Sönke Ludwig 2016-11-10 12:19:39 +01:00
parent ccbd6a063f
commit 81b7010724

View file

@ -106,7 +106,7 @@ struct FreeListRef(T, bool INIT = true)
private size_t m_magic = 0x1EE75817; // workaround for compiler bug private size_t m_magic = 0x1EE75817; // workaround for compiler bug
static FreeListRef opCall(ARGS...)(ARGS args) static FreeListRef opCall(ARGS...)(ARGS args)
@safe { {
//logInfo("refalloc %s/%d", T.stringof, ElemSize); //logInfo("refalloc %s/%d", T.stringof, ElemSize);
FreeListRef ret; FreeListRef ret;
ret.m_object = ObjAlloc.alloc(args); ret.m_object = ObjAlloc.alloc(args);
@ -187,7 +187,7 @@ in {
format("emplace: Chunk size too small: %s < %s size = %s", format("emplace: Chunk size too small: %s < %s size = %s",
chunk.length, T.stringof, T.sizeof)); chunk.length, T.stringof, T.sizeof));
assert((cast(size_t) chunk.ptr) % T.alignof == 0, assert((cast(size_t) chunk.ptr) % T.alignof == 0,
format("emplace: Misaligned memory block (0x%X): it must be %s-byte aligned for type %s", chunk.ptr, T.alignof, T.stringof)); format("emplace: Misaligned memory block (0x%X): it must be %s-byte aligned for type %s", &chunk[0], T.alignof, T.stringof));
} body { } body {
enum classSize = __traits(classInstanceSize, T); enum classSize = __traits(classInstanceSize, T);
@ -226,7 +226,7 @@ in {
format("emplace: Chunk size too small: %s < %s size = %s", format("emplace: Chunk size too small: %s < %s size = %s",
chunk.length, T.stringof, T.sizeof)); chunk.length, T.stringof, T.sizeof));
assert((cast(size_t) chunk.ptr) % T.alignof == 0, assert((cast(size_t) chunk.ptr) % T.alignof == 0,
format("emplace: Misaligned memory block (0x%X): it must be %s-byte aligned for type %s", chunk.ptr, T.alignof, T.stringof)); format("emplace: Misaligned memory block (0x%X): it must be %s-byte aligned for type %s", &chunk[0], T.alignof, T.stringof));
} body { } body {
return emplace(() @trusted { return cast(T*)chunk.ptr; } (), args); return emplace(() @trusted { return cast(T*)chunk.ptr; } (), args);