Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
/ druntime Public archive
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/core/bitop.d
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/core/gc/gcinterface.d
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -182,7 +182,7 @@ interface GC
/**
* run finalizers
*/
void runFinalizers(in void[] segment) nothrow;
void runFinalizers(const scope void[] segment) nothrow;

/*
*
Expand Down
4 changes: 2 additions & 2 deletions src/core/internal/utf.d
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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; )
Expand Down
30 changes: 15 additions & 15 deletions src/core/memory.d
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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 );
}
Expand All @@ -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 );
}
Expand Down Expand Up @@ -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 );
}
Expand All @@ -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 );
}
Expand All @@ -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 );
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/runtime.d
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/core/sys/posix/dlfcn.d
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/core/sys/posix/stdio.d
Original file line number Diff line number Diff line change
Expand Up @@ -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*);
Expand Down
4 changes: 2 additions & 2 deletions src/core/time.d
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
{
Expand Down Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions src/gc/impl/conservative/gc.d
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion src/gc/impl/manual/gc.d
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ class ManualGC : GC
return 0;
}

void runFinalizers(in void[] segment) nothrow
void runFinalizers(const scope void[] segment) nothrow
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/gc/impl/proto/gc.d
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class ProtoGC : GC
return 0;
}

void runFinalizers(in void[] segment) nothrow
void runFinalizers(const scope void[] segment) nothrow
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/gc/proxy.d
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
}
Expand Down
Loading