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
165 changes: 110 additions & 55 deletions etc/c/curl.d

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion etc/c/odbc/sqltypes.d
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ struct SQL_INTERVAL_STRUCT
SQLINTERVAL interval_type;
SQLSMALLINT interval_sign;

union intval {
union intval
{
SQL_YEAR_MONTH_STRUCT year_month;
SQL_DAY_SECOND_STRUCT day_second;
}
Expand Down
15 changes: 10 additions & 5 deletions std/algorithm/comparison.d
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,8 @@ range of range (of range...) comparisons.

@safe pure unittest
{
struct R(bool _empty) {
struct R(bool _empty)
{
enum empty = _empty;
@property char front(){assert(0);}
void popFront(){assert(0);}
Expand Down Expand Up @@ -1046,7 +1047,8 @@ private struct Levenshtein(Range, alias equals, CostType = size_t)
return result;
}

~this() {
~this()
{
FreeMatrix();
}

Expand All @@ -1060,7 +1062,8 @@ private:
// Treat _matrix as a rectangular array
ref CostType matrix(size_t row, size_t col) { return _matrix[row * cols + col]; }

void AllocMatrix(size_t r, size_t c) @trusted {
void AllocMatrix(size_t r, size_t c) @trusted
{
import core.checkedint : mulu;
bool overflow;
const rc = mulu(r, c, overflow);
Expand All @@ -1081,14 +1084,16 @@ private:
}
}

void FreeMatrix() @trusted {
void FreeMatrix() @trusted
{
import core.stdc.stdlib : free;

free(_matrix.ptr);
_matrix = null;
}

void InitMatrix() {
void InitMatrix()
{
foreach (r; 0 .. rows)
matrix(r,0) = r * _deletionIncrement;
foreach (c; 0 .. cols)
Expand Down
21 changes: 14 additions & 7 deletions std/algorithm/iteration.d
Original file line number Diff line number Diff line change
Expand Up @@ -871,13 +871,15 @@ private:
(isRangeUnaryIterable!R || isRangeBinaryIterable!R);

enum isForeachUnaryIterable(R) =
is(typeof((R r) {
is(typeof((R r)
{
foreach (ref a; r)
cast(void) unaryFun!pred(a);
}));

enum isForeachBinaryIterable(R) =
is(typeof((R r) {
is(typeof((R r)
{
foreach (ref i, ref a; r)
cast(void) binaryFun!BinaryArgs(i, a);
}));
Expand Down Expand Up @@ -944,7 +946,8 @@ public:
{
// opApply with >2 parameters. count the delegate args.
// only works if it is not templated (otherwise we cannot count the args)
auto dg(Parameters!(Parameters!(r.opApply)) params) {
auto dg(Parameters!(Parameters!(r.opApply)) params)
{
pred(params);
return 0; // tells opApply to continue iteration
}
Expand Down Expand Up @@ -1491,7 +1494,8 @@ if (isInputRange!R)
static if (isForwardRange!R)
{
///
@property typeof(this) save() {
@property typeof(this) save()
{
typeof(this) ret = this;
ret._input = this._input.save;
ret._current = this._current;
Expand Down Expand Up @@ -3893,7 +3897,8 @@ if (is(typeof(binaryFun!pred(r.front, s)) : bool)
assert(split.front == "b ");
assert(split.back == "r ");

foreach (DummyType; AllDummyRanges) { // Bug 4408
foreach (DummyType; AllDummyRanges) // Bug 4408
{
static if (isRandomAccessRange!DummyType)
{
static assert(isBidirectionalRange!DummyType);
Expand Down Expand Up @@ -4167,7 +4172,8 @@ if (is(typeof(binaryFun!pred(r.front, s.front)) : bool)
import std.algorithm.comparison : equal;

// Test by-reference separator
class RefSep {
class RefSep
{
@safe:
string _impl;
this(string s) { _impl = s; }
Expand Down Expand Up @@ -5031,7 +5037,8 @@ private struct UniqResult(alias pred, Range)

static if (isForwardRange!Range)
{
@property typeof(this) save() {
@property typeof(this) save()
{
return typeof(this)(_input.save);
}
}
Expand Down
18 changes: 12 additions & 6 deletions std/algorithm/mutation.d
Original file line number Diff line number Diff line change
Expand Up @@ -375,9 +375,11 @@ if (areCopyCompatibleArrays!(SourceRange, TargetRange))
assert(tlen >= slen,
"Cannot copy a source range into a smaller target range.");

immutable overlaps = __ctfe || () @trusted {
immutable overlaps = __ctfe || () @trusted
{
return source.ptr < target.ptr + tlen &&
target.ptr < source.ptr + slen; }();
target.ptr < source.ptr + slen;
}();

if (overlaps)
{
Expand Down Expand Up @@ -1003,12 +1005,14 @@ if (is(Range == char[]) || is(Range == wchar[]))
// elaborate assigns.
@system unittest
{
struct Int {
struct Int
{
~this() {}
int x = 3;
}
Int[2] xs = [Int(1), Int(2)];
struct R {
struct R
{
bool done;
bool empty() { return done; }
ref Int[2] front() { return xs; }
Expand Down Expand Up @@ -1098,7 +1102,8 @@ pure nothrow @safe @nogc unittest
import std.exception : assertCTFEable;
import std.traits;

assertCTFEable!((){
assertCTFEable!(()
{
Object obj1 = new Object;
Object obj2 = obj1;
Object obj3;
Expand Down Expand Up @@ -1212,7 +1217,8 @@ private T moveImpl(T)(ref T source)
import std.exception : assertCTFEable;
import std.traits;

assertCTFEable!((){
assertCTFEable!(()
{
Object obj1 = new Object;
Object obj2 = obj1;
Object obj3 = move(obj2);
Expand Down
9 changes: 6 additions & 3 deletions std/algorithm/searching.d
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,8 @@ if (isNarrowString!R1 && isNarrowString!R2)
dchar[], const(dchar)[], dstring))
{
foreach (T; AliasSeq!(string, wstring, dstring))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
() // avoid slow optimizations for large functions @@@BUG@@@ 2396
{
assert(commonPrefix(to!S(""), to!T("")).empty);
assert(commonPrefix(to!S(""), to!T("hello")).empty);
assert(commonPrefix(to!S("hello"), to!T("")).empty);
Expand Down Expand Up @@ -1176,7 +1177,8 @@ if (isInputRange!R &&
assert(endsWith(to!S("abc\uFF28"), 'a', '\uFF28', 'c') == 2);

foreach (T; AliasSeq!(char[], wchar[], dchar[], string, wstring, dstring))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
() // avoid slow optimizations for large functions @@@BUG@@@ 2396
{
//Lots of strings
assert(endsWith(to!S("abc"), to!T("")));
assert(!endsWith(to!S("abc"), to!T("a")));
Expand Down Expand Up @@ -4283,7 +4285,8 @@ if (isInputRange!R &&
assert(startsWith(to!S("\uFF28abc"), 'a', '\uFF28', 'c') == 2);

foreach (T; AliasSeq!(char[], wchar[], dchar[], string, wstring, dstring))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
() // avoid slow optimizations for large functions @@@BUG@@@ 2396
{
//Lots of strings
assert(startsWith(to!S("abc"), to!T("")));
assert(startsWith(to!S("ab"), to!T("a")));
Expand Down
3 changes: 2 additions & 1 deletion std/algorithm/sorting.d
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,8 @@ if (isRandomAccessRange!Range && !isInfinite!Range &&
auto index2 = new long[arr.length];
makeIndex(arr, index2);
assert(isSorted!
((long a, long b){
((long a, long b)
{
return arr[cast(size_t) a] < arr[cast(size_t) b];
})(index2));

Expand Down
24 changes: 16 additions & 8 deletions std/array.d
Original file line number Diff line number Diff line change
Expand Up @@ -1437,7 +1437,8 @@ if (isSomeString!S)
@safe unittest //purity, ctfe ...
{
import std.exception;
void dg() @safe pure {
void dg() @safe pure
{
assert(split("hello world"c) == ["hello"c, "world"c]);
assert(split("hello world"w) == ["hello"w, "world"w]);
assert(split("hello world"d) == ["hello"d, "world"d]);
Expand Down Expand Up @@ -1865,7 +1866,8 @@ if (isInputRange!RoR &&
auto filteredWords = filter!"true"(filteredWordsArr);

foreach (S; AliasSeq!(string, wstring, dstring))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
() // avoid slow optimizations for large functions @@@BUG@@@ 2396
{
assert(join(filteredWords, to!S(", ")) == "日本語, paul, jerry");
assert(join(filteredWords, to!(ElementType!S)(',')) == "日本語,paul,jerry");
assert(join(filteredWordsArr, to!(ElementType!(S))(',')) == "日本語,paul,jerry");
Expand Down Expand Up @@ -2073,7 +2075,8 @@ if (isOutputRange!(Sink, E) && isDynamicArray!(E[])
foreach (S; AliasSeq!(string, wstring, dstring, char[], wchar[], dchar[]))
{
foreach (T; AliasSeq!(string, wstring, dstring, char[], wchar[], dchar[]))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
() // avoid slow optimizations for large functions @@@BUG@@@ 2396
{
auto s = to!S("This is a foo foo list");
auto from = to!T("foo");
auto into = to!S("silly");
Expand Down Expand Up @@ -2519,7 +2522,8 @@ if (isDynamicArray!(E[]) &&
{
foreach (T; AliasSeq!(string, wstring, dstring, char[], wchar[], dchar[],
const(char[]), immutable(char[])))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
() // avoid slow optimizations for large functions @@@BUG@@@ 2396
{
auto s = to!S("This is a foo foo list");
auto s2 = to!S("Thüs is a ßöö foo list");
auto from = to!T("foo");
Expand Down Expand Up @@ -2634,7 +2638,8 @@ if (isDynamicArray!(E[]) &&
{
foreach (T; AliasSeq!(string, wstring, dstring, char[], wchar[], dchar[],
const(char[]), immutable(char[])))
(){ // avoid slow optimizations for large functions @@@BUG@@@ 2396
() // avoid slow optimizations for large functions @@@BUG@@@ 2396
{
auto s = to!S("This is a foo foo list");
auto s2 = to!S("Thüs is a ßöö ßöö list");
auto from = to!T("foo");
Expand Down Expand Up @@ -3425,7 +3430,8 @@ Appender!(E[]) appender(A : E[], E)(auto ref A array)
@safe unittest
{
//9528
const(E)[] fastCopy(E)(E[] src) {
const(E)[] fastCopy(E)(E[] src)
{
auto app = appender!(const(E)[])();
foreach (i, e; src)
app.put(e);
Expand All @@ -3443,10 +3449,12 @@ Appender!(E[]) appender(A : E[], E)(auto ref A array)
{
import std.algorithm.iteration : map;
//10753
struct Foo {
struct Foo
{
immutable dchar d;
}
struct Bar {
struct Bar
{
immutable int x;
}
"12".map!Foo.array;
Expand Down
3 changes: 2 additions & 1 deletion std/bigint.d
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,8 @@ unittest

@system unittest // 6850
{
pure long pureTest() {
pure long pureTest()
{
BigInt a = 1;
BigInt b = 1336;
a += b;
Expand Down
24 changes: 16 additions & 8 deletions std/bitmanip.d
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ Following arguments works the same way as $(D bitfield)'s. The bitfield must fit
bits known to be zero because of the pointer alignment.
*/

template taggedPointer(T : T*, string name, Ts...) {
template taggedPointer(T : T*, string name, Ts...)
{
enum taggedPointer = createTaggedReference!(T*, T.alignof, name, Ts).result;
}

Expand Down Expand Up @@ -482,7 +483,8 @@ unittest
Object, "a",
uint, "b", 4)));

struct S {
struct S
{
mixin(taggedClassRef!(
Object, "a",
bool, "b", 1));
Expand All @@ -497,7 +499,8 @@ unittest
@safe unittest
{
// Bug #6686
union S {
union S
{
ulong bits = ulong.max;
mixin (bitfields!(
ulong, "back", 31,
Expand Down Expand Up @@ -556,7 +559,8 @@ unittest
@safe unittest
{
{
static struct Integrals {
static struct Integrals
{
bool checkExpectations(bool eb, int ei, short es) { return b == eb && i == ei && s == es; }

mixin(bitfields!(
Expand All @@ -578,7 +582,8 @@ unittest

//Bug# 8876
{
struct MoreIntegrals {
struct MoreIntegrals
{
bool checkExpectations(uint eu, ushort es, uint ei) { return u == eu && s == es && i == ei; }

mixin(bitfields!(
Expand All @@ -601,7 +606,8 @@ unittest

enum A { True, False }
enum B { One, Two, Three, Four }
static struct Enums {
static struct Enums
{
bool checkExpectations(A ea, B eb) { return a == ea && b == eb; }

mixin(bitfields!(
Expand All @@ -616,7 +622,8 @@ unittest
e.b = B.Three;
assert(e.checkExpectations(A.False, B.Three));

static struct SingleMember {
static struct SingleMember
{
bool checkExpectations(bool eb) { return b == eb; }

mixin(bitfields!(
Expand Down Expand Up @@ -751,7 +758,8 @@ struct DoubleRep
@safe unittest
{
// Issue #15305
struct S {
struct S
{
mixin(bitfields!(
bool, "alice", 1,
ulong, "bob", 63,
Expand Down
Loading