Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 0352453

Browse files
dkorpeldlang-bot
authored andcommitted
rt/aaA: add some pure nothrow
1 parent f8eefbd commit 0352453

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

src/rt/aaA.d

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct AA
5050
private struct Impl
5151
{
5252
private:
53-
this(scope const TypeInfo_AssociativeArray ti, size_t sz = INIT_NUM_BUCKETS)
53+
this(scope const TypeInfo_AssociativeArray ti, size_t sz = INIT_NUM_BUCKETS) nothrow
5454
{
5555
keysz = cast(uint) ti.key.tsize;
5656
valsz = cast(uint) ti.value.tsize;
@@ -125,7 +125,7 @@ private:
125125
}
126126
}
127127

128-
void grow(scope const TypeInfo keyti)
128+
void grow(scope const TypeInfo keyti) pure nothrow
129129
{
130130
// If there are so many deleted entries, that growing would push us
131131
// below the shrink threshold, we just purge deleted entries instead.
@@ -135,7 +135,7 @@ private:
135135
resize(GROW_FAC * dim);
136136
}
137137

138-
void shrink(scope const TypeInfo keyti)
138+
void shrink(scope const TypeInfo keyti) pure nothrow
139139
{
140140
if (dim > INIT_NUM_BUCKETS)
141141
resize(dim / GROW_FAC);
@@ -233,7 +233,7 @@ package void entryDtor(void* p, const TypeInfo_Struct sti)
233233
extra[1].destroy(p + talign(extra[0].tsize, extra[1].talign));
234234
}
235235

236-
private bool hasDtor(const TypeInfo ti)
236+
private bool hasDtor(const TypeInfo ti) pure nothrow
237237
{
238238
import rt.lifetime : unqualify;
239239

@@ -246,15 +246,15 @@ private bool hasDtor(const TypeInfo ti)
246246
return false;
247247
}
248248

249-
private immutable(void)* getRTInfo(const TypeInfo ti)
249+
private immutable(void)* getRTInfo(const TypeInfo ti) pure nothrow
250250
{
251251
// classes are references
252252
const isNoClass = ti && typeid(ti) !is typeid(TypeInfo_Class);
253253
return isNoClass ? ti.rtInfo() : rtinfoHasPointers;
254254
}
255255

256256
// build type info for Entry with additional key and value fields
257-
TypeInfo_Struct fakeEntryTI(ref Impl aa, const TypeInfo keyti, const TypeInfo valti)
257+
TypeInfo_Struct fakeEntryTI(ref Impl aa, const TypeInfo keyti, const TypeInfo valti) nothrow
258258
{
259259
import rt.lifetime : unqualify;
260260

@@ -319,7 +319,8 @@ TypeInfo_Struct fakeEntryTI(ref Impl aa, const TypeInfo keyti, const TypeInfo va
319319
}
320320

321321
// build appropriate RTInfo at runtime
322-
immutable(void)* rtinfoEntry(ref Impl aa, immutable(size_t)* keyinfo, immutable(size_t)* valinfo, size_t* rtinfoData, size_t rtinfoSize)
322+
immutable(void)* rtinfoEntry(ref Impl aa, immutable(size_t)* keyinfo,
323+
immutable(size_t)* valinfo, size_t* rtinfoData, size_t rtinfoSize) pure nothrow
323324
{
324325
enum bitsPerWord = 8 * size_t.sizeof;
325326

@@ -456,7 +457,7 @@ private size_t mix(size_t h) @safe pure nothrow @nogc
456457
return h;
457458
}
458459

459-
private size_t calcHash(scope const void* pkey, scope const TypeInfo keyti)
460+
private size_t calcHash(scope const void* pkey, scope const TypeInfo keyti) nothrow
460461
{
461462
immutable hash = keyti.getHash(pkey);
462463
// highest bit is set to distinguish empty/deleted from filled buckets

src/rt/lifetime.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -718,7 +718,7 @@ extern(C) void _d_arrayshrinkfit(const TypeInfo ti, void[] arr) /+nothrow+/
718718
}
719719
}
720720

721-
package bool hasPostblit(in TypeInfo ti)
721+
package bool hasPostblit(in TypeInfo ti) nothrow pure
722722
{
723723
return (&ti.postblit).funcptr !is &TypeInfo.postblit;
724724
}

0 commit comments

Comments
 (0)