Skip to content
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
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 )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use this opportunity to normalize these too?

{
alias SQLTCHAR = SQLWCHAR;
}
else
{
alias SQLTCHAR = SQLCHAR;
} // end version( UNICODE )
} // end version ( UNICODE )
2 changes: 1 addition & 1 deletion posix.mak
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ 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 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(StdUnittest)
version (StdUnittest)
{
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 @@ -362,18 +362,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 @@ -382,7 +382,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 @@ -1955,7 +1955,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 @@ -2096,7 +2096,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 @@ -4319,7 +4319,7 @@ private struct SplitterResult(alias isTerminator, Range)

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

void popFront()
{
version(assert)
version (assert)
{
import core.exception : RangeError;
if (empty)
Expand Down Expand Up @@ -4513,14 +4513,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
6 changes: 3 additions & 3 deletions std/algorithm/sorting.d
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ if (isRandomAccessRange!Range && hasLength!Range && hasSlicing!Range)
for (;;)
{
// Loop invariant
version(StdUnittest)
version (StdUnittest)
{
import std.algorithm.searching : all;
assert(r[0 .. lo].all!(x => !lt(p, x)));
Expand Down Expand Up @@ -3439,7 +3439,7 @@ done:
a.length / 2 + 1);
}

version(StdUnittest)
version (StdUnittest)
private T[] randomArray(Flag!"exactSize" flag = No.exactSize, T = int)(
size_t maxSize = 1000,
T minValue = 0, T maxValue = 255)
Expand Down Expand Up @@ -3957,7 +3957,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 @@ -427,7 +427,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 @@ -550,7 +550,7 @@ private template blockAttribute(T)
enum blockAttribute = GC.BlkAttr.NO_SCAN;
}
}
version(StdUnittest)
version (StdUnittest)
{
import core.memory : UGC = GC;
static assert(!(blockAttribute!void & UGC.BlkAttr.NO_SCAN));
Expand All @@ -569,7 +569,7 @@ private template nDimensions(T)
}
}

version(StdUnittest)
version (StdUnittest)
{
static assert(nDimensions!(uint[]) == 1);
static assert(nDimensions!(float[][]) == 2);
Expand Down
6 changes: 3 additions & 3 deletions std/ascii.d
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ $(TR $(TD Enums) $(TD
+/
module std.ascii;

version(StdUnittest)
version (StdUnittest)
{
// FIXME: When dmd bug #314 is fixed, make these selective.
import std.meta; // : AliasSeq;
Expand Down Expand Up @@ -111,9 +111,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 @@ -1914,7 +1914,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
18 changes: 9 additions & 9 deletions std/bitmanip.d
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import std.range.primitives;
public import std.system : Endian;
import std.traits;

version(StdUnittest)
version (StdUnittest)
{
import std.stdio;
}
Expand Down Expand Up @@ -2523,7 +2523,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 @@ -2534,7 +2534,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 @@ -2647,7 +2647,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 @@ -2658,7 +2658,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 @@ -2697,7 +2697,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 @@ -2708,7 +2708,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 @@ -2794,7 +2794,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 @@ -2806,7 +2806,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
2 changes: 1 addition & 1 deletion std/c/stdlib.d
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ deprecated("Import core.stdc.stdlib or core.sys.posix.stdlib instead")
module std.c.stdlib;

public import core.stdc.stdlib;
version(Posix) public import core.sys.posix.stdlib : setenv, unsetenv;
version (Posix) public import core.sys.posix.stdlib : setenv, unsetenv;
14 changes: 7 additions & 7 deletions std/compiler.d
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ 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;
else Vendor vendor = Vendor.unknown;
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
4 changes: 2 additions & 2 deletions std/concurrency.d
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ do
}

// Make sure receive() works with free functions as well.
version(StdUnittest)
version (StdUnittest)
{
private void receiveFunction(int x) {}
}
Expand Down Expand Up @@ -2427,7 +2427,7 @@ private
}
}

version(StdUnittest)
version (StdUnittest)
{
import std.stdio;
import std.typecons : tuple, Tuple;
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(StdUnittest) debug = RBDoChecks;
version (StdUnittest) 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(StdUnittest)
version (StdUnittest)
{
static if (is(typeof(less) == string))
{
Expand Down
8 changes: 4 additions & 4 deletions std/conv.d
Original file line number Diff line number Diff line change
Expand Up @@ -3307,7 +3307,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 @@ -4882,7 +4882,7 @@ if (!is(T == class))
assert(u1.a == "hello");
}

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

version(StdUnittest) private class __conv_EmplaceTestClass
version (StdUnittest) private class __conv_EmplaceTestClass
{
int i = 3;
this(int i) @nogc @safe pure nothrow
Expand Down Expand Up @@ -5323,7 +5323,7 @@ version(StdUnittest) private class __conv_EmplaceTestClass
assert(s.i == 2);
}
}
version(StdUnittest)
version (StdUnittest)
{
//Ambiguity
struct __std_conv_S
Expand Down
Loading