Add DIP25 compatibility. Fix #83

This commit is contained in:
Eugen Wissner 2019-03-23 06:41:51 +01:00
parent ad46afb10b
commit 76f2cd7080
11 changed files with 24 additions and 82 deletions

View File

@ -8,7 +8,7 @@ language: d
d:
- dmd-2.085.0
- dmd-2.082.1
- dmd-2.081.2
env:
global:

View File

@ -10,10 +10,10 @@ environment:
DVersion: 2.085.0
arch: x86
- DC: dmd
DVersion: 2.082.1
DVersion: 2.081.2
arch: x64
- DC: dmd
DVersion: 2.082.1
DVersion: 2.081.2
arch: x86
skip_tags: true

View File

@ -53,6 +53,7 @@
{
"name": "unittest",
"versions": ["TanyaPhobos"],
"dflags": ["-dip25"],
"importPaths": [
"./source",
"./tests"

View File

@ -67,11 +67,7 @@ final class StreamTransport : SocketWatcher, DuplexTransport, SocketTransport
* Postcondition: $(D_INLINECODE socket !is null)
*/
override @property OverlappedConnectedSocket socket() pure nothrow @safe @nogc
out (socket)
{
assert(socket !is null);
}
do
out (socket; socket !is null)
{
return cast(OverlappedConnectedSocket) socket_;
}
@ -124,11 +120,7 @@ final class StreamTransport : SocketWatcher, DuplexTransport, SocketTransport
* Precondition: $(D_INLINECODE protocol !is null)
*/
@property void protocol(Protocol protocol) pure nothrow @safe @nogc
in
{
assert(protocol !is null);
}
do
in (protocol !is null)
{
protocol_ = protocol;
}
@ -264,11 +256,7 @@ final class IOCPLoop : Loop
private void kill(StreamTransport transport,
SocketException exception = null) @nogc
in
{
assert(transport !is null);
}
do
in (transport !is null)
{
transport.socket.shutdown();
defaultAllocator.dispose(transport.socket);

View File

@ -75,22 +75,14 @@ package class StreamTransport : SocketWatcher, DuplexTransport, SocketTransport
* Postcondition: $(D_INLINECODE socket !is null)
*/
override @property ConnectedSocket socket() pure nothrow @safe @nogc
out (socket)
{
assert(socket !is null);
}
do
out (socket; socket !is null)
{
return cast(ConnectedSocket) socket_;
}
private @property void socket(ConnectedSocket socket)
pure nothrow @safe @nogc
in
{
assert(socket !is null);
}
do
in (socket !is null)
{
socket_ = socket;
}
@ -114,11 +106,7 @@ package class StreamTransport : SocketWatcher, DuplexTransport, SocketTransport
* Precondition: $(D_INLINECODE protocol !is null)
*/
@property void protocol(Protocol protocol) pure nothrow @safe @nogc
in
{
assert(protocol !is null);
}
do
in (protocol !is null)
{
protocol_ = protocol;
}
@ -257,11 +245,7 @@ abstract class SelectorLoop : Loop
*/
protected void kill(StreamTransport transport,
SocketException exception = null) @nogc
in
{
assert(transport !is null);
}
do
in (transport !is null)
{
transport.socket.shutdown();
defaultAllocator.dispose(transport.socket);
@ -283,11 +267,7 @@ abstract class SelectorLoop : Loop
*/
protected bool feed(StreamTransport transport,
SocketException exception = null) @nogc
in
{
assert(transport !is null);
}
do
in (transport !is null)
{
while (transport.input.length && transport.writeReady)
{
@ -350,11 +330,7 @@ abstract class SelectorLoop : Loop
* connection = Connection watcher ready to accept.
*/
package void acceptConnections(ConnectionWatcher connection) @nogc
in
{
assert(connection !is null);
}
do
in (connection !is null)
{
while (true)
{

View File

@ -262,12 +262,8 @@ abstract class Loop
* $(D_PSYMBOL maxBlockTime).
*/
protected @property void blockTime(in Duration blockTime) @safe pure nothrow @nogc
in
{
assert(blockTime <= 1.dur!"hours", "Too long to wait.");
assert(!blockTime.isNegative);
}
do
in (blockTime <= 1.dur!"hours", "Too long to wait.")
in (!blockTime.isNegative)
{
blockTime_ = blockTime;
}
@ -340,11 +336,7 @@ class BadLoopException : Exception
* loop = The event loop.
*/
@property void defaultLoop(Loop loop) @nogc
in
{
assert(loop !is null);
}
do
in (loop !is null)
{
defaultLoop_ = loop;
}

View File

@ -57,10 +57,7 @@ interface DuplexTransport : ReadTransport, WriteTransport
* Postcondition: $(D_INLINECODE protocol !is null)
*/
@property Protocol protocol() pure nothrow @safe @nogc
out (protocol)
{
assert(protocol !is null);
}
out (protocol; protocol !is null);
/**
* Switches the protocol.
@ -73,10 +70,7 @@ interface DuplexTransport : ReadTransport, WriteTransport
* Precondition: $(D_INLINECODE protocol !is null)
*/
@property void protocol(Protocol protocol) pure nothrow @safe @nogc
in
{
assert(protocol !is null);
}
in (protocol !is null);
/**

View File

@ -52,11 +52,7 @@ abstract class SocketWatcher : Watcher
* Precondition: $(D_INLINECODE socket !is null)
*/
this(Socket socket) pure nothrow @safe @nogc
in
{
assert(socket !is null);
}
do
in (socket !is null)
{
socket_ = socket;
}
@ -102,11 +98,7 @@ class ConnectionWatcher : SocketWatcher
* Invokes new connection callback.
*/
override void invoke() @nogc
in
{
assert(protocolFactory !is null, "Protocol isn't set.");
}
do
in (protocolFactory !is null, "Protocol isn't set.")
{
for (; !this.incoming.empty; this.incoming.removeFront())
{

View File

@ -1928,7 +1928,7 @@ private char[] errol3(double value,
* $(D_PARAM sign).
*/
private const(char)[] real2String(double value,
ref char[512] buffer,
return ref char[512] buffer,
out int exponent,
out bool sign) @nogc nothrow pure @trusted
{

View File

@ -57,10 +57,9 @@ struct Address4
* Params:
* address = The address as an unsigned integer in host byte order.
*/
this(uint address) @nogc nothrow pure @safe
this(uint address) @nogc nothrow pure @trusted
{
copy(NetworkOrder!4(address),
(() @trusted => (cast(ubyte*) &this.address)[0 .. 4])());
copy(NetworkOrder!4(address), (cast(ubyte*) &this.address)[0 .. 4]);
}
///

View File

@ -608,7 +608,7 @@ if (isTypeTuple!Specs && NoDuplicates!Specs.length == Specs.length)
return this;
}
private ref typeof(this) copyAssign(T)(ref T that)
private ref typeof(this) copyAssign(T)(ref T that) return
{
this.tag = staticIndexOf!(T, Types);