diff --git a/src/core/bitop.d b/src/core/bitop.d index 8441701d2a..bc58615b5e 100644 --- a/src/core/bitop.d +++ b/src/core/bitop.d @@ -267,7 +267,7 @@ unittest * (No longer an intrisic - the compiler recognizes the patterns * in the body.) */ -int bt(in size_t* p, size_t bitnum) pure @system +int bt(const scope size_t* p, size_t bitnum) pure @system { static if (size_t.sizeof == 8) return ((p[bitnum >> 6] & (1L << (bitnum & 63)))) != 0; @@ -954,28 +954,28 @@ version (D_InlineAsm_X86_64) * Bitwise rotate `value` left (`rol`) or right (`ror`) by * `count` bit positions. */ -pure T rol(T)(in T value, in uint count) +pure T rol(T)(const scope T value, const scope uint count) if (__traits(isIntegral, T) && __traits(isUnsigned, T)) { assert(count < 8 * T.sizeof); return cast(T) ((value << count) | (value >> (-count & (T.sizeof * 8 - 1)))); } /// ditto -pure T ror(T)(in T value, in uint count) +pure T ror(T)(const scope T value, const scope uint count) if (__traits(isIntegral, T) && __traits(isUnsigned, T)) { assert(count < 8 * T.sizeof); return cast(T) ((value >> count) | (value << (-count & (T.sizeof * 8 - 1)))); } /// ditto -pure T rol(uint count, T)(in T value) +pure T rol(uint count, T)(const scope T value) if (__traits(isIntegral, T) && __traits(isUnsigned, T)) { static assert(count < 8 * T.sizeof); return cast(T) ((value << count) | (value >> (-count & (T.sizeof * 8 - 1)))); } /// ditto -pure T ror(uint count, T)(in T value) +pure T ror(uint count, T)(const scope T value) if (__traits(isIntegral, T) && __traits(isUnsigned, T)) { static assert(count < 8 * T.sizeof); diff --git a/src/core/gc/gcinterface.d b/src/core/gc/gcinterface.d index e4e3941e38..9b2b5f678b 100644 --- a/src/core/gc/gcinterface.d +++ b/src/core/gc/gcinterface.d @@ -33,7 +33,7 @@ struct Range void* ptop; TypeInfo ti; // should be tail const, but doesn't exist for references alias pbot this; // only consider pbot for relative ordering (opCmp) - bool opEquals(in Range rhs) nothrow const { return pbot == rhs.pbot; } + bool opEquals(const scope Range rhs) nothrow const { return pbot == rhs.pbot; } } interface GC @@ -182,7 +182,7 @@ interface GC /** * run finalizers */ - void runFinalizers(in void[] segment) nothrow; + void runFinalizers(const scope void[] segment) nothrow; /* * diff --git a/src/core/internal/utf.d b/src/core/internal/utf.d index 324618c1d7..5c0f4459a0 100644 --- a/src/core/internal/utf.d +++ b/src/core/internal/utf.d @@ -539,7 +539,7 @@ void encode(ref dchar[] s, dchar c) /** Returns the code length of $(D c) in the encoding using $(D C) as a -code point. The code is returned in character count, not in bytes. +code point. The code is returned const scope character count, not in bytes. */ @safe pure nothrow @nogc ubyte codeLength(C)(dchar c) @@ -571,7 +571,7 @@ Checks to see if string is well formed or not. $(D S) can be an array if it is not. Use to check all untrusted input for correctness. */ @safe pure -void validate(S)(in S s) +void validate(S)(const scope S s) { auto len = s.length; for (size_t i = 0; i < len; ) diff --git a/src/core/memory.d b/src/core/memory.d index 9188a42367..661ff20baa 100644 --- a/src/core/memory.d +++ b/src/core/memory.d @@ -141,12 +141,12 @@ private extern (C) GC.Stats gc_stats ( ) nothrow @nogc; extern (C) GC.ProfileStats gc_profileStats ( ) nothrow @nogc @safe; - extern (C) void gc_addRoot( in void* p ) nothrow @nogc; - extern (C) void gc_addRange( in void* p, size_t sz, const TypeInfo ti = null ) nothrow @nogc; + extern (C) void gc_addRoot( const scope void* p ) nothrow @nogc; + extern (C) void gc_addRange( const scope void* p, size_t sz, const TypeInfo ti = null ) nothrow @nogc; - extern (C) void gc_removeRoot( in void* p ) nothrow @nogc; - extern (C) void gc_removeRange( in void* p ) nothrow @nogc; - extern (C) void gc_runFinalizers( in void[] segment ); + extern (C) void gc_removeRoot( const scope void* p ) nothrow @nogc; + extern (C) void gc_removeRange( const scope void* p ) nothrow @nogc; + extern (C) void gc_runFinalizers( const scope void[] segment ); package extern (C) bool gc_inFinalizer(); } @@ -309,7 +309,7 @@ struct GC * A bit field containing any bits set for the memory block referenced by * p or zero on error. */ - static uint getAttr( in void* p ) nothrow + static uint getAttr( const scope void* p ) nothrow { return getAttr(cast()p); } @@ -336,7 +336,7 @@ struct GC * The result of a call to getAttr after the specified bits have been * set. */ - static uint setAttr( in void* p, uint a ) nothrow + static uint setAttr( const scope void* p, uint a ) nothrow { return setAttr(cast()p, a); } @@ -363,7 +363,7 @@ struct GC * The result of a call to getAttr after the specified bits have been * cleared. */ - static uint clrAttr( in void* p, uint a ) nothrow + static uint clrAttr( const scope void* p, uint a ) nothrow { return clrAttr(cast()p, a); } @@ -651,7 +651,7 @@ struct GC * Returns: * The size in bytes of the memory block referenced by p or zero on error. */ - static size_t sizeOf( in void* p ) nothrow @nogc /* FIXME pure */ + static size_t sizeOf( const scope void* p ) nothrow @nogc /* FIXME pure */ { return gc_sizeOf(cast(void*)p); } @@ -689,7 +689,7 @@ struct GC * Information regarding the memory block referenced by p or BlkInfo.init * on error. */ - static BlkInfo query( in void* p ) nothrow + static BlkInfo query( const scope void* p ) nothrow { return gc_query(cast(void*)p); } @@ -764,7 +764,7 @@ struct GC * } * --- */ - static void addRoot( in void* p ) nothrow @nogc /* FIXME pure */ + static void addRoot( const scope void* p ) nothrow @nogc /* FIXME pure */ { gc_addRoot( p ); } @@ -778,7 +778,7 @@ struct GC * Params: * p = A pointer into a GC-managed memory block or null. */ - static void removeRoot( in void* p ) nothrow @nogc /* FIXME pure */ + static void removeRoot( const scope void* p ) nothrow @nogc /* FIXME pure */ { gc_removeRoot( p ); } @@ -812,7 +812,7 @@ struct GC * // rawMemory will be recognized on collection. * --- */ - static void addRange( in void* p, size_t sz, const TypeInfo ti = null ) @nogc nothrow /* FIXME pure */ + static void addRange( const scope void* p, size_t sz, const TypeInfo ti = null ) @nogc nothrow /* FIXME pure */ { gc_addRange( p, sz, ti ); } @@ -827,7 +827,7 @@ struct GC * Params: * p = A pointer to a valid memory address or to null. */ - static void removeRange( in void* p ) nothrow @nogc /* FIXME pure */ + static void removeRange( const scope void* p ) nothrow @nogc /* FIXME pure */ { gc_removeRange( p ); } @@ -843,7 +843,7 @@ struct GC * Params: * segment = address range of a code segment. */ - static void runFinalizers( in void[] segment ) + static void runFinalizers( const scope void[] segment ) { gc_runFinalizers( segment ); } diff --git a/src/core/runtime.d b/src/core/runtime.d index e44b52142c..4af55fe887 100644 --- a/src/core/runtime.d +++ b/src/core/runtime.d @@ -210,7 +210,7 @@ struct Runtime * Returns: * A reference to the library or null on error. */ - static void* loadLibrary()(in char[] name) + static void* loadLibrary()(const scope char[] name) { import core.stdc.stdlib : free, malloc; version (Windows) diff --git a/src/core/sys/posix/dlfcn.d b/src/core/sys/posix/dlfcn.d index 64d79fc4cb..d7c72bb8ee 100644 --- a/src/core/sys/posix/dlfcn.d +++ b/src/core/sys/posix/dlfcn.d @@ -157,8 +157,8 @@ else version (FreeBSD) int dlclose(void*); char* dlerror(); - void* dlopen(in char*, int); - void* dlsym(void*, in char*); + void* dlopen(const char*, int); + void* dlsym(void*, const char*); int dladdr(const(void)* addr, Dl_info* info); struct Dl_info diff --git a/src/core/sys/posix/stdio.d b/src/core/sys/posix/stdio.d index e617595554..b56201c455 100644 --- a/src/core/sys/posix/stdio.d +++ b/src/core/sys/posix/stdio.d @@ -75,7 +75,7 @@ int fscanf(FILE*, const scope char*, ...); int fseek(FILE*, c_long, int); int fsetpos(FILE*, const scope fpos_t*); c_long ftell(FILE*); -size_t fwrite(in void *, size_t, size_t, FILE*); +size_t fwrite(const void *, size_t, size_t, FILE*); int getc(FILE*); int getchar(); char* gets(char*); diff --git a/src/core/time.d b/src/core/time.d index aed04e2df1..235d174b5b 100644 --- a/src/core/time.d +++ b/src/core/time.d @@ -776,7 +776,7 @@ public: Params: rhs = The duration to add to or subtract from this $(D Duration). +/ - ref Duration opOpAssign(string op, D)(in D rhs) nothrow @nogc + ref Duration opOpAssign(string op, D)(const scope D rhs) nothrow @nogc if (((op == "+" || op == "-" || op == "%") && is(_Unqual!D == Duration)) || ((op == "+" || op == "-") && is(_Unqual!D == TickDuration))) { @@ -2287,7 +2287,7 @@ assert(before + timeElapsed == after); unittest { - static void test(in MonoTimeImpl before, in MonoTimeImpl after, in Duration min) + static void test(in MonoTimeImpl before, in MonoTimeImpl after, const scope Duration min) { immutable diff = after - before; assert(diff >= min); diff --git a/src/gc/impl/conservative/gc.d b/src/gc/impl/conservative/gc.d index 19aa70de14..bad48842a9 100644 --- a/src/gc/impl/conservative/gc.d +++ b/src/gc/impl/conservative/gc.d @@ -970,9 +970,9 @@ class ConservativeGC : GC } - void runFinalizers(in void[] segment) nothrow + void runFinalizers(const scope void[] segment) nothrow { - static void go(Gcx* gcx, in void[] segment) nothrow + static void go(Gcx* gcx, const scope void[] segment) nothrow { gcx.runFinalizers(segment); } @@ -1459,7 +1459,7 @@ struct Gcx /** * */ - void runFinalizers(in void[] segment) nothrow + void runFinalizers(const scope void[] segment) nothrow { ConservativeGC._inFinalizer = true; scope (failure) ConservativeGC._inFinalizer = false; @@ -3641,7 +3641,7 @@ struct LargeObjectPool return info; } - void runFinalizers(in void[] segment) nothrow + void runFinalizers(const scope void[] segment) nothrow { foreach (pn; 0 .. npages) { @@ -3755,7 +3755,7 @@ struct SmallObjectPool return info; } - void runFinalizers(in void[] segment) nothrow + void runFinalizers(const scope void[] segment) nothrow { foreach (pn; 0 .. npages) { diff --git a/src/gc/impl/manual/gc.d b/src/gc/impl/manual/gc.d index 292a5b26d7..7f65a444b6 100644 --- a/src/gc/impl/manual/gc.d +++ b/src/gc/impl/manual/gc.d @@ -264,7 +264,7 @@ class ManualGC : GC return 0; } - void runFinalizers(in void[] segment) nothrow + void runFinalizers(const scope void[] segment) nothrow { } diff --git a/src/gc/impl/proto/gc.d b/src/gc/impl/proto/gc.d index 2d6fc3685c..86dd94f35a 100644 --- a/src/gc/impl/proto/gc.d +++ b/src/gc/impl/proto/gc.d @@ -232,7 +232,7 @@ class ProtoGC : GC return 0; } - void runFinalizers(in void[] segment) nothrow + void runFinalizers(const scope void[] segment) nothrow { } diff --git a/src/gc/proxy.d b/src/gc/proxy.d index 81f7fff312..e77f584cd1 100644 --- a/src/gc/proxy.d +++ b/src/gc/proxy.d @@ -240,7 +240,7 @@ extern (C) return instance.removeRange( p ); } - void gc_runFinalizers( in void[] segment ) nothrow + void gc_runFinalizers( const scope void[] segment ) nothrow { return instance.runFinalizers( segment ); } diff --git a/src/object.d b/src/object.d index 6fb84ab86c..490013ad67 100644 --- a/src/object.d +++ b/src/object.d @@ -973,10 +973,10 @@ class TypeInfo } /// Compares two instances for equality. - bool equals(in void* p1, in void* p2) const { return p1 == p2; } + bool equals(const scope void* p1, const scope void* p2) const { return p1 == p2; } /// Compares two instances for <, ==, or >. - int compare(in void* p1, in void* p2) const { return _xopCmp(p1, p2); } + int compare(const scope void* p1, const scope void* p2) const { return _xopCmp(p1, p2); } /// Returns size of the type. @property size_t tsize() nothrow pure const @safe @nogc { return 0; } @@ -1048,8 +1048,8 @@ class TypeInfo_Enum : TypeInfo } override size_t getHash(scope const void* p) const { return base.getHash(p); } - override bool equals(in void* p1, in void* p2) const { return base.equals(p1, p2); } - override int compare(in void* p1, in void* p2) const { return base.compare(p1, p2); } + override bool equals(const scope void* p1, const scope void* p2) const { return base.equals(p1, p2); } + override int compare(const scope void* p1, const scope void* p2) const { return base.compare(p1, p2); } override @property size_t tsize() nothrow pure const { return base.tsize; } override void swap(void* p1, void* p2) const { return base.swap(p1, p2); } @@ -1101,12 +1101,12 @@ class TypeInfo_Pointer : TypeInfo return addr ^ (addr >> 4); } - override bool equals(in void* p1, in void* p2) const + override bool equals(const scope void* p1, const scope void* p2) const { return *cast(void**)p1 == *cast(void**)p2; } - override int compare(in void* p1, in void* p2) const + override int compare(const scope void* p1, const scope void* p2) const { if (*cast(void**)p1 < *cast(void**)p2) return -1; @@ -1157,7 +1157,7 @@ class TypeInfo_Array : TypeInfo return getArrayHash(value, a.ptr, a.length); } - override bool equals(in void* p1, in void* p2) const + override bool equals(const scope void* p1, const scope void* p2) const { void[] a1 = *cast(void[]*)p1; void[] a2 = *cast(void[]*)p2; @@ -1172,7 +1172,7 @@ class TypeInfo_Array : TypeInfo return true; } - override int compare(in void* p1, in void* p2) const + override int compare(const scope void* p1, const scope void* p2) const { void[] a1 = *cast(void[]*)p1; void[] a2 = *cast(void[]*)p2; @@ -1255,7 +1255,7 @@ class TypeInfo_StaticArray : TypeInfo return getArrayHash(value, p, len); } - override bool equals(in void* p1, in void* p2) const + override bool equals(const scope void* p1, const scope void* p2) const { size_t sz = value.tsize; @@ -1267,7 +1267,7 @@ class TypeInfo_StaticArray : TypeInfo return true; } - override int compare(in void* p1, in void* p2) const + override int compare(const scope void* p1, const scope void* p2) const { size_t sz = value.tsize; @@ -1374,7 +1374,7 @@ class TypeInfo_AssociativeArray : TypeInfo this.value == c.value; } - override bool equals(in void* p1, in void* p2) @trusted const + override bool equals(const scope void* p1, const scope void* p2) @trusted const { return !!_aaEqual(this, *cast(const AA*) p1, *cast(const AA*) p2); } @@ -1427,8 +1427,8 @@ class TypeInfo_Vector : TypeInfo } override size_t getHash(scope const void* p) const { return base.getHash(p); } - override bool equals(in void* p1, in void* p2) const { return base.equals(p1, p2); } - override int compare(in void* p1, in void* p2) const { return base.compare(p1, p2); } + override bool equals(const scope void* p1, const scope void* p2) const { return base.equals(p1, p2); } + override int compare(const scope void* p1, const scope void* p2) const { return base.compare(p1, p2); } override @property size_t tsize() nothrow pure const { return base.tsize; } override void swap(void* p1, void* p2) const { return base.swap(p1, p2); } @@ -1527,14 +1527,14 @@ class TypeInfo_Delegate : TypeInfo return hashOf(*cast(void delegate()*)p); } - override bool equals(in void* p1, in void* p2) const + override bool equals(const scope void* p1, const scope void* p2) const { auto dg1 = *cast(void delegate()*)p1; auto dg2 = *cast(void delegate()*)p2; return dg1 == dg2; } - override int compare(in void* p1, in void* p2) const + override int compare(const scope void* p1, const scope void* p2) const { auto dg1 = *cast(void delegate()*)p1; auto dg2 = *cast(void delegate()*)p2; @@ -1602,7 +1602,7 @@ class TypeInfo_Class : TypeInfo return o ? o.toHash() : 0; } - override bool equals(in void* p1, in void* p2) const + override bool equals(const scope void* p1, const scope void* p2) const { Object o1 = *cast(Object*)p1; Object o2 = *cast(Object*)p2; @@ -1610,7 +1610,7 @@ class TypeInfo_Class : TypeInfo return (o1 is o2) || (o1 && o1.opEquals(o2)); } - override int compare(in void* p1, in void* p2) const + override int compare(const scope void* p1, const scope void* p2) const { Object o1 = *cast(Object*)p1; Object o2 = *cast(Object*)p2; @@ -1763,7 +1763,7 @@ class TypeInfo_Interface : TypeInfo return o.toHash(); } - override bool equals(in void* p1, in void* p2) const + override bool equals(const scope void* p1, const scope void* p2) const { Interface* pi = **cast(Interface ***)*cast(void**)p1; Object o1 = cast(Object)(*cast(void**)p1 - pi.offset); @@ -1773,7 +1773,7 @@ class TypeInfo_Interface : TypeInfo return o1 == o2 || (o1 && o1.opCmp(o2) == 0); } - override int compare(in void* p1, in void* p2) const + override int compare(const scope void* p1, const scope void* p2) const { Interface* pi = **cast(Interface ***)*cast(void**)p1; Object o1 = cast(Object)(*cast(void**)p1 - pi.offset); @@ -1838,7 +1838,7 @@ class TypeInfo_Struct : TypeInfo } } - override bool equals(in void* p1, in void* p2) @trusted pure nothrow const + override bool equals(const scope void* p1, const scope void* p2) @trusted pure nothrow const { import core.stdc.string : memcmp; @@ -1853,7 +1853,7 @@ class TypeInfo_Struct : TypeInfo return memcmp(p1, p2, initializer().length) == 0; } - override int compare(in void* p1, in void* p2) @trusted pure nothrow const + override int compare(const scope void* p1, const scope void* p2) @trusted pure nothrow const { import core.stdc.string : memcmp; @@ -1912,10 +1912,10 @@ class TypeInfo_Struct : TypeInfo @safe pure nothrow { - size_t function(in void*) xtoHash; - bool function(in void*, in void*) xopEquals; - int function(in void*, in void*) xopCmp; - string function(in void*) xtoString; + size_t function(const scope void*) xtoHash; + bool function(const scope void*, const scope void*) xopEquals; + int function(const scope void*, const scope void*) xopCmp; + string function(const scope void*) xtoString; enum StructFlags : uint { @@ -2002,12 +2002,12 @@ class TypeInfo_Tuple : TypeInfo assert(0); } - override bool equals(in void* p1, in void* p2) const + override bool equals(const scope void* p1, const scope void* p2) const { assert(0); } - override int compare(in void* p1, in void* p2) const + override int compare(const scope void* p1, const scope void* p2) const { assert(0); } @@ -2069,8 +2069,8 @@ class TypeInfo_Const : TypeInfo } override size_t getHash(scope const void *p) const { return base.getHash(p); } - override bool equals(in void *p1, in void *p2) const { return base.equals(p1, p2); } - override int compare(in void *p1, in void *p2) const { return base.compare(p1, p2); } + override bool equals(const scope void *p1, const scope void *p2) const { return base.equals(p1, p2); } + override int compare(const scope void *p1, const scope void *p2) const { return base.compare(p1, p2); } override @property size_t tsize() nothrow pure const { return base.tsize; } override void swap(void *p1, void *p2) const { return base.swap(p1, p2); } @@ -2526,7 +2526,7 @@ class Throwable : Object * performed in certain error situations. Override this $(D * toString) method to customize the error message. */ - void toString(scope void delegate(in char[]) sink) const + void toString(scope void delegate(const scope char[]) sink) const { import core.internal.string : unsignedToTempString; @@ -2764,8 +2764,8 @@ extern (C) void* _aaRangeFrontValue(AARange r) pure nothrow @nogc @safe; void _aaRangePopFront(ref AARange r) pure nothrow @nogc @safe; - int _aaEqual(in TypeInfo tiRaw, in AA aa1, in AA aa2); - hash_t _aaGetHash(in AA* aa, in TypeInfo tiRaw) nothrow; + int _aaEqual(const scope TypeInfo tiRaw, const scope AA aa1, const scope AA aa2); + hash_t _aaGetHash(const scope AA* aa, const scope TypeInfo tiRaw) nothrow; /* _d_assocarrayliteralTX marked as pure, because aaLiteral can be called from pure code. @@ -3662,7 +3662,7 @@ version (none) return value; } - private void _bailOut(string file, int line, in char[] msg) + private void _bailOut(string file, int line, const scope char[] msg) { char[21] buf = void; throw new Exception(cast(string)(file ~ "(" ~ ulongToString(buf[], line) ~ "): " ~ (msg ? msg : "Enforcement failed"))); @@ -3732,12 +3732,12 @@ else } } -bool _xopEquals(in void*, in void*) +bool _xopEquals(const scope void*, const scope void*) { throw new Error("TypeInfo.equals is not implemented"); } -bool _xopCmp(in void*, in void*) +bool _xopCmp(const scope void*, const scope void*) { throw new Error("TypeInfo.compare is not implemented"); } diff --git a/src/rt/aApply.d b/src/rt/aApply.d index bea441f550..210d07f535 100644 --- a/src/rt/aApply.d +++ b/src/rt/aApply.d @@ -18,7 +18,7 @@ import core.internal.utf : decode, toUTF8; // dg is D, but _aApplycd() is C extern (D) alias int delegate(void *) dg_t; -extern (C) int _aApplycd1(in char[] aa, dg_t dg) +extern (C) int _aApplycd1(const scope char[] aa, dg_t dg) { int result; size_t len = aa.length; @@ -80,7 +80,7 @@ unittest /*****************************/ -extern (C) int _aApplywd1(in wchar[] aa, dg_t dg) +extern (C) int _aApplywd1(const scope wchar[] aa, dg_t dg) { int result; size_t len = aa.length; @@ -142,7 +142,7 @@ unittest /*****************************/ -extern (C) int _aApplycw1(in char[] aa, dg_t dg) +extern (C) int _aApplycw1(const scope char[] aa, dg_t dg) { int result; size_t len = aa.length; @@ -217,7 +217,7 @@ unittest /*****************************/ -extern (C) int _aApplywc1(in wchar[] aa, dg_t dg) +extern (C) int _aApplywc1(const scope wchar[] aa, dg_t dg) { int result; size_t len = aa.length; @@ -298,7 +298,7 @@ unittest /*****************************/ -extern (C) int _aApplydc1(in dchar[] aa, dg_t dg) +extern (C) int _aApplydc1(const scope dchar[] aa, dg_t dg) { int result; @@ -375,7 +375,7 @@ unittest /*****************************/ -extern (C) int _aApplydw1(in dchar[] aa, dg_t dg) +extern (C) int _aApplydw1(const scope dchar[] aa, dg_t dg) { int result; @@ -449,7 +449,7 @@ unittest // dg is D, but _aApplycd2() is C extern (D) alias int delegate(void *, void *) dg2_t; -extern (C) int _aApplycd2(in char[] aa, dg2_t dg) +extern (C) int _aApplycd2(const scope char[] aa, dg2_t dg) { int result; size_t len = aa.length; @@ -518,7 +518,7 @@ unittest /*****************************/ -extern (C) int _aApplywd2(in wchar[] aa, dg2_t dg) +extern (C) int _aApplywd2(const scope wchar[] aa, dg2_t dg) { int result; size_t len = aa.length; @@ -587,7 +587,7 @@ unittest /*****************************/ -extern (C) int _aApplycw2(in char[] aa, dg2_t dg) +extern (C) int _aApplycw2(const scope char[] aa, dg2_t dg) { int result; size_t len = aa.length; @@ -667,7 +667,7 @@ unittest /*****************************/ -extern (C) int _aApplywc2(in wchar[] aa, dg2_t dg) +extern (C) int _aApplywc2(const scope wchar[] aa, dg2_t dg) { int result; size_t len = aa.length; @@ -753,7 +753,7 @@ unittest /*****************************/ -extern (C) int _aApplydc2(in dchar[] aa, dg2_t dg) +extern (C) int _aApplydc2(const scope dchar[] aa, dg2_t dg) { int result; size_t len = aa.length; @@ -834,7 +834,7 @@ unittest /*****************************/ -extern (C) int _aApplydw2(in dchar[] aa, dg2_t dg) +extern (C) int _aApplydw2(const scope dchar[] aa, dg2_t dg) { int result; debug(apply) printf("_aApplydw2(), len = %d\n", aa.length); diff --git a/src/rt/aApplyR.d b/src/rt/aApplyR.d index c54f174d4e..fc90b84e94 100644 --- a/src/rt/aApplyR.d +++ b/src/rt/aApplyR.d @@ -28,7 +28,7 @@ import core.internal.utf; // dg is D, but _aApplyRcd() is C extern (D) alias int delegate(void *) dg_t; -extern (C) int _aApplyRcd1(in char[] aa, dg_t dg) +extern (C) int _aApplyRcd1(const scope char[] aa, dg_t dg) { int result; debug(apply) printf("_aApplyRcd1(), len = %d\n", aa.length); @@ -102,7 +102,7 @@ unittest /*****************************/ -extern (C) int _aApplyRwd1(in wchar[] aa, dg_t dg) +extern (C) int _aApplyRwd1(const scope wchar[] aa, dg_t dg) { int result; debug(apply) printf("_aApplyRwd1(), len = %d\n", aa.length); @@ -166,7 +166,7 @@ unittest /*****************************/ -extern (C) int _aApplyRcw1(in char[] aa, dg_t dg) +extern (C) int _aApplyRcw1(const scope char[] aa, dg_t dg) { int result; debug(apply) printf("_aApplyRcw1(), len = %d\n", aa.length); @@ -253,7 +253,7 @@ unittest /*****************************/ -extern (C) int _aApplyRwc1(in wchar[] aa, dg_t dg) +extern (C) int _aApplyRwc1(const scope wchar[] aa, dg_t dg) { int result; debug(apply) printf("_aApplyRwc1(), len = %d\n", aa.length); @@ -338,7 +338,7 @@ unittest /*****************************/ -extern (C) int _aApplyRdc1(in dchar[] aa, dg_t dg) +extern (C) int _aApplyRdc1(const scope dchar[] aa, dg_t dg) { int result; debug(apply) printf("_aApplyRdc1(), len = %d\n", aa.length); @@ -417,7 +417,7 @@ unittest /*****************************/ -extern (C) int _aApplyRdw1(in dchar[] aa, dg_t dg) +extern (C) int _aApplyRdw1(const scope dchar[] aa, dg_t dg) { int result; debug(apply) printf("_aApplyRdw1(), len = %d\n", aa.length); @@ -490,7 +490,7 @@ unittest // dg is D, but _aApplyRcd2() is C extern (D) alias int delegate(void *, void *) dg2_t; -extern (C) int _aApplyRcd2(in char[] aa, dg2_t dg) +extern (C) int _aApplyRcd2(const scope char[] aa, dg2_t dg) { int result; size_t i; size_t len = aa.length; @@ -567,7 +567,7 @@ unittest /*****************************/ -extern (C) int _aApplyRwd2(in wchar[] aa, dg2_t dg) +extern (C) int _aApplyRwd2(const scope wchar[] aa, dg2_t dg) { int result; debug(apply) printf("_aApplyRwd2(), len = %d\n", aa.length); @@ -633,7 +633,7 @@ unittest /*****************************/ -extern (C) int _aApplyRcw2(in char[] aa, dg2_t dg) +extern (C) int _aApplyRcw2(const scope char[] aa, dg2_t dg) { int result; debug(apply) printf("_aApplyRcw2(), len = %d\n", aa.length); @@ -722,7 +722,7 @@ unittest /*****************************/ -extern (C) int _aApplyRwc2(in wchar[] aa, dg2_t dg) +extern (C) int _aApplyRwc2(const scope wchar[] aa, dg2_t dg) { int result; debug(apply) printf("_aApplyRwc2(), len = %d\n", aa.length); @@ -809,7 +809,7 @@ unittest /*****************************/ -extern (C) int _aApplyRdc2(in dchar[] aa, dg2_t dg) +extern (C) int _aApplyRdc2(const scope dchar[] aa, dg2_t dg) { int result; debug(apply) printf("_aApplyRdc2(), len = %d\n", aa.length); @@ -889,7 +889,7 @@ unittest /*****************************/ -extern (C) int _aApplyRdw2(in dchar[] aa, dg2_t dg) +extern (C) int _aApplyRdw2(const scope dchar[] aa, dg2_t dg) { int result; debug(apply) printf("_aApplyRdw2(), len = %d\n", aa.length); diff --git a/src/rt/aaA.d b/src/rt/aaA.d index c74d96315a..925a852d1f 100644 --- a/src/rt/aaA.d +++ b/src/rt/aaA.d @@ -48,7 +48,7 @@ struct AA private struct Impl { private: - this(in TypeInfo_AssociativeArray ti, size_t sz = INIT_NUM_BUCKETS) + this(const scope TypeInfo_AssociativeArray ti, size_t sz = INIT_NUM_BUCKETS) { keysz = cast(uint) ti.key.tsize; valsz = cast(uint) ti.value.tsize; @@ -111,7 +111,7 @@ private: } // lookup a key - inout(Bucket)* findSlotLookup(size_t hash, in void* pkey, in TypeInfo keyti) inout + inout(Bucket)* findSlotLookup(size_t hash, const scope void* pkey, const scope TypeInfo keyti) inout { for (size_t i = hash & mask, j = 1;; ++j) { @@ -123,7 +123,7 @@ private: } } - void grow(in TypeInfo keyti) + void grow(const scope TypeInfo keyti) { // If there are so many deleted entries, that growing would push us // below the shrink threshold, we just purge deleted entries instead. @@ -133,7 +133,7 @@ private: resize(GROW_FAC * dim); } - void shrink(in TypeInfo keyti) + void shrink(const scope TypeInfo keyti) { if (dim > INIT_NUM_BUCKETS) resize(dim / GROW_FAC); @@ -201,7 +201,7 @@ Bucket[] allocBuckets(size_t dim) @trusted pure nothrow // Entry //------------------------------------------------------------------------------ -private void* allocEntry(in Impl* aa, in void* pkey) +private void* allocEntry(const scope Impl* aa, const scope void* pkey) { import rt.lifetime : _d_newitemU; import core.stdc.string : memcpy, memset; @@ -454,14 +454,14 @@ private size_t mix(size_t h) @safe pure nothrow @nogc return h; } -private size_t calcHash(in void* pkey, in TypeInfo keyti) +private size_t calcHash(const scope void* pkey, const scope TypeInfo keyti) { immutable hash = keyti.getHash(pkey); // highest bit is set to distinguish empty/deleted from filled buckets return mix(hash) | HASH_FILLED_MARK; } -private size_t nextpow2(in size_t n) pure nothrow @nogc +private size_t nextpow2(const scope size_t n) pure nothrow @nogc { import core.bitop : bsr; @@ -494,7 +494,7 @@ private T max(T)(T a, T b) pure nothrow @nogc //------------------------------------------------------------------------------ /// Determine number of entries in associative array. -extern (C) size_t _aaLen(in AA aa) pure nothrow @nogc +extern (C) size_t _aaLen(const scope AA aa) pure nothrow @nogc { return aa ? aa.length : 0; } @@ -513,7 +513,7 @@ extern (C) size_t _aaLen(in AA aa) pure nothrow @nogc * is set to all zeros */ extern (C) void* _aaGetY(AA* aa, const TypeInfo_AssociativeArray ti, - in size_t valsz, in void* pkey) + const scope size_t valsz, const scope void* pkey) { bool found; return _aaGetX(aa, ti, valsz, pkey, found); @@ -534,7 +534,7 @@ extern (C) void* _aaGetY(AA* aa, const TypeInfo_AssociativeArray ti, * is set to all zeros */ extern (C) void* _aaGetX(AA* aa, const TypeInfo_AssociativeArray ti, - in size_t valsz, in void* pkey, out bool found) + const scope size_t valsz, const scope void* pkey, out bool found) { // lazily alloc implementation if (aa.impl is null) @@ -587,8 +587,8 @@ extern (C) void* _aaGetX(AA* aa, const TypeInfo_AssociativeArray ti, * Returns: * pointer to value if present, null otherwise */ -extern (C) inout(void)* _aaGetRvalueX(inout AA aa, in TypeInfo keyti, in size_t valsz, - in void* pkey) +extern (C) inout(void)* _aaGetRvalueX(inout AA aa, const scope TypeInfo keyti, const scope size_t valsz, + const scope void* pkey) { return _aaInX(aa, keyti, pkey); } @@ -603,7 +603,7 @@ extern (C) inout(void)* _aaGetRvalueX(inout AA aa, in TypeInfo keyti, in size_t * Returns: * pointer to value if present, null otherwise */ -extern (C) inout(void)* _aaInX(inout AA aa, in TypeInfo keyti, in void* pkey) +extern (C) inout(void)* _aaInX(inout AA aa, const scope TypeInfo keyti, const scope void* pkey) { if (aa.empty) return null; @@ -614,8 +614,8 @@ extern (C) inout(void)* _aaInX(inout AA aa, in TypeInfo keyti, in void* pkey) return null; } -/// Delete entry in AA, return true if it was present -extern (C) bool _aaDelX(AA aa, in TypeInfo keyti, in void* pkey) +/// Delete entry const scope AA, return true if it was present +extern (C) bool _aaDelX(AA aa, const scope TypeInfo keyti, const scope void* pkey) { if (aa.empty) return false; @@ -646,7 +646,7 @@ extern (C) void _aaClear(AA aa) pure nothrow } /// Rehash AA -extern (C) void* _aaRehash(AA* paa, in TypeInfo keyti) pure nothrow +extern (C) void* _aaRehash(AA* paa, const scope TypeInfo keyti) pure nothrow { if (!paa.empty) paa.resize(nextpow2(INIT_DEN * paa.length / INIT_NUM)); @@ -654,7 +654,7 @@ extern (C) void* _aaRehash(AA* paa, in TypeInfo keyti) pure nothrow } /// Return a GC allocated array of all values -extern (C) inout(void[]) _aaValues(inout AA aa, in size_t keysz, in size_t valsz, +extern (C) inout(void[]) _aaValues(inout AA aa, const scope size_t keysz, const scope size_t valsz, const TypeInfo tiValueArray) pure nothrow { if (aa.empty) @@ -678,7 +678,7 @@ extern (C) inout(void[]) _aaValues(inout AA aa, in size_t keysz, in size_t valsz } /// Return a GC allocated array of all keys -extern (C) inout(void[]) _aaKeys(inout AA aa, in size_t keysz, const TypeInfo tiKeyArray) pure nothrow +extern (C) inout(void[]) _aaKeys(inout AA aa, const scope size_t keysz, const TypeInfo tiKeyArray) pure nothrow { if (aa.empty) return null; @@ -704,7 +704,7 @@ extern (D) alias dg_t = int delegate(void*); extern (D) alias dg2_t = int delegate(void*, void*); /// foreach opApply over all values -extern (C) int _aaApply(AA aa, in size_t keysz, dg_t dg) +extern (C) int _aaApply(AA aa, const scope size_t keysz, dg_t dg) { if (aa.empty) return 0; @@ -721,7 +721,7 @@ extern (C) int _aaApply(AA aa, in size_t keysz, dg_t dg) } /// foreach opApply over all key/value pairs -extern (C) int _aaApply2(AA aa, in size_t keysz, dg2_t dg) +extern (C) int _aaApply2(AA aa, const scope size_t keysz, dg2_t dg) { if (aa.empty) return 0; @@ -786,7 +786,7 @@ extern (C) Impl* _d_assocarrayliteralTX(const TypeInfo_AssociativeArray ti, void } /// compares 2 AAs for equality -extern (C) int _aaEqual(in TypeInfo tiRaw, in AA aa1, in AA aa2) +extern (C) int _aaEqual(const scope TypeInfo tiRaw, const scope AA aa1, const scope AA aa2) { if (aa1.impl is aa2.impl) return true; @@ -816,7 +816,7 @@ extern (C) int _aaEqual(in TypeInfo tiRaw, in AA aa1, in AA aa2) } /// compute a hash -extern (C) hash_t _aaGetHash(in AA* aa, in TypeInfo tiRaw) nothrow +extern (C) hash_t _aaGetHash(const scope AA* aa, const scope TypeInfo tiRaw) nothrow { if (aa.empty) return 0; diff --git a/src/rt/backtrace/macho.d b/src/rt/backtrace/macho.d index 3d4573b1cc..dbcd3ab04d 100644 --- a/src/rt/backtrace/macho.d +++ b/src/rt/backtrace/macho.d @@ -40,9 +40,9 @@ private extern (C) MachHeader* _NSGetMachExecuteHeader(); ubyte* getsectiondata( - in MachHeader* mhp, - in char* segname, - in char* sectname, + const scope MachHeader* mhp, + const scope char* segname, + const scope char* sectname, c_ulong* size ); } diff --git a/src/rt/cover.d b/src/rt/cover.d index 143b34610f..42dc1df9a4 100644 --- a/src/rt/cover.d +++ b/src/rt/cover.d @@ -471,7 +471,7 @@ bool readFile(FILE* file, ref char[] buf) return true; } -version (Windows) extern (C) nothrow @nogc FILE* _wfopen(in wchar* filename, in wchar* mode); +version (Windows) extern (C) nothrow @nogc FILE* _wfopen(const scope wchar* filename, const scope wchar* mode); version (Windows) extern (C) int chsize(int fd, c_long size); diff --git a/src/rt/lifetime.d b/src/rt/lifetime.d index 5182b6a20b..41b5235154 100644 --- a/src/rt/lifetime.d +++ b/src/rt/lifetime.d @@ -693,7 +693,7 @@ extern(C) void _d_arrayshrinkfit(const TypeInfo ti, void[] arr) /+nothrow+/ } } -package bool hasPostblit(in TypeInfo ti) +package bool hasPostblit(const scope TypeInfo ti) { return (&ti.postblit).funcptr !is &TypeInfo.postblit; } @@ -1091,7 +1091,7 @@ extern (C) void[] _d_newarraymiTX(const TypeInfo ti, size_t[] dims) * Allocate an uninitialized non-array item. * This is an optimization to avoid things needed for arrays like the __arrayPad(size). */ -extern (C) void* _d_newitemU(in TypeInfo _ti) +extern (C) void* _d_newitemU(const scope TypeInfo _ti) { auto ti = unqualify(_ti); auto flags = !(ti.flags & 1) ? BlkAttr.NO_SCAN : 0; @@ -1110,7 +1110,7 @@ extern (C) void* _d_newitemU(in TypeInfo _ti) } /// Same as above, zero initializes the item. -extern (C) void* _d_newitemT(in TypeInfo _ti) +extern (C) void* _d_newitemT(const scope TypeInfo _ti) { import core.stdc.string; auto p = _d_newitemU(_ti); @@ -1119,7 +1119,7 @@ extern (C) void* _d_newitemT(in TypeInfo _ti) } /// Same as above, for item with non-zero initializer. -extern (C) void* _d_newitemiT(in TypeInfo _ti) +extern (C) void* _d_newitemiT(const scope TypeInfo _ti) { import core.stdc.string; auto p = _d_newitemU(_ti); @@ -1263,7 +1263,7 @@ extern (C) CollectHandler rt_getCollectHandler() /** * */ -extern (C) int rt_hasFinalizerInSegment(void* p, size_t size, uint attr, in void[] segment) nothrow +extern (C) int rt_hasFinalizerInSegment(void* p, size_t size, uint attr, const scope void[] segment) nothrow { if (attr & BlkAttr.STRUCTFINAL) { @@ -1288,7 +1288,7 @@ extern (C) int rt_hasFinalizerInSegment(void* p, size_t size, uint attr, in void return false; } -int hasStructFinalizerInSegment(void* p, size_t size, in void[] segment) nothrow +int hasStructFinalizerInSegment(void* p, size_t size, const scope void[] segment) nothrow { if (!p) return false; @@ -1297,7 +1297,7 @@ int hasStructFinalizerInSegment(void* p, size_t size, in void[] segment) nothrow return cast(size_t)(cast(void*)ti.xdtor - segment.ptr) < segment.length; } -int hasArrayFinalizerInSegment(void* p, size_t size, in void[] segment) nothrow +int hasArrayFinalizerInSegment(void* p, size_t size, const scope void[] segment) nothrow { if (!p) return false; diff --git a/src/rt/sections_elf_shared.d b/src/rt/sections_elf_shared.d index e84753a246..2e70dce96e 100644 --- a/src/rt/sections_elf_shared.d +++ b/src/rt/sections_elf_shared.d @@ -801,7 +801,7 @@ void scanSegments(const scope ref dl_phdr_info info, DSO* pdso) nothrow @nogc * References: * http://linux.die.net/man/3/dl_iterate_phdr */ -bool findDSOInfoForAddr(in void* addr, dl_phdr_info* result=null) nothrow @nogc +bool findDSOInfoForAddr(const scope void* addr, dl_phdr_info* result=null) nothrow @nogc { version (linux) enum IterateManually = true; else version (NetBSD) enum IterateManually = true; diff --git a/src/rt/sections_osx_x86.d b/src/rt/sections_osx_x86.d index 4d9b896907..1d2d79dfa7 100644 --- a/src/rt/sections_osx_x86.d +++ b/src/rt/sections_osx_x86.d @@ -258,8 +258,8 @@ static immutable SegRef[] dataSegs = [{SEG_DATA, SECT_DATA}, {SEG_DATA, SECT_COMMON}]; -ubyte[] getSection(in mach_header* header, intptr_t slide, - in char* segmentName, in char* sectionName) +ubyte[] getSection(const scope mach_header* header, intptr_t slide, + const scope char* segmentName, const scope char* sectionName) { assert(header.magic == MH_MAGIC); auto sect = getsectbynamefromheader(header, segmentName, sectionName); diff --git a/src/rt/sections_osx_x86_64.d b/src/rt/sections_osx_x86_64.d index e4b9f7af0f..e323de3a82 100644 --- a/src/rt/sections_osx_x86_64.d +++ b/src/rt/sections_osx_x86_64.d @@ -171,8 +171,8 @@ static immutable SegRef[] dataSegs = [{SEG_DATA, SECT_DATA}, {SEG_DATA, SECT_BSS}, {SEG_DATA, SECT_COMMON}]; -ubyte[] getSection(in mach_header* header, intptr_t slide, - in char* segmentName, in char* sectionName) +ubyte[] getSection(const scope mach_header* header, intptr_t slide, + const scope char* segmentName, const scope char* sectionName) { assert(header.magic == MH_MAGIC_64); auto sect = getsectbynamefromheader_64(cast(mach_header_64*)header, diff --git a/src/rt/tracegc.d b/src/rt/tracegc.d index 8e8e553d0e..b776f98cc6 100644 --- a/src/rt/tracegc.d +++ b/src/rt/tracegc.d @@ -22,8 +22,8 @@ extern (C) void[] _d_newarrayT(const TypeInfo ti, size_t length); extern (C) void[] _d_newarrayiT(const TypeInfo ti, size_t length); extern (C) void[] _d_newarraymTX(const TypeInfo ti, size_t[] dims); extern (C) void[] _d_newarraymiTX(const TypeInfo ti, size_t[] dims); -extern (C) void* _d_newitemT(in TypeInfo ti); -extern (C) void* _d_newitemiT(in TypeInfo ti); +extern (C) void* _d_newitemT(const scope TypeInfo ti); +extern (C) void* _d_newitemiT(const scope TypeInfo ti); extern (C) void _d_callfinalizer(void* p); extern (C) void _d_callinterfacefinalizer(void *p); extern (C) void _d_delclass(Object* p); diff --git a/src/rt/typeinfo/ti_Acdouble.d b/src/rt/typeinfo/ti_Acdouble.d index 50debaca25..bb0a284b76 100644 --- a/src/rt/typeinfo/ti_Acdouble.d +++ b/src/rt/typeinfo/ti_Acdouble.d @@ -30,12 +30,12 @@ class TypeInfo_Ar : TypeInfo_Array return Array!F.hashOf(*cast(F[]*)p); } - override bool equals(in void* p1, in void* p2) const + override bool equals(const scope void* p1, const scope void* p2) const { return Array!F.equals(*cast(F[]*)p1, *cast(F[]*)p2); } - override int compare(in void* p1, in void* p2) const + override int compare(const scope void* p1, const scope void* p2) const { return Array!F.compare(*cast(F[]*)p1, *cast(F[]*)p2); } diff --git a/src/rt/typeinfo/ti_Acfloat.d b/src/rt/typeinfo/ti_Acfloat.d index dadec10df7..88ac22f698 100644 --- a/src/rt/typeinfo/ti_Acfloat.d +++ b/src/rt/typeinfo/ti_Acfloat.d @@ -30,12 +30,12 @@ class TypeInfo_Aq : TypeInfo_Array return Array!F.hashOf(*cast(F[]*)p); } - override bool equals(in void* p1, in void* p2) const + override bool equals(const scope void* p1, const scope void* p2) const { return Array!F.equals(*cast(F[]*)p1, *cast(F[]*)p2); } - override int compare(in void* p1, in void* p2) const + override int compare(const scope void* p1, const scope void* p2) const { return Array!F.compare(*cast(F[]*)p1, *cast(F[]*)p2); } diff --git a/src/rt/typeinfo/ti_Acreal.d b/src/rt/typeinfo/ti_Acreal.d index 650b89b4ed..5fa5341d91 100644 --- a/src/rt/typeinfo/ti_Acreal.d +++ b/src/rt/typeinfo/ti_Acreal.d @@ -30,12 +30,12 @@ class TypeInfo_Ac : TypeInfo_Array return Array!F.hashOf(*cast(F[]*)p); } - override bool equals(in void* p1, in void* p2) const + override bool equals(const scope void* p1, const scope void* p2) const { return Array!F.equals(*cast(F[]*)p1, *cast(F[]*)p2); } - override int compare(in void* p1, in void* p2) const + override int compare(const scope void* p1, const scope void* p2) const { return Array!F.compare(*cast(F[]*)p1, *cast(F[]*)p2); } diff --git a/src/rt/typeinfo/ti_Adouble.d b/src/rt/typeinfo/ti_Adouble.d index 9712f8a822..b36805a04d 100644 --- a/src/rt/typeinfo/ti_Adouble.d +++ b/src/rt/typeinfo/ti_Adouble.d @@ -30,12 +30,12 @@ class TypeInfo_Ad : TypeInfo_Array return Array!F.hashOf(*cast(F[]*)p); } - override bool equals(in void* p1, in void* p2) const + override bool equals(const scope void* p1, const scope void* p2) const { return Array!F.equals(*cast(F[]*)p1, *cast(F[]*)p2); } - override int compare(in void* p1, in void* p2) const + override int compare(const scope void* p1, const scope void* p2) const { return Array!F.compare(*cast(F[]*)p1, *cast(F[]*)p2); } diff --git a/src/rt/typeinfo/ti_Afloat.d b/src/rt/typeinfo/ti_Afloat.d index 9a95abd3b5..3b9e60f1fc 100644 --- a/src/rt/typeinfo/ti_Afloat.d +++ b/src/rt/typeinfo/ti_Afloat.d @@ -30,12 +30,12 @@ class TypeInfo_Af : TypeInfo_Array return Array!F.hashOf(*cast(F[]*)p); } - override bool equals(in void* p1, in void* p2) const + override bool equals(const scope void* p1, const scope void* p2) const { return Array!F.equals(*cast(F[]*)p1, *cast(F[]*)p2); } - override int compare(in void* p1, in void* p2) const + override int compare(const scope void* p1, const scope void* p2) const { return Array!F.compare(*cast(F[]*)p1, *cast(F[]*)p2); } diff --git a/src/rt/typeinfo/ti_Ag.d b/src/rt/typeinfo/ti_Ag.d index bdb0553698..fb3a86be48 100644 --- a/src/rt/typeinfo/ti_Ag.d +++ b/src/rt/typeinfo/ti_Ag.d @@ -30,7 +30,7 @@ class TypeInfo_Ag : TypeInfo_Array return hashOf(s); } - override bool equals(in void* p1, in void* p2) const + override bool equals(const scope void* p1, const scope void* p2) const { byte[] s1 = *cast(byte[]*)p1; byte[] s2 = *cast(byte[]*)p2; @@ -39,7 +39,7 @@ class TypeInfo_Ag : TypeInfo_Array memcmp(cast(byte *)s1, cast(byte *)s2, s1.length) == 0; } - override int compare(in void* p1, in void* p2) const + override int compare(const scope void* p1, const scope void* p2) const { byte[] s1 = *cast(byte[]*)p1; byte[] s2 = *cast(byte[]*)p2; @@ -73,7 +73,7 @@ class TypeInfo_Ah : TypeInfo_Ag { override string toString() const { return "ubyte[]"; } - override int compare(in void* p1, in void* p2) const + override int compare(const scope void* p1, const scope void* p2) const { char[] s1 = *cast(char[]*)p1; char[] s2 = *cast(char[]*)p2; diff --git a/src/rt/typeinfo/ti_Aint.d b/src/rt/typeinfo/ti_Aint.d index ebe8d80f93..8b0e8919db 100644 --- a/src/rt/typeinfo/ti_Aint.d +++ b/src/rt/typeinfo/ti_Aint.d @@ -32,7 +32,7 @@ class TypeInfo_Ai : TypeInfo_Array return hashOf(s); } - override bool equals(in void* p1, in void* p2) const + override bool equals(const scope void* p1, const scope void* p2) const { int[] s1 = *cast(int[]*)p1; int[] s2 = *cast(int[]*)p2; @@ -41,7 +41,7 @@ class TypeInfo_Ai : TypeInfo_Array memcmp(cast(void *)s1, cast(void *)s2, s1.length * int.sizeof) == 0; } - override int compare(in void* p1, in void* p2) const + override int compare(const scope void* p1, const scope void* p2) const { int[] s1 = *cast(int[]*)p1; int[] s2 = *cast(int[]*)p2; @@ -96,7 +96,7 @@ class TypeInfo_Ak : TypeInfo_Ai { override string toString() const { return "uint[]"; } - override int compare(in void* p1, in void* p2) const + override int compare(const scope void* p1, const scope void* p2) const { uint[] s1 = *cast(uint[]*)p1; uint[] s2 = *cast(uint[]*)p2; diff --git a/src/rt/typeinfo/ti_Along.d b/src/rt/typeinfo/ti_Along.d index b67bb995ba..a677331d5d 100644 --- a/src/rt/typeinfo/ti_Along.d +++ b/src/rt/typeinfo/ti_Along.d @@ -30,7 +30,7 @@ class TypeInfo_Al : TypeInfo_Array return hashOf(s); } - override bool equals(in void* p1, in void* p2) const + override bool equals(const scope void* p1, const scope void* p2) const { long[] s1 = *cast(long[]*)p1; long[] s2 = *cast(long[]*)p2; @@ -39,7 +39,7 @@ class TypeInfo_Al : TypeInfo_Array memcmp(cast(void *)s1, cast(void *)s2, s1.length * long.sizeof) == 0; } - override int compare(in void* p1, in void* p2) const + override int compare(const scope void* p1, const scope void* p2) const { long[] s1 = *cast(long[]*)p1; long[] s2 = *cast(long[]*)p2; @@ -74,7 +74,7 @@ class TypeInfo_Am : TypeInfo_Al { override string toString() const { return "ulong[]"; } - override int compare(in void* p1, in void* p2) const + override int compare(const scope void* p1, const scope void* p2) const { ulong[] s1 = *cast(ulong[]*)p1; ulong[] s2 = *cast(ulong[]*)p2; diff --git a/src/rt/typeinfo/ti_Areal.d b/src/rt/typeinfo/ti_Areal.d index 5280f81fe6..1ac8c6417d 100644 --- a/src/rt/typeinfo/ti_Areal.d +++ b/src/rt/typeinfo/ti_Areal.d @@ -30,12 +30,12 @@ class TypeInfo_Ae : TypeInfo_Array return Array!F.hashOf(*cast(F[]*)p); } - override bool equals(in void* p1, in void* p2) const + override bool equals(const scope void* p1, const scope void* p2) const { return Array!F.equals(*cast(F[]*)p1, *cast(F[]*)p2); } - override int compare(in void* p1, in void* p2) const + override int compare(const scope void* p1, const scope void* p2) const { return Array!F.compare(*cast(F[]*)p1, *cast(F[]*)p2); } diff --git a/src/rt/typeinfo/ti_Ashort.d b/src/rt/typeinfo/ti_Ashort.d index aea4be7704..78c32aef4d 100644 --- a/src/rt/typeinfo/ti_Ashort.d +++ b/src/rt/typeinfo/ti_Ashort.d @@ -30,7 +30,7 @@ class TypeInfo_As : TypeInfo_Array return hashOf(s); } - override bool equals(in void* p1, in void* p2) const + override bool equals(const scope void* p1, const scope void* p2) const { short[] s1 = *cast(short[]*)p1; short[] s2 = *cast(short[]*)p2; @@ -39,7 +39,7 @@ class TypeInfo_As : TypeInfo_Array memcmp(cast(void *)s1, cast(void *)s2, s1.length * short.sizeof) == 0; } - override int compare(in void* p1, in void* p2) const + override int compare(const scope void* p1, const scope void* p2) const { short[] s1 = *cast(short[]*)p1; short[] s2 = *cast(short[]*)p2; @@ -73,7 +73,7 @@ class TypeInfo_At : TypeInfo_As { override string toString() const { return "ushort[]"; } - override int compare(in void* p1, in void* p2) const + override int compare(const scope void* p1, const scope void* p2) const { ushort[] s1 = *cast(ushort[]*)p1; ushort[] s2 = *cast(ushort[]*)p2; diff --git a/src/rt/typeinfo/ti_C.d b/src/rt/typeinfo/ti_C.d index 912774cb99..0f924e3825 100644 --- a/src/rt/typeinfo/ti_C.d +++ b/src/rt/typeinfo/ti_C.d @@ -28,7 +28,7 @@ class TypeInfo_C : TypeInfo return o ? o.toHash() : 0; } - override bool equals(in void* p1, in void* p2) + override bool equals(const scope void* p1, const scope void* p2) { Object o1 = *cast(Object*)p1; Object o2 = *cast(Object*)p2; @@ -36,7 +36,7 @@ class TypeInfo_C : TypeInfo return o1 == o2; } - override int compare(in void* p1, in void* p2) + override int compare(const scope void* p1, const scope void* p2) { Object o1 = *cast(Object*)p1; Object o2 = *cast(Object*)p2; diff --git a/src/rt/typeinfo/ti_byte.d b/src/rt/typeinfo/ti_byte.d index 9793fef65e..dd6f0d5da0 100644 --- a/src/rt/typeinfo/ti_byte.d +++ b/src/rt/typeinfo/ti_byte.d @@ -29,12 +29,12 @@ class TypeInfo_g : TypeInfo return *cast(const byte *)p; } - override bool equals(in void* p1, in void* p2) + override bool equals(const scope void* p1, const scope void* p2) { return *cast(byte *)p1 == *cast(byte *)p2; } - override int compare(in void* p1, in void* p2) + override int compare(const scope void* p1, const scope void* p2) { return *cast(byte *)p1 - *cast(byte *)p2; } diff --git a/src/rt/typeinfo/ti_cdouble.d b/src/rt/typeinfo/ti_cdouble.d index ce5764acec..05288d23cd 100644 --- a/src/rt/typeinfo/ti_cdouble.d +++ b/src/rt/typeinfo/ti_cdouble.d @@ -32,12 +32,12 @@ class TypeInfo_r : TypeInfo return Floating!F.hashOf(*cast(F*)p); } - override bool equals(in void* p1, in void* p2) const @trusted + override bool equals(const scope void* p1, const scope void* p2) const @trusted { return Floating!F.equals(*cast(F*)p1, *cast(F*)p2); } - override int compare(in void* p1, in void* p2) const @trusted + override int compare(const scope void* p1, const scope void* p2) const @trusted { return Floating!F.compare(*cast(F*)p1, *cast(F*)p2); } diff --git a/src/rt/typeinfo/ti_cent.d b/src/rt/typeinfo/ti_cent.d index fb4766ef78..dc40095ab1 100644 --- a/src/rt/typeinfo/ti_cent.d +++ b/src/rt/typeinfo/ti_cent.d @@ -32,12 +32,12 @@ class TypeInfo_zi : TypeInfo return hashOf(*cast(const ucent*) p); } - override bool equals(in void* p1, in void* p2) + override bool equals(const scope void* p1, const scope void* p2) { return *cast(cent *)p1 == *cast(cent *)p2; } - override int compare(in void* p1, in void* p2) + override int compare(const scope void* p1, const scope void* p2) { if (*cast(cent *)p1 < *cast(cent *)p2) return -1; diff --git a/src/rt/typeinfo/ti_cfloat.d b/src/rt/typeinfo/ti_cfloat.d index 8c29453e30..82bde3914a 100644 --- a/src/rt/typeinfo/ti_cfloat.d +++ b/src/rt/typeinfo/ti_cfloat.d @@ -32,12 +32,12 @@ class TypeInfo_q : TypeInfo return Floating!F.hashOf(*cast(F*)p); } - override bool equals(in void* p1, in void* p2) const @trusted + override bool equals(const scope void* p1, const scope void* p2) const @trusted { return Floating!F.equals(*cast(F*)p1, *cast(F*)p2); } - override int compare(in void* p1, in void* p2) const @trusted + override int compare(const scope void* p1, const scope void* p2) const @trusted { return Floating!F.compare(*cast(F*)p1, *cast(F*)p2); } diff --git a/src/rt/typeinfo/ti_char.d b/src/rt/typeinfo/ti_char.d index 9633bb9eac..d2120ca898 100644 --- a/src/rt/typeinfo/ti_char.d +++ b/src/rt/typeinfo/ti_char.d @@ -29,12 +29,12 @@ class TypeInfo_a : TypeInfo return *cast(const char *)p; } - override bool equals(in void* p1, in void* p2) + override bool equals(const scope void* p1, const scope void* p2) { return *cast(char *)p1 == *cast(char *)p2; } - override int compare(in void* p1, in void* p2) + override int compare(const scope void* p1, const scope void* p2) { return *cast(char *)p1 - *cast(char *)p2; } diff --git a/src/rt/typeinfo/ti_creal.d b/src/rt/typeinfo/ti_creal.d index a236f86437..a3436924d0 100644 --- a/src/rt/typeinfo/ti_creal.d +++ b/src/rt/typeinfo/ti_creal.d @@ -32,12 +32,12 @@ class TypeInfo_c : TypeInfo return Floating!F.hashOf(*cast(F*)p); } - override bool equals(in void* p1, in void* p2) const @trusted + override bool equals(const scope void* p1, const scope void* p2) const @trusted { return Floating!F.equals(*cast(F*)p1, *cast(F*)p2); } - override int compare(in void* p1, in void* p2) const @trusted + override int compare(const scope void* p1, const scope void* p2) const @trusted { return Floating!F.compare(*cast(F*)p1, *cast(F*)p2); } diff --git a/src/rt/typeinfo/ti_dchar.d b/src/rt/typeinfo/ti_dchar.d index 7329946199..567d1bb596 100644 --- a/src/rt/typeinfo/ti_dchar.d +++ b/src/rt/typeinfo/ti_dchar.d @@ -29,12 +29,12 @@ class TypeInfo_w : TypeInfo return *cast(const dchar *)p; } - override bool equals(in void* p1, in void* p2) + override bool equals(const scope void* p1, const scope void* p2) { return *cast(dchar *)p1 == *cast(dchar *)p2; } - override int compare(in void* p1, in void* p2) + override int compare(const scope void* p1, const scope void* p2) { return *cast(dchar *)p1 - *cast(dchar *)p2; } diff --git a/src/rt/typeinfo/ti_delegate.d b/src/rt/typeinfo/ti_delegate.d index d712be08a9..a4208e2007 100644 --- a/src/rt/typeinfo/ti_delegate.d +++ b/src/rt/typeinfo/ti_delegate.d @@ -30,7 +30,7 @@ class TypeInfo_D : TypeInfo return hashOf(*cast(dg*)p); } - override bool equals(in void* p1, in void* p2) + override bool equals(const scope void* p1, const scope void* p2) { return *cast(dg *)p1 == *cast(dg *)p2; } diff --git a/src/rt/typeinfo/ti_double.d b/src/rt/typeinfo/ti_double.d index e371bc652f..f23f670d6d 100644 --- a/src/rt/typeinfo/ti_double.d +++ b/src/rt/typeinfo/ti_double.d @@ -32,12 +32,12 @@ class TypeInfo_d : TypeInfo return Floating!F.hashOf(*cast(F*)p); } - override bool equals(in void* p1, in void* p2) const @trusted + override bool equals(const scope void* p1, const scope void* p2) const @trusted { return Floating!F.equals(*cast(F*)p1, *cast(F*)p2); } - override int compare(in void* p1, in void* p2) const @trusted + override int compare(const scope void* p1, const scope void* p2) const @trusted { return Floating!F.compare(*cast(F*)p1, *cast(F*)p2); } diff --git a/src/rt/typeinfo/ti_float.d b/src/rt/typeinfo/ti_float.d index e161addae2..42ad498635 100644 --- a/src/rt/typeinfo/ti_float.d +++ b/src/rt/typeinfo/ti_float.d @@ -32,12 +32,12 @@ class TypeInfo_f : TypeInfo return Floating!F.hashOf(*cast(F*)p); } - override bool equals(in void* p1, in void* p2) const @trusted + override bool equals(const scope void* p1, const scope void* p2) const @trusted { return Floating!F.equals(*cast(F*)p1, *cast(F*)p2); } - override int compare(in void* p1, in void* p2) const @trusted + override int compare(const scope void* p1, const scope void* p2) const @trusted { return Floating!F.compare(*cast(F*)p1, *cast(F*)p2); } diff --git a/src/rt/typeinfo/ti_int.d b/src/rt/typeinfo/ti_int.d index da3b5cad6f..983ed8dc34 100644 --- a/src/rt/typeinfo/ti_int.d +++ b/src/rt/typeinfo/ti_int.d @@ -29,12 +29,12 @@ class TypeInfo_i : TypeInfo return *cast(const int *)p; } - override bool equals(in void* p1, in void* p2) + override bool equals(const scope void* p1, const scope void* p2) { return *cast(uint *)p1 == *cast(uint *)p2; } - override int compare(in void* p1, in void* p2) + override int compare(const scope void* p1, const scope void* p2) { if (*cast(int*) p1 < *cast(int*) p2) return -1; diff --git a/src/rt/typeinfo/ti_long.d b/src/rt/typeinfo/ti_long.d index 336b99433b..278709286d 100644 --- a/src/rt/typeinfo/ti_long.d +++ b/src/rt/typeinfo/ti_long.d @@ -33,12 +33,12 @@ class TypeInfo_l : TypeInfo return hashOf(*cast(const ulong*)p); } - override bool equals(in void* p1, in void* p2) + override bool equals(const scope void* p1, const scope void* p2) { return *cast(long *)p1 == *cast(long *)p2; } - override int compare(in void* p1, in void* p2) + override int compare(const scope void* p1, const scope void* p2) { if (*cast(long *)p1 < *cast(long *)p2) return -1; diff --git a/src/rt/typeinfo/ti_n.d b/src/rt/typeinfo/ti_n.d index 88b531b4d1..46486ef975 100644 --- a/src/rt/typeinfo/ti_n.d +++ b/src/rt/typeinfo/ti_n.d @@ -24,13 +24,13 @@ class TypeInfo_n : TypeInfo return 0; } - override bool equals(in void* p1, in void* p2) const @trusted + override bool equals(const scope void* p1, const scope void* p2) const @trusted { //return *cast(typeof(null)*)p1 is *cast(typeof(null)*)p2; return true; } - override int compare(in void* p1, in void* p2) const @trusted + override int compare(const scope void* p1, const scope void* p2) const @trusted { //if (*cast(int*) p1 < *cast(int*) p2) // return -1; diff --git a/src/rt/typeinfo/ti_ptr.d b/src/rt/typeinfo/ti_ptr.d index c27d907dc5..61af2aabb2 100644 --- a/src/rt/typeinfo/ti_ptr.d +++ b/src/rt/typeinfo/ti_ptr.d @@ -29,12 +29,12 @@ class TypeInfo_P : TypeInfo return addr ^ (addr >> 4); } - override bool equals(in void* p1, in void* p2) + override bool equals(const scope void* p1, const scope void* p2) { return *cast(void**)p1 == *cast(void**)p2; } - override int compare(in void* p1, in void* p2) + override int compare(const scope void* p1, const scope void* p2) { if (*cast(void**)p1 < *cast(void**)p2) return -1; diff --git a/src/rt/typeinfo/ti_real.d b/src/rt/typeinfo/ti_real.d index 19839adf7c..f0b224b7f8 100644 --- a/src/rt/typeinfo/ti_real.d +++ b/src/rt/typeinfo/ti_real.d @@ -32,12 +32,12 @@ class TypeInfo_e : TypeInfo return Floating!F.hashOf(*cast(F*)p); } - override bool equals(in void* p1, in void* p2) const @trusted + override bool equals(const scope void* p1, const scope void* p2) const @trusted { return Floating!F.equals(*cast(F*)p1, *cast(F*)p2); } - override int compare(in void* p1, in void* p2) const @trusted + override int compare(const scope void* p1, const scope void* p2) const @trusted { return Floating!F.compare(*cast(F*)p1, *cast(F*)p2); } diff --git a/src/rt/typeinfo/ti_short.d b/src/rt/typeinfo/ti_short.d index ebafe9a1df..e98384fe84 100644 --- a/src/rt/typeinfo/ti_short.d +++ b/src/rt/typeinfo/ti_short.d @@ -29,12 +29,12 @@ class TypeInfo_s : TypeInfo return *cast(const short *)p; } - override bool equals(in void* p1, in void* p2) + override bool equals(const scope void* p1, const scope void* p2) { return *cast(short *)p1 == *cast(short *)p2; } - override int compare(in void* p1, in void* p2) + override int compare(const scope void* p1, const scope void* p2) { return *cast(short *)p1 - *cast(short *)p2; } diff --git a/src/rt/typeinfo/ti_ubyte.d b/src/rt/typeinfo/ti_ubyte.d index 860592fdf8..dbda18f2e7 100644 --- a/src/rt/typeinfo/ti_ubyte.d +++ b/src/rt/typeinfo/ti_ubyte.d @@ -29,12 +29,12 @@ class TypeInfo_h : TypeInfo return *cast(const ubyte *)p; } - override bool equals(in void* p1, in void* p2) + override bool equals(const scope void* p1, const scope void* p2) { return *cast(ubyte *)p1 == *cast(ubyte *)p2; } - override int compare(in void* p1, in void* p2) + override int compare(const scope void* p1, const scope void* p2) { return *cast(ubyte *)p1 - *cast(ubyte *)p2; } diff --git a/src/rt/typeinfo/ti_ucent.d b/src/rt/typeinfo/ti_ucent.d index 52fa8280b3..f7553589ab 100644 --- a/src/rt/typeinfo/ti_ucent.d +++ b/src/rt/typeinfo/ti_ucent.d @@ -31,12 +31,12 @@ class TypeInfo_zk : TypeInfo return hashOf(*cast(const ucent*) p); } - override bool equals(in void* p1, in void* p2) + override bool equals(const scope void* p1, const scope void* p2) { return *cast(ucent *)p1 == *cast(ucent *)p2; } - override int compare(in void* p1, in void* p2) + override int compare(const scope void* p1, const scope void* p2) { if (*cast(ucent *)p1 < *cast(ucent *)p2) return -1; diff --git a/src/rt/typeinfo/ti_uint.d b/src/rt/typeinfo/ti_uint.d index 3ae043277d..ec513f510c 100644 --- a/src/rt/typeinfo/ti_uint.d +++ b/src/rt/typeinfo/ti_uint.d @@ -29,12 +29,12 @@ class TypeInfo_k : TypeInfo return *cast(const uint *)p; } - override bool equals(in void* p1, in void* p2) + override bool equals(const scope void* p1, const scope void* p2) { return *cast(uint *)p1 == *cast(uint *)p2; } - override int compare(in void* p1, in void* p2) + override int compare(const scope void* p1, const scope void* p2) { if (*cast(uint*) p1 < *cast(uint*) p2) return -1; diff --git a/src/rt/typeinfo/ti_ulong.d b/src/rt/typeinfo/ti_ulong.d index 6b067f2c49..8d8cbeef9e 100644 --- a/src/rt/typeinfo/ti_ulong.d +++ b/src/rt/typeinfo/ti_ulong.d @@ -33,12 +33,12 @@ class TypeInfo_m : TypeInfo return hashOf(*cast(const ulong*)p); } - override bool equals(in void* p1, in void* p2) + override bool equals(const scope void* p1, const scope void* p2) { return *cast(ulong *)p1 == *cast(ulong *)p2; } - override int compare(in void* p1, in void* p2) + override int compare(const scope void* p1, const scope void* p2) { if (*cast(ulong *)p1 < *cast(ulong *)p2) return -1; diff --git a/src/rt/typeinfo/ti_ushort.d b/src/rt/typeinfo/ti_ushort.d index f90b4ab972..b8a6db5610 100644 --- a/src/rt/typeinfo/ti_ushort.d +++ b/src/rt/typeinfo/ti_ushort.d @@ -29,12 +29,12 @@ class TypeInfo_t : TypeInfo return *cast(const ushort *)p; } - override bool equals(in void* p1, in void* p2) + override bool equals(const scope void* p1, const scope void* p2) { return *cast(ushort *)p1 == *cast(ushort *)p2; } - override int compare(in void* p1, in void* p2) + override int compare(const scope void* p1, const scope void* p2) { return *cast(ushort *)p1 - *cast(ushort *)p2; } diff --git a/src/rt/typeinfo/ti_void.d b/src/rt/typeinfo/ti_void.d index c35de7b88d..8d285a36d9 100644 --- a/src/rt/typeinfo/ti_void.d +++ b/src/rt/typeinfo/ti_void.d @@ -29,12 +29,12 @@ class TypeInfo_v : TypeInfo assert(0); } - override bool equals(in void* p1, in void* p2) + override bool equals(const scope void* p1, const scope void* p2) { return *cast(byte *)p1 == *cast(byte *)p2; } - override int compare(in void* p1, in void* p2) + override int compare(const scope void* p1, const scope void* p2) { return *cast(byte *)p1 - *cast(byte *)p2; } diff --git a/src/rt/typeinfo/ti_wchar.d b/src/rt/typeinfo/ti_wchar.d index 7d278abaac..e974772e15 100644 --- a/src/rt/typeinfo/ti_wchar.d +++ b/src/rt/typeinfo/ti_wchar.d @@ -29,12 +29,12 @@ class TypeInfo_u : TypeInfo return *cast(const wchar *)p; } - override bool equals(in void* p1, in void* p2) + override bool equals(const scope void* p1, const scope void* p2) { return *cast(wchar *)p1 == *cast(wchar *)p2; } - override int compare(in void* p1, in void* p2) + override int compare(const scope void* p1, const scope void* p2) { return *cast(wchar *)p1 - *cast(wchar *)p2; } diff --git a/src/rt/util/container/hashtab.d b/src/rt/util/container/hashtab.d index a9e5847de5..3b3f1d9e98 100644 --- a/src/rt/util/container/hashtab.d +++ b/src/rt/util/container/hashtab.d @@ -52,7 +52,7 @@ struct HashTab(Key, Value) return !_length; } - void remove(in Key key) + void remove(const scope Key key) in { assert(key in this); } do {