Skip to content
Merged
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
4 changes: 2 additions & 2 deletions etc/c/curl.d
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ alias CURL = void;
alias curl_socket_t = socket_t;

/// jdrewsen - Would like to get socket error constant from std.socket by it is private atm.
version(Windows)
version (Windows)
{
import core.sys.windows.windows, core.sys.windows.winsock2;
enum CURL_SOCKET_BAD = SOCKET_ERROR;
}
version(Posix) enum CURL_SOCKET_BAD = -1;
version (Posix) enum CURL_SOCKET_BAD = -1;

///
extern (C) struct curl_httppost
Expand Down
4 changes: 2 additions & 2 deletions etc/c/odbc/sqltypes.d
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ alias GUID = SQLGUID;
alias BOOKMARK = uint;
alias SQLWCHAR = ushort;

version( UNICODE )
version (UNICODE)
{
alias SQLTCHAR = SQLWCHAR;
}
else
{
alias SQLTCHAR = SQLCHAR;
} // end version( UNICODE )
} // end version (UNICODE)
5 changes: 4 additions & 1 deletion posix.mak
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,10 @@ style_lint: dscanner $(LIB)
grep -nr '[[:blank:]]$$' etc std ; test $$? -eq 1

@echo "Enforce whitespace before opening parenthesis"
grep -nrE "(for|foreach|foreach_reverse|if|while|switch|catch)\(" $$(find etc std -name '*.d') ; test $$? -eq 1
grep -nrE "\<(for|foreach|foreach_reverse|if|while|switch|catch|version)\(" $$(find etc std -name '*.d') ; test $$? -eq 1

@echo "Enforce no whitespace after opening parenthesis"
grep -nrE "\<(version) \( " $$(find etc std -name '*.d') ; test $$? -eq 1

@echo "Enforce whitespace between colon(:) for import statements (doesn't catch everything)"
grep -nr 'import [^/,=]*:.*;' $$(find etc std -name '*.d') | grep -vE "import ([^ ]+) :\s"; test $$? -eq 1
Expand Down
2 changes: 1 addition & 1 deletion std/algorithm/internal.d
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ package template algoFormat()
}

// Internal random array generators
version(unittest)
version (unittest)
{
package enum size_t maxArraySize = 50;
package enum size_t minArraySize = maxArraySize - 1;
Expand Down
20 changes: 10 additions & 10 deletions std/algorithm/iteration.d
Original file line number Diff line number Diff line change
Expand Up @@ -365,18 +365,18 @@ private struct _Cache(R, bool bidir)

E front() @property
{
version(assert) if (empty) throw new RangeError();
version (assert) if (empty) throw new RangeError();
return caches[0];
}
static if (bidir) E back() @property
{
version(assert) if (empty) throw new RangeError();
version (assert) if (empty) throw new RangeError();
return caches[1];
}

void popFront()
{
version(assert) if (empty) throw new RangeError();
version (assert) if (empty) throw new RangeError();
source.popFront();
if (!source.empty)
caches[0] = source.front;
Expand All @@ -385,7 +385,7 @@ private struct _Cache(R, bool bidir)
}
static if (bidir) void popBack()
{
version(assert) if (empty) throw new RangeError();
version (assert) if (empty) throw new RangeError();
source.popBack();
if (!source.empty)
caches[1] = source.back;
Expand Down Expand Up @@ -2137,7 +2137,7 @@ if (isInputRange!Range)
]));
}

version(none) // this example requires support for non-equivalence relations
version (none) // this example requires support for non-equivalence relations
@safe unittest
{
// Grouping by maximum adjacent difference:
Expand Down Expand Up @@ -2278,7 +2278,7 @@ version(none) // this example requires support for non-equivalence relations
}

// Issue 13595
version(none) // This requires support for non-equivalence relations
version (none) // This requires support for non-equivalence relations
@system unittest
{
import std.algorithm.comparison : equal;
Expand Down Expand Up @@ -4849,7 +4849,7 @@ private struct SplitterResult(alias isTerminator, Range)

@property auto front()
{
version(assert)
version (assert)
{
import core.exception : RangeError;
if (empty)
Expand All @@ -4866,7 +4866,7 @@ private struct SplitterResult(alias isTerminator, Range)

void popFront()
{
version(assert)
version (assert)
{
import core.exception : RangeError;
if (empty)
Expand Down Expand Up @@ -5043,14 +5043,14 @@ if (isSomeChar!C)

@property C[] front() pure @safe
{
version(assert) if (empty) throw new RangeError();
version (assert) if (empty) throw new RangeError();
return _s[0 .. _frontLength];
}

void popFront() pure @safe
{
import std.string : stripLeft;
version(assert) if (empty) throw new RangeError();
version (assert) if (empty) throw new RangeError();
_s = _s[_frontLength .. $].stripLeft();
getFirst();
}
Expand Down
4 changes: 2 additions & 2 deletions std/algorithm/sorting.d
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ if (isRandomAccessRange!Range && hasLength!Range && hasSlicing!Range && hasAssig
for (;;)
{
// Loop invariant
version(unittest)
version (unittest)
{
// this used to import std.algorithm.all, but we want to save
// imports when unittests are enabled if possible.
Expand Down Expand Up @@ -3964,7 +3964,7 @@ if (isRandomAccessRange!Range && hasLength!Range &&
else static if (k == 5)
{
// Credit: Teppo Niinimäki
version(unittest) scope(success)
version (unittest) scope(success)
{
assert(!lt(r[c], r[a]));
assert(!lt(r[c], r[b]));
Expand Down
6 changes: 3 additions & 3 deletions std/array.d
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ if (isPointer!Range && isIterable!(PointerTarget!Range) && !isNarrowString!Range
assert(a.length == 5);
}

version(unittest)
version (unittest)
private extern(C) void _d_delarray_t(void[] *p, TypeInfo_Struct ti);

@system unittest
Expand Down Expand Up @@ -456,7 +456,7 @@ if (isInputRange!Range)
assert(b == ["foo":"bar", "baz":"quux"]);
}

// @@@11053@@@ - Cannot be version(unittest) - recursive instantiation error
// @@@11053@@@ - Cannot be version (unittest) - recursive instantiation error
@safe unittest
{
import std.typecons;
Expand Down Expand Up @@ -4295,7 +4295,7 @@ nothrow pure @safe unittest
staticArray!(long, 2.iota).checkStaticArray!long([0, 1]);
}

version(unittest) private void checkStaticArray(T, T1, T2)(T1 a, T2 b) nothrow @safe pure @nogc
version (unittest) private void checkStaticArray(T, T1, T2)(T1 a, T2 b) nothrow @safe pure @nogc
{
static assert(is(T1 == T[T1.length]));
assert(a == b);
Expand Down
4 changes: 2 additions & 2 deletions std/ascii.d
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ enum LetterCase : bool
}

/// Newline sequence for this system.
version(Windows)
version (Windows)
immutable newline = "\r\n";
else version(Posix)
else version (Posix)
immutable newline = "\n";
else
static assert(0, "Unsupported OS");
Expand Down
2 changes: 1 addition & 1 deletion std/base64.d
Original file line number Diff line number Diff line change
Expand Up @@ -1908,7 +1908,7 @@ class Base64Exception : Exception

// @@@9543@@@ These tests were disabled because they actually relied on the input range having length.
// The implementation (currently) doesn't support encoding/decoding from a length-less source.
version(none)
version (none)
{ // with InputRange
// InputRange to ubyte[] or char[]
auto encoded = Base64.encode(map!(to!(ubyte))(["20", "251", "156", "3", "217", "126"]));
Expand Down
16 changes: 8 additions & 8 deletions std/bitmanip.d
Original file line number Diff line number Diff line change
Expand Up @@ -2873,7 +2873,7 @@ if (isIntegral!T || isSomeChar!T || isBoolean!T)
{
EndianSwapper!T es = void;

version(LittleEndian)
version (LittleEndian)
es.value = swapEndian(val);
else
es.value = val;
Expand All @@ -2884,7 +2884,7 @@ if (isIntegral!T || isSomeChar!T || isBoolean!T)
private auto nativeToBigEndianImpl(T)(T val) @safe pure nothrow @nogc
if (isFloatOrDouble!T)
{
version(LittleEndian)
version (LittleEndian)
return floatEndianImpl!(T, true)(val);
else
return floatEndianImpl!(T, false)(val);
Expand Down Expand Up @@ -2998,7 +2998,7 @@ if ((isIntegral!T || isSomeChar!T || isBoolean!T) &&
EndianSwapper!T es = void;
es.array = val;

version(LittleEndian)
version (LittleEndian)
immutable retval = swapEndian(es.value);
else
immutable retval = es.value;
Expand All @@ -3009,7 +3009,7 @@ if ((isIntegral!T || isSomeChar!T || isBoolean!T) &&
private T bigEndianToNativeImpl(T, size_t n)(ubyte[n] val) @safe pure nothrow @nogc
if (isFloatOrDouble!T && n == T.sizeof)
{
version(LittleEndian)
version (LittleEndian)
return cast(T) floatEndianImpl!(n, true)(val);
else
return cast(T) floatEndianImpl!(n, false)(val);
Expand Down Expand Up @@ -3048,7 +3048,7 @@ if (isIntegral!T || isSomeChar!T || isBoolean!T)
{
EndianSwapper!T es = void;

version(BigEndian)
version (BigEndian)
es.value = swapEndian(val);
else
es.value = val;
Expand All @@ -3059,7 +3059,7 @@ if (isIntegral!T || isSomeChar!T || isBoolean!T)
private auto nativeToLittleEndianImpl(T)(T val) @safe pure nothrow @nogc
if (isFloatOrDouble!T)
{
version(BigEndian)
version (BigEndian)
return floatEndianImpl!(T, true)(val);
else
return floatEndianImpl!(T, false)(val);
Expand Down Expand Up @@ -3146,7 +3146,7 @@ if ((isIntegral!T || isSomeChar!T || isBoolean!T) &&
EndianSwapper!T es = void;
es.array = val;

version(BigEndian)
version (BigEndian)
immutable retval = swapEndian(es.value);
else
immutable retval = es.value;
Expand All @@ -3158,7 +3158,7 @@ private T littleEndianToNativeImpl(T, size_t n)(ubyte[n] val) @safe pure nothrow
if (((isFloatOrDouble!T) &&
n == T.sizeof))
{
version(BigEndian)
version (BigEndian)
return floatEndianImpl!(n, true)(val);
else
return floatEndianImpl!(n, false)(val);
Expand Down
12 changes: 6 additions & 6 deletions std/compiler.d
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ immutable
}

/// Which vendor produced this compiler.
version(StdDdoc) Vendor vendor;
else version(DigitalMars) Vendor vendor = Vendor.digitalMars;
else version(GNU) Vendor vendor = Vendor.gnu;
else version(LDC) Vendor vendor = Vendor.llvm;
else version(D_NET) Vendor vendor = Vendor.dotNET;
else version(SDC) Vendor vendor = Vendor.sdc;
version (StdDdoc) Vendor vendor;
else version (DigitalMars) Vendor vendor = Vendor.digitalMars;
else version (GNU) Vendor vendor = Vendor.gnu;
else version (LDC) Vendor vendor = Vendor.llvm;
else version (D_NET) Vendor vendor = Vendor.dotNET;
else version (SDC) Vendor vendor = Vendor.sdc;
else Vendor vendor = Vendor.unknown;


Expand Down
2 changes: 1 addition & 1 deletion std/concurrency.d
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ do
}

// Make sure receive() works with free functions as well.
version(unittest)
version (unittest)
{
private void receiveFunction(int x) {}
}
Expand Down
4 changes: 2 additions & 2 deletions std/container/rbtree.d
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ import std.functional : binaryFun;

public import std.container.util;

version(unittest) debug = RBDoChecks;
version (unittest) debug = RBDoChecks;

//debug = RBDoChecks;

Expand Down Expand Up @@ -745,7 +745,7 @@ if (is(typeof(binaryFun!less(T.init, T.init))))

alias _less = binaryFun!less;

version(unittest)
version (unittest)
{
static if (is(typeof(less) == string))
{
Expand Down
12 changes: 6 additions & 6 deletions std/conv.d
Original file line number Diff line number Diff line change
Expand Up @@ -1666,7 +1666,7 @@ if (!isImplicitlyConvertible!(S, T) && isAssociativeArray!S &&
assert(a.to!(const(int)[int]).byPair.equal(a.byPair));
}

version(unittest)
version (unittest)
private void testIntegralToFloating(Integral, Floating)()
{
Integral a = 42;
Expand All @@ -1675,7 +1675,7 @@ private void testIntegralToFloating(Integral, Floating)()
assert(a == to!Integral(b));
}

version(unittest)
version (unittest)
private void testFloatingToIntegral(Floating, Integral)()
{
bool convFails(Source, Target, E)(Source src)
Expand Down Expand Up @@ -3086,7 +3086,7 @@ if (isInputRange!Source && isSomeChar!(ElementType!Source) && !is(Source == enum

// min and max
real r = to!real(to!string(real.min_normal));
version(NetBSD)
version (NetBSD)
{
// NetBSD notice
// to!string returns 3.3621e-4932L. It is less than real.min_normal and it is subnormal value
Expand Down Expand Up @@ -4689,7 +4689,7 @@ if (!is(T == class))
assert(u1.a == "hello");
}

version(unittest) private struct __conv_EmplaceTest
version (unittest) private struct __conv_EmplaceTest
{
int i = 3;
this(int i)
Expand All @@ -4710,7 +4710,7 @@ version(unittest) private struct __conv_EmplaceTest
void opAssign();
}

version(unittest) private class __conv_EmplaceTestClass
version (unittest) private class __conv_EmplaceTestClass
{
int i = 3;
this(int i) @nogc @safe pure nothrow
Expand Down Expand Up @@ -5131,7 +5131,7 @@ version(unittest) private class __conv_EmplaceTestClass
}
}

version(unittest)
version (unittest)
{
//Ambiguity
private struct __std_conv_S
Expand Down
4 changes: 2 additions & 2 deletions std/datetime/date.d
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import std.traits : isSomeString, Unqual;
import std.typecons : Flag;
import std.range.primitives : isOutputRange;

version(unittest) import std.exception : assertThrown;
version (unittest) import std.exception : assertThrown;

@safe unittest
{
Expand Down Expand Up @@ -10416,7 +10416,7 @@ if (isSomeString!T)
}


version(unittest)
version (unittest)
{
private:
// All of these helper arrays are sorted in ascending order.
Expand Down
2 changes: 1 addition & 1 deletion std/datetime/interval.d
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import std.range.primitives : isOutputRange;
import std.traits : isIntegral, Unqual;
import std.typecons : Flag;

version(unittest) import std.exception : assertThrown;
version (unittest) import std.exception : assertThrown;


/++
Expand Down
Loading