From 4f4854429704624280a70c698dbc03724e55d988 Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Wed, 26 May 2021 10:29:03 +0200 Subject: Allow building with GDC 10.3 --- source/tanya/math/random.d | 21 ++++++++++++++++----- source/tanya/range/array.d | 4 ++-- source/tanya/typecons.d | 2 +- 3 files changed, 19 insertions(+), 8 deletions(-) (limited to 'source') diff --git a/source/tanya/math/random.d b/source/tanya/math/random.d index ae199f6..6ee4300 100644 --- a/source/tanya/math/random.d +++ b/source/tanya/math/random.d @@ -91,11 +91,7 @@ abstract class EntropySource * Postcondition: Returned length is less than or equal to * $(D_PARAM output) length. */ - Nullable!ubyte poll(out ubyte[maxGather] output) @nogc - out (length) - { - assert(length.isNull || length.get <= maxGather); - } + Nullable!ubyte poll(out ubyte[maxGather] output) @nogc; } version (CRuntime_Bionic) @@ -156,6 +152,11 @@ version (linux) * or nothing on error. */ override Nullable!ubyte poll(out ubyte[maxGather] output) @nogc nothrow + out (length) + { + assert(length.isNull || length.get <= maxGather); + } + do { // int getrandom(void *buf, size_t buflen, unsigned int flags); import mir.linux._asm.unistd : NR_getrandom; @@ -208,6 +209,11 @@ else version (SecureARC4Random) */ override Nullable!ubyte poll(out ubyte[maxGather] output) @nogc nothrow @safe + out (length) + { + assert(length.isNull || length.get <= maxGather); + } + do { (() @trusted => arc4random_buf(output.ptr, output.length))(); return Nullable!ubyte(cast(ubyte) (output.length)); @@ -316,6 +322,11 @@ else version (Windows) */ override Nullable!ubyte poll(out ubyte[maxGather] output) @nogc nothrow @safe + out (length) + { + assert(length.isNull || length.get <= maxGather); + } + do { Nullable!ubyte ret; diff --git a/source/tanya/range/array.d b/source/tanya/range/array.d index 6104a91..bd47fb9 100644 --- a/source/tanya/range/array.d +++ b/source/tanya/range/array.d @@ -133,7 +133,7 @@ do * * Precondition: $(D_INLINECODE array.length > 0). */ -void popFront(T)(scope ref inout(T)[] array) +void popFront(T)(ref inout(T)[] array) in { assert(array.length > 0); @@ -144,7 +144,7 @@ do } /// ditto -void popBack(T)(scope ref inout(T)[] array) +void popBack(T)(ref inout(T)[] array) in { assert(array.length > 0); diff --git a/source/tanya/typecons.d b/source/tanya/typecons.d index d1402cf..5e570f6 100644 --- a/source/tanya/typecons.d +++ b/source/tanya/typecons.d @@ -396,7 +396,7 @@ if (isTypeTuple!Specs && NoDuplicates!Specs.length == Specs.length) * Returns: $(D_KEYWORD true) if this $(D_PSYMBOL Variant) is equal to * $(D_PARAM that), $(D_KEYWORD false) otherwise. */ - bool opEquals()(auto ref inout Variant that) inout + bool opEquals()(auto ref inout(Variant) that) inout { if (this.tag != that.tag) { -- cgit v1.2.3