From: Iain Buclaw Date: Wed, 9 Jan 2019 23:04:20 +0000 (+0000) Subject: libphobos: Merge phobos upstream b022e552a X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9fa27ed0884b23d37f2f0b7ee2edd427664aa557;p=gcc.git libphobos: Merge phobos upstream b022e552a This removes updates the removal date of all deprecations in phobos. Many of the marked functions have passed their end dates, and are now absent in upstream. Reviewed-on: https://github.com/dlang/phobos/pull/6828 From-SVN: r267788 --- diff --git a/libphobos/src/MERGE b/libphobos/src/MERGE new file mode 100644 index 00000000000..f32fc597d95 --- /dev/null +++ b/libphobos/src/MERGE @@ -0,0 +1,4 @@ +b022e552aaca84810e3dda3a18179440943c7096 + +The first line of this file holds the git revision number of the last +merge done from the dlang/phobos repository. diff --git a/libphobos/src/std/array.d b/libphobos/src/std/array.d index 13677a30285..b03f5e9d2d0 100644 --- a/libphobos/src/std/array.d +++ b/libphobos/src/std/array.d @@ -76,7 +76,6 @@ Source: $(PHOBOSSRC std/_array.d) */ module std.array; -static import std.algorithm.iteration; // FIXME, remove with alias of splitter import std.functional; import std.meta; import std.traits; @@ -1465,6 +1464,7 @@ if (isSomeString!S) { import std.ascii : isWhite; import std.algorithm.comparison : equal; + import std.algorithm.iteration : splitter; string str = "Hello World!"; assert(str.splitter!(isWhite).equal(["Hello", "World!"])); @@ -1524,10 +1524,6 @@ if (isSomeString!S) assert(a == [[1], [4, 5, 1], [4, 5]]); } -// Explicitly undocumented. It will be removed in January 2018. @@@DEPRECATED_2018-01@@@ -deprecated("Please use std.algorithm.iteration.splitter instead.") -alias splitter = std.algorithm.iteration.splitter; - /++ Eagerly splits $(D range) into an array, using $(D sep) as the delimiter. diff --git a/libphobos/src/std/conv.d b/libphobos/src/std/conv.d index 76ac5321382..eaee62f2413 100644 --- a/libphobos/src/std/conv.d +++ b/libphobos/src/std/conv.d @@ -3865,20 +3865,10 @@ if (isInputRange!Source && isSomeChar!(ElementType!Source) && string text(T...)(T args) if (T.length > 0) { return textImpl!string(args); } -// @@@DEPRECATED_2018-06@@@ -deprecated("Calling `text` with 0 arguments is deprecated") -string text(T...)(T args) -if (T.length == 0) { return textImpl!string(args); } - ///ditto wstring wtext(T...)(T args) if (T.length > 0) { return textImpl!wstring(args); } -// @@@DEPRECATED_2018-06@@@ -deprecated("Calling `wtext` with 0 arguments is deprecated") -wstring wtext(T...)(T args) -if (T.length == 0) { return textImpl!wstring(args); } - ///ditto dstring dtext(T...)(T args) if (T.length > 0) { return textImpl!dstring(args); } @@ -3891,10 +3881,24 @@ if (T.length > 0) { return textImpl!dstring(args); } assert(dtext(42, ' ', 1.5, ": xyz") == "42 1.5: xyz"d); } -// @@@DEPRECATED_2018-06@@@ -deprecated("Calling `dtext` with 0 arguments is deprecated") -dstring dtext(T...)(T args) -if (T.length == 0) { return textImpl!dstring(args); } +@safe unittest +{ + char c = 'h'; + wchar w = '你'; + dchar d = 'እ'; + + assert( text(c, "ello", ' ', w, "好 ", d, "ው ሰላም ነው") == "hello 你好 እው ሰላም ነው"c); + assert(wtext(c, "ello", ' ', w, "好 ", d, "ው ሰላም ነው") == "hello 你好 እው ሰላም ነው"w); + assert(dtext(c, "ello", ' ', w, "好 ", d, "ው ሰላም ነው") == "hello 你好 እው ሰላም ነው"d); + + string cs = "今日は"; + wstring ws = "여보세요"; + dstring ds = "Здравствуйте"; + + assert( text(cs, ' ', ws, " ", ds) == "今日は 여보세요 Здравствуйте"c); + assert(wtext(cs, ' ', ws, " ", ds) == "今日は 여보세요 Здравствуйте"w); + assert(dtext(cs, ' ', ws, " ", ds) == "今日は 여보세요 Здравствуйте"d); +} private S textImpl(S, U...)(U args) { diff --git a/libphobos/src/std/datetime/date.d b/libphobos/src/std/datetime/date.d index 38a87661b4f..d571f5fdd33 100644 --- a/libphobos/src/std/datetime/date.d +++ b/libphobos/src/std/datetime/date.d @@ -2154,32 +2154,6 @@ public: assert(idt - duration == DateTime(1999, 7, 6, 12, 30, 21)); } - // Explicitly undocumented. It will be removed in January 2018. @@@DEPRECATED_2018-01@@@ - deprecated("Use Duration instead of TickDuration.") - DateTime opBinary(string op)(in TickDuration td) const @safe pure nothrow @nogc - if (op == "+" || op == "-") - { - DateTime retval = this; - immutable seconds = td.seconds; - mixin("return retval._addSeconds(" ~ op ~ "seconds);"); - } - - deprecated @safe unittest - { - // This probably only runs in cases where gettimeofday() is used, but it's - // hard to do this test correctly with variable ticksPerSec. - if (TickDuration.ticksPerSec == 1_000_000) - { - auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); - - assert(dt + TickDuration.from!"usecs"(7_000_000) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40))); - assert(dt + TickDuration.from!"usecs"(-7_000_000) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26))); - - assert(dt - TickDuration.from!"usecs"(-7_000_000) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40))); - assert(dt - TickDuration.from!"usecs"(7_000_000) == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26))); - } - } - /++ Gives the result of adding or subtracting a duration from this @@ -2198,19 +2172,14 @@ public: duration = The duration to add to or subtract from this $(LREF DateTime). +/ - ref DateTime opOpAssign(string op, D)(in D duration) @safe pure nothrow @nogc - if ((op == "+" || op == "-") && - (is(Unqual!D == Duration) || - is(Unqual!D == TickDuration))) + ref DateTime opOpAssign(string op)(Duration duration) @safe pure nothrow @nogc + if (op == "+" || op == "-") { + import core.time : convert; import std.format : format; DateTime retval = this; - - static if (is(Unqual!D == Duration)) - immutable hnsecs = duration.total!"hnsecs"; - else static if (is(Unqual!D == TickDuration)) - immutable hnsecs = duration.hnsecs; + immutable hnsecs = duration.total!"hnsecs"; mixin(format(`return _addSeconds(convert!("hnsecs", "seconds")(%shnsecs));`, op)); } @@ -2298,48 +2267,6 @@ public: static assert(!__traits(compiles, idt -= duration)); } - // Explicitly undocumented. It will be removed in January 2018. @@@DEPRECATED_2018-01@@@ - deprecated("Use Duration instead of TickDuration.") - ref DateTime opOpAssign(string op)(TickDuration td) @safe pure nothrow @nogc - if (op == "+" || op == "-") - { - DateTime retval = this; - immutable seconds = td.seconds; - mixin("return _addSeconds(" ~ op ~ "seconds);"); - } - - deprecated @safe unittest - { - // This probably only runs in cases where gettimeofday() is used, but it's - // hard to do this test correctly with variable ticksPerSec. - if (TickDuration.ticksPerSec == 1_000_000) - { - { - auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); - dt += TickDuration.from!"usecs"(7_000_000); - assert(dt == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40))); - } - - { - auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); - dt += TickDuration.from!"usecs"(-7_000_000); - assert(dt == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26))); - } - - { - auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); - dt -= TickDuration.from!"usecs"(-7_000_000); - assert(dt == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 40))); - } - - { - auto dt = DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 33)); - dt -= TickDuration.from!"usecs"(7_000_000); - assert(dt == DateTime(Date(1999, 7, 6), TimeOfDay(12, 30, 26))); - } - } - } - /++ Gives the difference between two $(LREF DateTime)s. @@ -6127,32 +6054,6 @@ public: assert(idate - duration == Date(1999, 6, 24)); } - // Explicitly undocumented. It will be removed in January 2018. @@@DEPRECATED_2018-01@@@ - deprecated("Use Duration instead of TickDuration.") - Date opBinary(string op)(TickDuration td) const @safe pure nothrow @nogc - if (op == "+" || op == "-") - { - Date retval = this; - immutable days = convert!("hnsecs", "days")(td.hnsecs); - mixin("return retval._addDays(" ~ op ~ "days);"); - } - - deprecated @safe unittest - { - // This probably only runs in cases where gettimeofday() is used, but it's - // hard to do this test correctly with variable ticksPerSec. - if (TickDuration.ticksPerSec == 1_000_000) - { - auto date = Date(1999, 7, 6); - - assert(date + TickDuration.from!"usecs"(86_400_000_000) == Date(1999, 7, 7)); - assert(date + TickDuration.from!"usecs"(-86_400_000_000) == Date(1999, 7, 5)); - - assert(date - TickDuration.from!"usecs"(-86_400_000_000) == Date(1999, 7, 7)); - assert(date - TickDuration.from!"usecs"(86_400_000_000) == Date(1999, 7, 5)); - } - } - /++ Gives the result of adding or subtracting a $(REF Duration, core,time) @@ -6234,47 +6135,6 @@ public: static assert(!__traits(compiles, idate -= duration)); } - // Explicitly undocumented. It will be removed in January 2018. @@@DEPRECATED_2018-01@@@ - deprecated("Use Duration instead of TickDuration.") - ref Date opOpAssign(string op)(TickDuration td) @safe pure nothrow @nogc - if (op == "+" || op == "-") - { - immutable days = convert!("seconds", "days")(td.seconds); - mixin("return _addDays(" ~ op ~ "days);"); - } - - deprecated @safe unittest - { - // This probably only runs in cases where gettimeofday() is used, but it's - // hard to do this test correctly with variable ticksPerSec. - if (TickDuration.ticksPerSec == 1_000_000) - { - { - auto date = Date(1999, 7, 6); - date += TickDuration.from!"usecs"(86_400_000_000); - assert(date == Date(1999, 7, 7)); - } - - { - auto date = Date(1999, 7, 6); - date += TickDuration.from!"usecs"(-86_400_000_000); - assert(date == Date(1999, 7, 5)); - } - - { - auto date = Date(1999, 7, 6); - date -= TickDuration.from!"usecs"(-86_400_000_000); - assert(date == Date(1999, 7, 7)); - } - - { - auto date = Date(1999, 7, 6); - date -= TickDuration.from!"usecs"(86_400_000_000); - assert(date == Date(1999, 7, 5)); - } - } - } - /++ Gives the difference between two $(LREF Date)s. @@ -8660,32 +8520,6 @@ public: assert(itod - duration == TimeOfDay(1, 30, 33)); } - // Explicitly undocumented. It will be removed in January 2018. @@@DEPRECATED_2018-01@@@ - deprecated("Use Duration instead of TickDuration.") - TimeOfDay opBinary(string op)(TickDuration td) const @safe pure nothrow @nogc - if (op == "+" || op == "-") - { - TimeOfDay retval = this; - immutable seconds = td.seconds; - mixin("return retval._addSeconds(" ~ op ~ "seconds);"); - } - - deprecated @safe unittest - { - // This probably only runs in cases where gettimeofday() is used, but it's - // hard to do this test correctly with variable ticksPerSec. - if (TickDuration.ticksPerSec == 1_000_000) - { - auto tod = TimeOfDay(12, 30, 33); - - assert(tod + TickDuration.from!"usecs"(7_000_000) == TimeOfDay(12, 30, 40)); - assert(tod + TickDuration.from!"usecs"(-7_000_000) == TimeOfDay(12, 30, 26)); - - assert(tod - TickDuration.from!"usecs"(-7_000_000) == TimeOfDay(12, 30, 40)); - assert(tod - TickDuration.from!"usecs"(7_000_000) == TimeOfDay(12, 30, 26)); - } - } - /++ Gives the result of adding or subtracting a $(REF Duration, core,time) @@ -8755,47 +8589,6 @@ public: static assert(!__traits(compiles, itod -= duration)); } - // Explicitly undocumented. It will be removed in January 2018. @@@DEPRECATED_2018-01@@@ - deprecated("Use Duration instead of TickDuration.") - ref TimeOfDay opOpAssign(string op)(TickDuration td) @safe pure nothrow @nogc - if (op == "+" || op == "-") - { - immutable seconds = td.seconds; - mixin("return _addSeconds(" ~ op ~ "seconds);"); - } - - deprecated @safe unittest - { - // This probably only runs in cases where gettimeofday() is used, but it's - // hard to do this test correctly with variable ticksPerSec. - if (TickDuration.ticksPerSec == 1_000_000) - { - { - auto tod = TimeOfDay(12, 30, 33); - tod += TickDuration.from!"usecs"(7_000_000); - assert(tod == TimeOfDay(12, 30, 40)); - } - - { - auto tod = TimeOfDay(12, 30, 33); - tod += TickDuration.from!"usecs"(-7_000_000); - assert(tod == TimeOfDay(12, 30, 26)); - } - - { - auto tod = TimeOfDay(12, 30, 33); - tod -= TickDuration.from!"usecs"(-7_000_000); - assert(tod == TimeOfDay(12, 30, 40)); - } - - { - auto tod = TimeOfDay(12, 30, 33); - tod -= TickDuration.from!"usecs"(7_000_000); - assert(tod == TimeOfDay(12, 30, 26)); - } - } - } - /++ Gives the difference between two $(LREF TimeOfDay)s. @@ -9771,12 +9564,8 @@ private: is(typeof(U.init -= Duration.init) == U) && is(typeof( { - // Until the overload with TickDuration is removed, this is ambiguous. - //alias add = U.opOpAssign!"+"; - //alias sub = U.opOpAssign!"-"; - U u; - auto ref add() { return u += Duration.init; } - auto ref sub() { return u -= Duration.init; } + alias add = U.opOpAssign!"+"; + alias sub = U.opOpAssign!"-"; alias FA = FunctionAttribute; static assert((functionAttributes!add & FA.ref_) != 0); static assert((functionAttributes!sub & FA.ref_) != 0); diff --git a/libphobos/src/std/datetime/stopwatch.d b/libphobos/src/std/datetime/stopwatch.d index 48e025bba0e..5d2a980afaf 100644 --- a/libphobos/src/std/datetime/stopwatch.d +++ b/libphobos/src/std/datetime/stopwatch.d @@ -403,10 +403,7 @@ Duration[fun.length] benchmark(fun...)(uint n) void f0() nothrow {} void f1() nothrow { auto b = to!string(a); } auto r = benchmark!(f0, f1)(1000); - version (GNU) - assert(r[0] >= Duration.zero); - else - assert(r[0] > Duration.zero); + assert(r[0] >= Duration.zero); assert(r[1] > Duration.zero); assert(r[1] > r[0]); assert(r[0] < seconds(1)); diff --git a/libphobos/src/std/datetime/systime.d b/libphobos/src/std/datetime/systime.d index a15c1250fc9..b8ef2eee760 100644 --- a/libphobos/src/std/datetime/systime.d +++ b/libphobos/src/std/datetime/systime.d @@ -262,34 +262,6 @@ public: } - // Explicitly undocumented. It will be removed in January 2018. @@@DEPRECATED_2018-01@@@ - deprecated("Use core.time.MonoTime.currTime instead") - static @property TickDuration currSystemTick() @safe nothrow - { - return TickDuration.currSystemTick; - } - - deprecated @safe unittest - { - assert(Clock.currSystemTick.length > 0); - } - - // Explicitly undocumented. It will be removed in January 2018. @@@DEPRECATED_2018-01@@@ - deprecated("Use core.time.MonoTime instead. See currAppTick's documentation for details.") - static @property TickDuration currAppTick() @safe - { - return currSystemTick - TickDuration.appOrigin; - } - - deprecated @safe unittest - { - auto a = Clock.currSystemTick; - auto b = Clock.currAppTick; - assert(a.length); - assert(b.length); - assert(a > b); - } - private: @disable this() {} @@ -448,51 +420,6 @@ public: assertThrown!DateTimeException(SysTime(DateTime.init, seconds(1), UTC())); } - // Explicitly undocumented. It will be removed in August 2017. @@@DEPRECATED_2017-08@@@ - deprecated("Please use the overload which takes a Duration instead of a FracSec.") - this(in DateTime dateTime, in FracSec fracSec, immutable TimeZone tz = null) @safe - { - immutable fracHNSecs = fracSec.hnsecs; - enforce(fracHNSecs >= 0, new DateTimeException("A SysTime cannot have negative fractional seconds.")); - _timezone = tz is null ? LocalTime() : tz; - - try - { - immutable dateDiff = (dateTime.date - Date(1, 1, 1)).total!"hnsecs"; - immutable todDiff = (dateTime.timeOfDay - TimeOfDay(0, 0, 0)).total!"hnsecs"; - - immutable adjustedTime = dateDiff + todDiff + fracHNSecs; - immutable standardTime = _timezone.tzToUTC(adjustedTime); - - this(standardTime, _timezone); - } - catch (Exception e) - assert(0, "Date, TimeOfDay, or DateTime's constructor threw when it shouldn't have."); - } - - deprecated @safe unittest - { - static void test(DateTime dt, FracSec fracSec, immutable TimeZone tz, long expected) - { - auto sysTime = SysTime(dt, fracSec, tz); - assert(sysTime._stdTime == expected); - assert(sysTime._timezone is (tz is null ? LocalTime() : tz), - format("Given DateTime: %s, Given FracSec: %s", dt, fracSec)); - } - - test(DateTime.init, FracSec.init, UTC(), 0); - test(DateTime(1, 1, 1, 12, 30, 33), FracSec.init, UTC(), 450_330_000_000L); - test(DateTime(0, 12, 31, 12, 30, 33), FracSec.init, UTC(), -413_670_000_000L); - test(DateTime(1, 1, 1, 0, 0, 0), FracSec.from!"msecs"(1), UTC(), 10_000L); - test(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"msecs"(999), UTC(), -10_000L); - - test(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(9_999_999), UTC(), -1); - test(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(1), UTC(), -9_999_999); - test(DateTime(0, 12, 31, 23, 59, 59), FracSec.from!"hnsecs"(0), UTC(), -10_000_000); - - assertThrown!DateTimeException(SysTime(DateTime.init, FracSec.from!"hnsecs"(-1), UTC())); - } - /++ Params: date = The $(REF Date,std,datetime,date) to use to set this @@ -1890,125 +1817,6 @@ public: } - // Explicitly undocumented. It will be removed in August 2017. @@@DEPRECATED_2017-08@@@ - deprecated("Please use fracSecs (with an s) rather than fracSec (without an s). " ~ - "It returns a Duration instead of a FracSec, as FracSec is being deprecated.") - @property FracSec fracSec() @safe const nothrow - { - try - { - auto hnsecs = removeUnitsFromHNSecs!"days"(adjTime); - - if (hnsecs < 0) - hnsecs += convert!("hours", "hnsecs")(24); - - hnsecs = removeUnitsFromHNSecs!"seconds"(hnsecs); - - return FracSec.from!"hnsecs"(cast(int) hnsecs); - } - catch (Exception e) - assert(0, "FracSec.from!\"hnsecs\"() threw."); - } - - deprecated @safe unittest - { - import std.range; - - static void test(SysTime sysTime, FracSec expected, size_t line = __LINE__) - { - if (sysTime.fracSec != expected) - throw new AssertError(format("Value given: %s", sysTime.fracSec), __FILE__, line); - } - - test(SysTime(0, UTC()), FracSec.from!"hnsecs"(0)); - test(SysTime(1, UTC()), FracSec.from!"hnsecs"(1)); - test(SysTime(-1, UTC()), FracSec.from!"hnsecs"(9_999_999)); - - foreach (tz; testTZs) - { - foreach (year; chain(testYearsBC, testYearsAD)) - { - foreach (md; testMonthDays) - { - foreach (hour; testHours) - { - foreach (minute; testMinSecs) - { - foreach (second; testMinSecs) - { - auto dt = DateTime(Date(year, md.month, md.day), TimeOfDay(hour, minute, second)); - foreach (fs; testFracSecs) - test(SysTime(dt, fs, tz), FracSec.from!"hnsecs"(fs.total!"hnsecs")); - } - } - } - } - } - } - - const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); - //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); - assert(cst.fracSec == FracSec.zero); - //assert(ist.fracSec == FracSec.zero); - } - - - // Explicitly undocumented. It will be removed in August 2017. @@@DEPRECATED_2017-08@@@ - deprecated("Please use fracSecs (with an s) rather than fracSec (without an s). " ~ - "It takes a Duration instead of a FracSec, as FracSec is being deprecated.") - @property void fracSec(FracSec fracSec) @safe - { - immutable fracHNSecs = fracSec.hnsecs; - enforce(fracHNSecs >= 0, new DateTimeException("A SysTime cannot have negative fractional seconds.")); - - auto hnsecs = adjTime; - auto days = splitUnitsFromHNSecs!"days"(hnsecs); - immutable daysHNSecs = convert!("days", "hnsecs")(days); - immutable negative = hnsecs < 0; - - if (negative) - hnsecs += convert!("hours", "hnsecs")(24); - - immutable hour = splitUnitsFromHNSecs!"hours"(hnsecs); - immutable minute = splitUnitsFromHNSecs!"minutes"(hnsecs); - immutable second = getUnitsFromHNSecs!"seconds"(hnsecs); - - hnsecs = fracHNSecs; - hnsecs += convert!("hours", "hnsecs")(hour); - hnsecs += convert!("minutes", "hnsecs")(minute); - hnsecs += convert!("seconds", "hnsecs")(second); - - if (negative) - hnsecs -= convert!("hours", "hnsecs")(24); - - adjTime = daysHNSecs + hnsecs; - } - - deprecated @safe unittest - { - import std.range; - - foreach (fracSec; testFracSecs) - { - foreach (st; chain(testSysTimesBC, testSysTimesAD)) - { - auto dt = cast(DateTime) st; - auto expected = SysTime(dt, fracSec, st.timezone); - st.fracSec = FracSec.from!"hnsecs"(fracSec.total!"hnsecs"); - assert(st == expected, format("[%s] [%s]", st, expected)); - } - } - - auto st = testSysTimesAD[0]; - assertThrown!DateTimeException(st.fracSec = FracSec.from!"hnsecs"(-1)); - - const cst = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); - //immutable ist = SysTime(DateTime(1999, 7, 6, 12, 30, 33)); - static assert(!__traits(compiles, cst.fracSec = FracSec.from!"msecs"(7))); - //static assert(!__traits(compiles, ist.fracSec = FracSec.from!"msecs"(7))); - } - - /++ The total hnsecs from midnight, January 1st, 1 A.D. UTC. This is the internal representation of $(LREF SysTime). @@ -6167,33 +5975,6 @@ public: //assert(ist - duration == SysTime(DateTime(1999, 7, 6, 12, 30, 21))); } - // Explicitly undocumented. It will be removed in January 2018. @@@DEPRECATED_2018-01@@@ - deprecated("Use Duration instead of TickDuration.") - SysTime opBinary(string op)(TickDuration td) @safe const pure nothrow - if (op == "+" || op == "-") - { - SysTime retval = SysTime(this._stdTime, this._timezone); - immutable hnsecs = td.hnsecs; - mixin("retval._stdTime " ~ op ~ "= hnsecs;"); - return retval; - } - - deprecated @safe unittest - { - // This probably only runs in cases where gettimeofday() is used, but it's - // hard to do this test correctly with variable ticksPerSec. - if (TickDuration.ticksPerSec == 1_000_000) - { - auto st = SysTime(DateTime(1999, 7, 6, 12, 30, 33), hnsecs(2_345_678)); - - assert(st + TickDuration.from!"usecs"(7) == SysTime(DateTime(1999, 7, 6, 12, 30, 33), hnsecs(2_345_748))); - assert(st + TickDuration.from!"usecs"(-7) == SysTime(DateTime(1999, 7, 6, 12, 30, 33), hnsecs(2_345_608))); - - assert(st - TickDuration.from!"usecs"(-7) == SysTime(DateTime(1999, 7, 6, 12, 30, 33), hnsecs(2_345_748))); - assert(st - TickDuration.from!"usecs"(7) == SysTime(DateTime(1999, 7, 6, 12, 30, 33), hnsecs(2_345_608))); - } - } - /++ Gives the result of adding or subtracting a $(REF Duration, core,time) from @@ -6397,46 +6178,6 @@ public: //static assert(!__traits(compiles, ist -= duration)); } - // Explicitly undocumented. It will be removed in January 2018. @@@DEPRECATED_2018-01@@@ - deprecated("Use Duration instead of TickDuration.") - ref SysTime opOpAssign(string op)(TickDuration td) @safe pure nothrow - if (op == "+" || op == "-") - { - immutable hnsecs = td.hnsecs; - mixin("_stdTime " ~ op ~ "= hnsecs;"); - return this; - } - - deprecated @safe unittest - { - // This probably only runs in cases where gettimeofday() is used, but it's - // hard to do this test correctly with variable ticksPerSec. - if (TickDuration.ticksPerSec == 1_000_000) - { - { - auto st = SysTime(DateTime(1999, 7, 6, 12, 30, 33), hnsecs(2_345_678)); - st += TickDuration.from!"usecs"(7); - assert(st == SysTime(DateTime(1999, 7, 6, 12, 30, 33), hnsecs(2_345_748))); - } - { - auto st = SysTime(DateTime(1999, 7, 6, 12, 30, 33), hnsecs(2_345_678)); - st += TickDuration.from!"usecs"(-7); - assert(st == SysTime(DateTime(1999, 7, 6, 12, 30, 33), hnsecs(2_345_608))); - } - - { - auto st = SysTime(DateTime(1999, 7, 6, 12, 30, 33), hnsecs(2_345_678)); - st -= TickDuration.from!"usecs"(-7); - assert(st == SysTime(DateTime(1999, 7, 6, 12, 30, 33), hnsecs(2_345_748))); - } - { - auto st = SysTime(DateTime(1999, 7, 6, 12, 30, 33), hnsecs(2_345_678)); - st -= TickDuration.from!"usecs"(7); - assert(st == SysTime(DateTime(1999, 7, 6, 12, 30, 33), hnsecs(2_345_608))); - } - } - } - /++ Gives the difference between two $(LREF SysTime)s. diff --git a/libphobos/src/std/datetime/timezone.d b/libphobos/src/std/datetime/timezone.d index fb06262a5d5..e923a34a98d 100644 --- a/libphobos/src/std/datetime/timezone.d +++ b/libphobos/src/std/datetime/timezone.d @@ -142,39 +142,6 @@ public: return dur!"hnsecs"(utcToTZ(stdTime) - stdTime); } - // Explicitly undocumented. It will be removed in June 2018. @@@DEPRECATED_2018-07@@@ - deprecated("Use PosixTimeZone.getTimeZone or WindowsTimeZone.getTimeZone instead") - static immutable(TimeZone) getTimeZone(string name) @safe - { - version (Posix) - return PosixTimeZone.getTimeZone(name); - else version (Windows) - { - import std.format : format; - auto windowsTZName = tzDatabaseNameToWindowsTZName(name); - if (windowsTZName != null) - { - try - return WindowsTimeZone.getTimeZone(windowsTZName); - catch (DateTimeException dte) - { - auto oldName = _getOldName(windowsTZName); - if (oldName != null) - return WindowsTimeZone.getTimeZone(oldName); - throw dte; - } - } - else - throw new DateTimeException(format("%s does not have an equivalent Windows time zone.", name)); - } - } - - /// - deprecated @safe unittest - { - auto tz = TimeZone.getTimeZone("America/Los_Angeles"); - } - // The purpose of this is to handle the case where a Windows time zone is // new and exists on an up-to-date Windows box but does not exist on Windows // boxes which have not been properly updated. The "date added" is included @@ -488,53 +455,6 @@ public: } - // Explicitly undocumented. It will be removed in June 2018. @@@DEPRECATED_2018-07@@@ - deprecated("Use PosixTimeZone.getInstalledTZNames or WindowsTimeZone.getInstalledTZNames instead") - static string[] getInstalledTZNames(string subName = "") @safe - { - version (Posix) - return PosixTimeZone.getInstalledTZNames(subName); - else version (Windows) - { - import std.algorithm.searching : startsWith; - import std.algorithm.sorting : sort; - import std.array : appender; - - auto windowsNames = WindowsTimeZone.getInstalledTZNames(); - auto retval = appender!(string[])(); - - foreach (winName; windowsNames) - { - auto tzName = windowsTZNameToTZDatabaseName(winName); - if (tzName !is null && tzName.startsWith(subName)) - retval.put(tzName); - } - - sort(retval.data); - return retval.data; - } - } - - deprecated @safe unittest - { - import std.exception : assertNotThrown; - import std.stdio : writefln; - static void testPZSuccess(string tzName) - { - scope(failure) writefln("TZName which threw: %s", tzName); - TimeZone.getTimeZone(tzName); - } - - auto tzNames = getInstalledTZNames(); - // This was not previously tested, and it's currently failing, so I'm - // leaving it commented out until I can sort it out. - //assert(equal(tzNames, tzNames.uniq())); - - foreach (tzName; tzNames) - assertNotThrown!DateTimeException(testPZSuccess(tzName)); - } - - protected: /++ @@ -3457,779 +3377,3 @@ For terms of use, see http://www.unicode.org/copyright.html assert(equal(value.uniq(), value), key); } } - - -// Explicitly undocumented. It will be removed in June 2018. @@@DEPRECATED_2018-07@@@ -deprecated("Use parseTZConversions instead") -string tzDatabaseNameToWindowsTZName(string tzName) @safe pure nothrow @nogc -{ - switch (tzName) - { - case "Africa/Abidjan": return "Greenwich Standard Time"; - case "Africa/Accra": return "Greenwich Standard Time"; - case "Africa/Addis_Ababa": return "E. Africa Standard Time"; - case "Africa/Algiers": return "W. Central Africa Standard Time"; - case "Africa/Asmera": return "E. Africa Standard Time"; - case "Africa/Bamako": return "Greenwich Standard Time"; - case "Africa/Bangui": return "W. Central Africa Standard Time"; - case "Africa/Banjul": return "Greenwich Standard Time"; - case "Africa/Bissau": return "Greenwich Standard Time"; - case "Africa/Blantyre": return "South Africa Standard Time"; - case "Africa/Brazzaville": return "W. Central Africa Standard Time"; - case "Africa/Bujumbura": return "South Africa Standard Time"; - case "Africa/Cairo": return "Egypt Standard Time"; - case "Africa/Casablanca": return "Morocco Standard Time"; - case "Africa/Ceuta": return "Romance Standard Time"; - case "Africa/Conakry": return "Greenwich Standard Time"; - case "Africa/Dakar": return "Greenwich Standard Time"; - case "Africa/Dar_es_Salaam": return "E. Africa Standard Time"; - case "Africa/Djibouti": return "E. Africa Standard Time"; - case "Africa/Douala": return "W. Central Africa Standard Time"; - case "Africa/El_Aaiun": return "Morocco Standard Time"; - case "Africa/Freetown": return "Greenwich Standard Time"; - case "Africa/Gaborone": return "South Africa Standard Time"; - case "Africa/Harare": return "South Africa Standard Time"; - case "Africa/Johannesburg": return "South Africa Standard Time"; - case "Africa/Juba": return "E. Africa Standard Time"; - case "Africa/Kampala": return "E. Africa Standard Time"; - case "Africa/Khartoum": return "E. Africa Standard Time"; - case "Africa/Kigali": return "South Africa Standard Time"; - case "Africa/Kinshasa": return "W. Central Africa Standard Time"; - case "Africa/Lagos": return "W. Central Africa Standard Time"; - case "Africa/Libreville": return "W. Central Africa Standard Time"; - case "Africa/Lome": return "Greenwich Standard Time"; - case "Africa/Luanda": return "W. Central Africa Standard Time"; - case "Africa/Lubumbashi": return "South Africa Standard Time"; - case "Africa/Lusaka": return "South Africa Standard Time"; - case "Africa/Malabo": return "W. Central Africa Standard Time"; - case "Africa/Maputo": return "South Africa Standard Time"; - case "Africa/Maseru": return "South Africa Standard Time"; - case "Africa/Mbabane": return "South Africa Standard Time"; - case "Africa/Mogadishu": return "E. Africa Standard Time"; - case "Africa/Monrovia": return "Greenwich Standard Time"; - case "Africa/Nairobi": return "E. Africa Standard Time"; - case "Africa/Ndjamena": return "W. Central Africa Standard Time"; - case "Africa/Niamey": return "W. Central Africa Standard Time"; - case "Africa/Nouakchott": return "Greenwich Standard Time"; - case "Africa/Ouagadougou": return "Greenwich Standard Time"; - case "Africa/Porto-Novo": return "W. Central Africa Standard Time"; - case "Africa/Sao_Tome": return "Greenwich Standard Time"; - case "Africa/Tripoli": return "Libya Standard Time"; - case "Africa/Tunis": return "W. Central Africa Standard Time"; - case "Africa/Windhoek": return "Namibia Standard Time"; - case "America/Adak": return "Aleutian Standard Time"; - case "America/Anchorage": return "Alaskan Standard Time"; - case "America/Anguilla": return "SA Western Standard Time"; - case "America/Antigua": return "SA Western Standard Time"; - case "America/Araguaina": return "SA Eastern Standard Time"; - case "America/Argentina/La_Rioja": return "Argentina Standard Time"; - case "America/Argentina/Rio_Gallegos": return "Argentina Standard Time"; - case "America/Argentina/Salta": return "Argentina Standard Time"; - case "America/Argentina/San_Juan": return "Argentina Standard Time"; - case "America/Argentina/San_Luis": return "Argentina Standard Time"; - case "America/Argentina/Tucuman": return "Argentina Standard Time"; - case "America/Argentina/Ushuaia": return "Argentina Standard Time"; - case "America/Arguaina": return "Tocantins Standard Time"; - case "America/Aruba": return "SA Western Standard Time"; - case "America/Asuncion": return "Paraguay Standard Time"; - case "America/Bahia": return "Bahia Standard Time"; - case "America/Bahia_Banderas": return "Central Standard Time (Mexico)"; - case "America/Barbados": return "SA Western Standard Time"; - case "America/Belem": return "SA Eastern Standard Time"; - case "America/Belize": return "Central America Standard Time"; - case "America/Blanc-Sablon": return "SA Western Standard Time"; - case "America/Boa_Vista": return "SA Western Standard Time"; - case "America/Bogota": return "SA Pacific Standard Time"; - case "America/Boise": return "Mountain Standard Time"; - case "America/Buenos_Aires": return "Argentina Standard Time"; - case "America/Cambridge_Bay": return "Mountain Standard Time"; - case "America/Campo_Grande": return "Central Brazilian Standard Time"; - case "America/Cancun": return "Eastern Standard Time (Mexico)"; - case "America/Caracas": return "Venezuela Standard Time"; - case "America/Catamarca": return "Argentina Standard Time"; - case "America/Cayenne": return "SA Eastern Standard Time"; - case "America/Cayman": return "SA Pacific Standard Time"; - case "America/Chicago": return "Central Standard Time"; - case "America/Chihuahua": return "Mountain Standard Time (Mexico)"; - case "America/Coral_Harbour": return "SA Pacific Standard Time"; - case "America/Cordoba": return "Argentina Standard Time"; - case "America/Costa_Rica": return "Central America Standard Time"; - case "America/Creston": return "US Mountain Standard Time"; - case "America/Cuiaba": return "Central Brazilian Standard Time"; - case "America/Curacao": return "SA Western Standard Time"; - case "America/Danmarkshavn": return "UTC"; - case "America/Dawson": return "Pacific Standard Time"; - case "America/Dawson_Creek": return "US Mountain Standard Time"; - case "America/Denver": return "Mountain Standard Time"; - case "America/Detroit": return "Eastern Standard Time"; - case "America/Dominica": return "SA Western Standard Time"; - case "America/Edmonton": return "Mountain Standard Time"; - case "America/Eirunepe": return "SA Pacific Standard Time"; - case "America/El_Salvador": return "Central America Standard Time"; - case "America/Fortaleza": return "SA Eastern Standard Time"; - case "America/Glace_Bay": return "Atlantic Standard Time"; - case "America/Godthab": return "Greenland Standard Time"; - case "America/Goose_Bay": return "Atlantic Standard Time"; - case "America/Grand_Turk": return "Turks And Caicos Standard Time"; - case "America/Grenada": return "SA Western Standard Time"; - case "America/Guadeloupe": return "SA Western Standard Time"; - case "America/Guatemala": return "Central America Standard Time"; - case "America/Guayaquil": return "SA Pacific Standard Time"; - case "America/Guyana": return "SA Western Standard Time"; - case "America/Halifax": return "Atlantic Standard Time"; - case "America/Havana": return "Cuba Standard Time"; - case "America/Hermosillo": return "US Mountain Standard Time"; - case "America/Indiana/Knox": return "Central Standard Time"; - case "America/Indiana/Marengo": return "US Eastern Standard Time"; - case "America/Indiana/Petersburg": return "Eastern Standard Time"; - case "America/Indiana/Tell_City": return "Central Standard Time"; - case "America/Indiana/Vevay": return "US Eastern Standard Time"; - case "America/Indiana/Vincennes": return "Eastern Standard Time"; - case "America/Indiana/Winamac": return "Eastern Standard Time"; - case "America/Indianapolis": return "US Eastern Standard Time"; - case "America/Inuvik": return "Mountain Standard Time"; - case "America/Iqaluit": return "Eastern Standard Time"; - case "America/Jamaica": return "SA Pacific Standard Time"; - case "America/Jujuy": return "Argentina Standard Time"; - case "America/Juneau": return "Alaskan Standard Time"; - case "America/Kentucky/Monticello": return "Eastern Standard Time"; - case "America/Kralendijk": return "SA Western Standard Time"; - case "America/La_Paz": return "SA Western Standard Time"; - case "America/Lima": return "SA Pacific Standard Time"; - case "America/Los_Angeles": return "Pacific Standard Time"; - case "America/Louisville": return "Eastern Standard Time"; - case "America/Lower_Princes": return "SA Western Standard Time"; - case "America/Maceio": return "SA Eastern Standard Time"; - case "America/Managua": return "Central America Standard Time"; - case "America/Manaus": return "SA Western Standard Time"; - case "America/Marigot": return "SA Western Standard Time"; - case "America/Martinique": return "SA Western Standard Time"; - case "America/Matamoros": return "Central Standard Time"; - case "America/Mazatlan": return "Mountain Standard Time (Mexico)"; - case "America/Mendoza": return "Argentina Standard Time"; - case "America/Menominee": return "Central Standard Time"; - case "America/Merida": return "Central Standard Time (Mexico)"; - case "America/Mexico_City": return "Central Standard Time (Mexico)"; - case "America/Miquelon": return "Saint Pierre Standard Time"; - case "America/Moncton": return "Atlantic Standard Time"; - case "America/Monterrey": return "Central Standard Time (Mexico)"; - case "America/Montevideo": return "Montevideo Standard Time"; - case "America/Montreal": return "Eastern Standard Time"; - case "America/Montserrat": return "SA Western Standard Time"; - case "America/Nassau": return "Eastern Standard Time"; - case "America/New_York": return "Eastern Standard Time"; - case "America/Nipigon": return "Eastern Standard Time"; - case "America/Nome": return "Alaskan Standard Time"; - case "America/Noronha": return "UTC-02"; - case "America/North_Dakota/Beulah": return "Central Standard Time"; - case "America/North_Dakota/Center": return "Central Standard Time"; - case "America/North_Dakota/New_Salem": return "Central Standard Time"; - case "America/Ojinaga": return "Mountain Standard Time"; - case "America/Panama": return "SA Pacific Standard Time"; - case "America/Pangnirtung": return "Eastern Standard Time"; - case "America/Paramaribo": return "SA Eastern Standard Time"; - case "America/Phoenix": return "US Mountain Standard Time"; - case "America/Port-au-Prince": return "Haiti Standard Time"; - case "America/Port_of_Spain": return "SA Western Standard Time"; - case "America/Porto_Velho": return "SA Western Standard Time"; - case "America/Puerto_Rico": return "SA Western Standard Time"; - case "America/Rainy_River": return "Central Standard Time"; - case "America/Rankin_Inlet": return "Central Standard Time"; - case "America/Recife": return "SA Eastern Standard Time"; - case "America/Regina": return "Canada Central Standard Time"; - case "America/Resolute": return "Central Standard Time"; - case "America/Rio_Branco": return "SA Pacific Standard Time"; - case "America/Santa_Isabel": return "Pacific Standard Time (Mexico)"; - case "America/Santarem": return "SA Eastern Standard Time"; - case "America/Santiago": return "Pacific SA Standard Time"; - case "America/Santo_Domingo": return "SA Western Standard Time"; - case "America/Sao_Paulo": return "E. South America Standard Time"; - case "America/Scoresbysund": return "Azores Standard Time"; - case "America/Sitka": return "Alaskan Standard Time"; - case "America/St_Barthelemy": return "SA Western Standard Time"; - case "America/St_Johns": return "Newfoundland Standard Time"; - case "America/St_Kitts": return "SA Western Standard Time"; - case "America/St_Lucia": return "SA Western Standard Time"; - case "America/St_Thomas": return "SA Western Standard Time"; - case "America/St_Vincent": return "SA Western Standard Time"; - case "America/Swift_Current": return "Canada Central Standard Time"; - case "America/Tegucigalpa": return "Central America Standard Time"; - case "America/Thule": return "Atlantic Standard Time"; - case "America/Thunder_Bay": return "Eastern Standard Time"; - case "America/Tijuana": return "Pacific Standard Time"; - case "America/Toronto": return "Eastern Standard Time"; - case "America/Tortola": return "SA Western Standard Time"; - case "America/Vancouver": return "Pacific Standard Time"; - case "America/Whitehorse": return "Pacific Standard Time"; - case "America/Winnipeg": return "Central Standard Time"; - case "America/Yakutat": return "Alaskan Standard Time"; - case "America/Yellowknife": return "Mountain Standard Time"; - case "Antarctica/Casey": return "W. Australia Standard Time"; - case "Antarctica/Davis": return "SE Asia Standard Time"; - case "Antarctica/DumontDUrville": return "West Pacific Standard Time"; - case "Antarctica/Macquarie": return "Central Pacific Standard Time"; - case "Antarctica/Mawson": return "West Asia Standard Time"; - case "Antarctica/McMurdo": return "New Zealand Standard Time"; - case "Antarctica/Palmer": return "Pacific SA Standard Time"; - case "Antarctica/Rothera": return "SA Eastern Standard Time"; - case "Antarctica/Syowa": return "E. Africa Standard Time"; - case "Antarctica/Vostok": return "Central Asia Standard Time"; - case "Arctic/Longyearbyen": return "W. Europe Standard Time"; - case "Asia/Aden": return "Arab Standard Time"; - case "Asia/Almaty": return "Central Asia Standard Time"; - case "Asia/Amman": return "Jordan Standard Time"; - case "Asia/Anadyr": return "Russia Time Zone 11"; - case "Asia/Aqtau": return "West Asia Standard Time"; - case "Asia/Aqtobe": return "West Asia Standard Time"; - case "Asia/Ashgabat": return "West Asia Standard Time"; - case "Asia/Baghdad": return "Arabic Standard Time"; - case "Asia/Bahrain": return "Arab Standard Time"; - case "Asia/Baku": return "Azerbaijan Standard Time"; - case "Asia/Bangkok": return "SE Asia Standard Time"; - case "Asia/Barnaul": return "Altai Standard Time"; - case "Asia/Beirut": return "Middle East Standard Time"; - case "Asia/Bishkek": return "Central Asia Standard Time"; - case "Asia/Brunei": return "Singapore Standard Time"; - case "Asia/Calcutta": return "India Standard Time"; - case "Asia/Chita": return "Transbaikal Standard Time"; - case "Asia/Choibalsan": return "Ulaanbaatar Standard Time"; - case "Asia/Colombo": return "Sri Lanka Standard Time"; - case "Asia/Damascus": return "Syria Standard Time"; - case "Asia/Dhaka": return "Bangladesh Standard Time"; - case "Asia/Dili": return "Tokyo Standard Time"; - case "Asia/Dubai": return "Arabian Standard Time"; - case "Asia/Dushanbe": return "West Asia Standard Time"; - case "Asia/Hebron": return "West Bank Standard Time"; - case "Asia/Hong_Kong": return "China Standard Time"; - case "Asia/Hovd": return "W. Mongolia Standard Time"; - case "Asia/Irkutsk": return "North Asia East Standard Time"; - case "Asia/Jakarta": return "SE Asia Standard Time"; - case "Asia/Jayapura": return "Tokyo Standard Time"; - case "Asia/Jerusalem": return "Israel Standard Time"; - case "Asia/Kabul": return "Afghanistan Standard Time"; - case "Asia/Kamchatka": return "Russia Time Zone 11"; - case "Asia/Karachi": return "Pakistan Standard Time"; - case "Asia/Katmandu": return "Nepal Standard Time"; - case "Asia/Khandyga": return "Yakutsk Standard Time"; - case "Asia/Krasnoyarsk": return "North Asia Standard Time"; - case "Asia/Kuala_Lumpur": return "Singapore Standard Time"; - case "Asia/Kuching": return "Singapore Standard Time"; - case "Asia/Kuwait": return "Arab Standard Time"; - case "Asia/Macau": return "China Standard Time"; - case "Asia/Magadan": return "Magadan Standard Time"; - case "Asia/Makassar": return "Singapore Standard Time"; - case "Asia/Manila": return "Singapore Standard Time"; - case "Asia/Muscat": return "Arabian Standard Time"; - case "Asia/Nicosia": return "GTB Standard Time"; - case "Asia/Novokuznetsk": return "North Asia Standard Time"; - case "Asia/Novosibirsk": return "N. Central Asia Standard Time"; - case "Asia/Omsk": return "N. Central Asia Standard Time"; - case "Asia/Oral": return "West Asia Standard Time"; - case "Asia/Phnom_Penh": return "SE Asia Standard Time"; - case "Asia/Pontianak": return "SE Asia Standard Time"; - case "Asia/Pyongyang": return "North Korea Standard Time"; - case "Asia/Qatar": return "Arab Standard Time"; - case "Asia/Qyzylorda": return "Central Asia Standard Time"; - case "Asia/Rangoon": return "Myanmar Standard Time"; - case "Asia/Riyadh": return "Arab Standard Time"; - case "Asia/Saigon": return "SE Asia Standard Time"; - case "Asia/Sakhalin": return "Sakhalin Standard Time"; - case "Asia/Samarkand": return "West Asia Standard Time"; - case "Asia/Seoul": return "Korea Standard Time"; - case "Asia/Shanghai": return "China Standard Time"; - case "Asia/Singapore": return "Singapore Standard Time"; - case "Asia/Srednekolymsk": return "Russia Time Zone 10"; - case "Asia/Taipei": return "Taipei Standard Time"; - case "Asia/Tashkent": return "West Asia Standard Time"; - case "Asia/Tbilisi": return "Georgian Standard Time"; - case "Asia/Tehran": return "Iran Standard Time"; - case "Asia/Thimphu": return "Bangladesh Standard Time"; - case "Asia/Tokyo": return "Tokyo Standard Time"; - case "Asia/Tomsk": return "Tomsk Standard Time"; - case "Asia/Ulaanbaatar": return "Ulaanbaatar Standard Time"; - case "Asia/Urumqi": return "Central Asia Standard Time"; - case "Asia/Ust-Nera": return "Vladivostok Standard Time"; - case "Asia/Vientiane": return "SE Asia Standard Time"; - case "Asia/Vladivostok": return "Vladivostok Standard Time"; - case "Asia/Yakutsk": return "Yakutsk Standard Time"; - case "Asia/Yekaterinburg": return "Ekaterinburg Standard Time"; - case "Asia/Yerevan": return "Caucasus Standard Time"; - case "Atlantic/Azores": return "Azores Standard Time"; - case "Atlantic/Bermuda": return "Atlantic Standard Time"; - case "Atlantic/Canary": return "GMT Standard Time"; - case "Atlantic/Cape_Verde": return "Cape Verde Standard Time"; - case "Atlantic/Faeroe": return "GMT Standard Time"; - case "Atlantic/Madeira": return "GMT Standard Time"; - case "Atlantic/Reykjavik": return "Greenwich Standard Time"; - case "Atlantic/South_Georgia": return "UTC-02"; - case "Atlantic/St_Helena": return "Greenwich Standard Time"; - case "Atlantic/Stanley": return "SA Eastern Standard Time"; - case "Australia/Adelaide": return "Cen. Australia Standard Time"; - case "Australia/Brisbane": return "E. Australia Standard Time"; - case "Australia/Broken_Hill": return "Cen. Australia Standard Time"; - case "Australia/Currie": return "Tasmania Standard Time"; - case "Australia/Darwin": return "AUS Central Standard Time"; - case "Australia/Eucla": return "Aus Central W. Standard Time"; - case "Australia/Hobart": return "Tasmania Standard Time"; - case "Australia/Lindeman": return "E. Australia Standard Time"; - case "Australia/Lord_Howe": return "Lord Howe Standard Time"; - case "Australia/Melbourne": return "AUS Eastern Standard Time"; - case "Australia/Perth": return "W. Australia Standard Time"; - case "Australia/Sydney": return "AUS Eastern Standard Time"; - case "CST6CDT": return "Central Standard Time"; - case "EST5EDT": return "Eastern Standard Time"; - case "Etc/GMT": return "UTC"; - case "Etc/GMT+1": return "Cape Verde Standard Time"; - case "Etc/GMT+10": return "Hawaiian Standard Time"; - case "Etc/GMT+11": return "UTC-11"; - case "Etc/GMT+12": return "Dateline Standard Time"; - case "Etc/GMT+2": return "UTC-02"; - case "Etc/GMT+3": return "SA Eastern Standard Time"; - case "Etc/GMT+4": return "SA Western Standard Time"; - case "Etc/GMT+5": return "SA Pacific Standard Time"; - case "Etc/GMT+6": return "Central America Standard Time"; - case "Etc/GMT+7": return "US Mountain Standard Time"; - case "Etc/GMT+8": return "UTC-08"; - case "Etc/GMT+9": return "UTC-09"; - case "Etc/GMT-1": return "W. Central Africa Standard Time"; - case "Etc/GMT-10": return "West Pacific Standard Time"; - case "Etc/GMT-11": return "Central Pacific Standard Time"; - case "Etc/GMT-12": return "UTC+12"; - case "Etc/GMT-13": return "Tonga Standard Time"; - case "Etc/GMT-14": return "Line Islands Standard Time"; - case "Etc/GMT-2": return "South Africa Standard Time"; - case "Etc/GMT-3": return "E. Africa Standard Time"; - case "Etc/GMT-4": return "Arabian Standard Time"; - case "Etc/GMT-5": return "West Asia Standard Time"; - case "Etc/GMT-6": return "Central Asia Standard Time"; - case "Etc/GMT-7": return "SE Asia Standard Time"; - case "Etc/GMT-8": return "Singapore Standard Time"; - case "Etc/GMT-9": return "Tokyo Standard Time"; - case "Europe/Amsterdam": return "W. Europe Standard Time"; - case "Europe/Andorra": return "W. Europe Standard Time"; - case "Europe/Astrakhan": return "Astrakhan Standard Time"; - case "Europe/Athens": return "GTB Standard Time"; - case "Europe/Belgrade": return "Central Europe Standard Time"; - case "Europe/Berlin": return "W. Europe Standard Time"; - case "Europe/Bratislava": return "Central Europe Standard Time"; - case "Europe/Brussels": return "Romance Standard Time"; - case "Europe/Bucharest": return "GTB Standard Time"; - case "Europe/Budapest": return "Central Europe Standard Time"; - case "Europe/Busingen": return "W. Europe Standard Time"; - case "Europe/Chisinau": return "GTB Standard Time"; - case "Europe/Copenhagen": return "Romance Standard Time"; - case "Europe/Dublin": return "GMT Standard Time"; - case "Europe/Gibraltar": return "W. Europe Standard Time"; - case "Europe/Guernsey": return "GMT Standard Time"; - case "Europe/Helsinki": return "FLE Standard Time"; - case "Europe/Isle_of_Man": return "GMT Standard Time"; - case "Europe/Istanbul": return "Turkey Standard Time"; - case "Europe/Jersey": return "GMT Standard Time"; - case "Europe/Kaliningrad": return "Kaliningrad Standard Time"; - case "Europe/Kiev": return "FLE Standard Time"; - case "Europe/Lisbon": return "GMT Standard Time"; - case "Europe/Ljubljana": return "Central Europe Standard Time"; - case "Europe/London": return "GMT Standard Time"; - case "Europe/Luxembourg": return "W. Europe Standard Time"; - case "Europe/Madrid": return "Romance Standard Time"; - case "Europe/Malta": return "W. Europe Standard Time"; - case "Europe/Mariehamn": return "FLE Standard Time"; - case "Europe/Minsk": return "Belarus Standard Time"; - case "Europe/Monaco": return "W. Europe Standard Time"; - case "Europe/Moscow": return "Russian Standard Time"; - case "Europe/Oslo": return "W. Europe Standard Time"; - case "Europe/Paris": return "Romance Standard Time"; - case "Europe/Podgorica": return "Central Europe Standard Time"; - case "Europe/Prague": return "Central Europe Standard Time"; - case "Europe/Riga": return "FLE Standard Time"; - case "Europe/Rome": return "W. Europe Standard Time"; - case "Europe/Samara": return "Russia Time Zone 3"; - case "Europe/San_Marino": return "W. Europe Standard Time"; - case "Europe/Sarajevo": return "Central European Standard Time"; - case "Europe/Simferopol": return "Russian Standard Time"; - case "Europe/Skopje": return "Central European Standard Time"; - case "Europe/Sofia": return "FLE Standard Time"; - case "Europe/Stockholm": return "W. Europe Standard Time"; - case "Europe/Tallinn": return "FLE Standard Time"; - case "Europe/Tirane": return "Central Europe Standard Time"; - case "Europe/Uzhgorod": return "FLE Standard Time"; - case "Europe/Vaduz": return "W. Europe Standard Time"; - case "Europe/Vatican": return "W. Europe Standard Time"; - case "Europe/Vienna": return "W. Europe Standard Time"; - case "Europe/Vilnius": return "FLE Standard Time"; - case "Europe/Volgograd": return "Russian Standard Time"; - case "Europe/Warsaw": return "Central European Standard Time"; - case "Europe/Zagreb": return "Central European Standard Time"; - case "Europe/Zaporozhye": return "FLE Standard Time"; - case "Europe/Zurich": return "W. Europe Standard Time"; - case "Indian/Antananarivo": return "E. Africa Standard Time"; - case "Indian/Chagos": return "Central Asia Standard Time"; - case "Indian/Christmas": return "SE Asia Standard Time"; - case "Indian/Cocos": return "Myanmar Standard Time"; - case "Indian/Comoro": return "E. Africa Standard Time"; - case "Indian/Kerguelen": return "West Asia Standard Time"; - case "Indian/Mahe": return "Mauritius Standard Time"; - case "Indian/Maldives": return "West Asia Standard Time"; - case "Indian/Mauritius": return "Mauritius Standard Time"; - case "Indian/Mayotte": return "E. Africa Standard Time"; - case "Indian/Reunion": return "Mauritius Standard Time"; - case "MST7MDT": return "Mountain Standard Time"; - case "PST8PDT": return "Pacific Standard Time"; - case "Pacific/Apia": return "Samoa Standard Time"; - case "Pacific/Auckland": return "New Zealand Standard Time"; - case "Pacific/Bougainville": return "Bougainville Standard Time"; - case "Pacific/Chatham": return "Chatham Islands Standard Time"; - case "Pacific/Easter": return "Easter Island Standard Time"; - case "Pacific/Efate": return "Central Pacific Standard Time"; - case "Pacific/Enderbury": return "Tonga Standard Time"; - case "Pacific/Fakaofo": return "Tonga Standard Time"; - case "Pacific/Fiji": return "Fiji Standard Time"; - case "Pacific/Funafuti": return "UTC+12"; - case "Pacific/Galapagos": return "Central America Standard Time"; - case "Pacific/Guadalcanal": return "Central Pacific Standard Time"; - case "Pacific/Guam": return "West Pacific Standard Time"; - case "Pacific/Honolulu": return "Hawaiian Standard Time"; - case "Pacific/Johnston": return "Hawaiian Standard Time"; - case "Pacific/Kiritimati": return "Line Islands Standard Time"; - case "Pacific/Kosrae": return "Central Pacific Standard Time"; - case "Pacific/Kwajalein": return "UTC+12"; - case "Pacific/Majuro": return "UTC+12"; - case "Pacific/Marquesas": return "Marquesas Standard Time"; - case "Pacific/Midway": return "UTC-11"; - case "Pacific/Nauru": return "UTC+12"; - case "Pacific/Niue": return "UTC-11"; - case "Pacific/Noumea": return "Central Pacific Standard Time"; - case "Pacific/Norfolk": return "Norfolk Standard Time"; - case "Pacific/Pago_Pago": return "UTC-11"; - case "Pacific/Palau": return "Tokyo Standard Time"; - case "Pacific/Ponape": return "Central Pacific Standard Time"; - case "Pacific/Port_Moresby": return "West Pacific Standard Time"; - case "Pacific/Rarotonga": return "Hawaiian Standard Time"; - case "Pacific/Saipan": return "West Pacific Standard Time"; - case "Pacific/Tahiti": return "Hawaiian Standard Time"; - case "Pacific/Tarawa": return "UTC+12"; - case "Pacific/Tongatapu": return "Tonga Standard Time"; - case "Pacific/Truk": return "West Pacific Standard Time"; - case "Pacific/Wake": return "UTC+12"; - case "Pacific/Wallis": return "UTC+12"; - default: return null; - } -} - -version (Windows) version (UpdateWindowsTZTranslations) deprecated @system unittest -{ - import std.stdio : stderr; - - foreach (tzName; TimeZone.getInstalledTZNames()) - { - if (tzDatabaseNameToWindowsTZName(tzName) is null) - stderr.writeln("Missing TZName to Windows translation: ", tzName); - } -} - - -// Explicitly undocumented. It will be removed in June 2018. @@@DEPRECATED_2018-07@@@ -deprecated("Use parseTZConversions instead") -string windowsTZNameToTZDatabaseName(string tzName) @safe pure nothrow @nogc -{ - switch (tzName) - { - case "AUS Central Standard Time": return "Australia/Darwin"; - case "AUS Eastern Standard Time": return "Australia/Sydney"; - case "Aus Central W. Standard Time": return "Australia/Eucla"; - case "Afghanistan Standard Time": return "Asia/Kabul"; - case "Haiti Standard Time": return "America/Port-au-Prince"; - case "Alaskan Standard Time": return "America/Anchorage"; - case "Aleutian Standard Time": return "America/Adak"; - case "Altai Standard Time": return "Asia/Barnaul"; - case "Arab Standard Time": return "Asia/Riyadh"; - case "Arabian Standard Time": return "Asia/Dubai"; - case "Arabic Standard Time": return "Asia/Baghdad"; - case "Argentina Standard Time": return "America/Buenos_Aires"; - case "Astrakhan Standard Time": return "Europe/Astrakhan"; - case "Atlantic Standard Time": return "America/Halifax"; - case "Azerbaijan Standard Time": return "Asia/Baku"; - case "Azores Standard Time": return "Atlantic/Azores"; - case "Bahia Standard Time": return "America/Bahia"; - case "Bangladesh Standard Time": return "Asia/Dhaka"; - case "Belarus Standard Time": return "Europe/Minsk"; - case "Bougainville Standard Time": return "Pacific/Bougainville"; - case "Canada Central Standard Time": return "America/Regina"; - case "Cape Verde Standard Time": return "Atlantic/Cape_Verde"; - case "Caucasus Standard Time": return "Asia/Yerevan"; - case "Cen. Australia Standard Time": return "Australia/Adelaide"; - case "Central America Standard Time": return "America/Guatemala"; - case "Central Asia Standard Time": return "Asia/Almaty"; - case "Central Brazilian Standard Time": return "America/Cuiaba"; - case "Central Europe Standard Time": return "Europe/Budapest"; - case "Central European Standard Time": return "Europe/Warsaw"; - case "Central Pacific Standard Time": return "Pacific/Guadalcanal"; - case "Central Standard Time": return "America/Chicago"; - case "Central Standard Time (Mexico)": return "America/Mexico_City"; - case "Chatham Islands Standard Time": return "Pacific/Chatham"; - case "China Standard Time": return "Asia/Shanghai"; - case "Cuba Standard Time": return "America/Havana"; - case "Dateline Standard Time": return "Etc/GMT+12"; - case "E. Africa Standard Time": return "Africa/Nairobi"; - case "E. Australia Standard Time": return "Australia/Brisbane"; - // This doesn't appear to be in the current stuff from MS, but the autotester - // is failing without it (probably because its time zone data hasn't been - // updated recently enough). - case "E. Europe Standard Time": return "Europe/Minsk"; - case "E. South America Standard Time": return "America/Sao_Paulo"; - case "Easter Island Standard Time": return "Pacific/Easter"; - case "Eastern Standard Time": return "America/New_York"; - case "Eastern Standard Time (Mexico)": return "America/Cancun"; - case "Egypt Standard Time": return "Africa/Cairo"; - case "Ekaterinburg Standard Time": return "Asia/Yekaterinburg"; - case "FLE Standard Time": return "Europe/Kiev"; - case "Fiji Standard Time": return "Pacific/Fiji"; - case "GMT Standard Time": return "Europe/London"; - case "GTB Standard Time": return "Europe/Athens"; - case "Georgian Standard Time": return "Asia/Tbilisi"; - case "Greenland Standard Time": return "America/Godthab"; - case "Greenwich Standard Time": return "Atlantic/Reykjavik"; - case "Hawaiian Standard Time": return "Pacific/Honolulu"; - case "India Standard Time": return "Asia/Calcutta"; - case "Iran Standard Time": return "Asia/Tehran"; - case "Israel Standard Time": return "Asia/Jerusalem"; - case "Jordan Standard Time": return "Asia/Amman"; - case "Kaliningrad Standard Time": return "Europe/Kaliningrad"; - // Same as with E. Europe Standard Time. - case "Kamchatka Standard Time": return "Asia/Kamchatka"; - case "Korea Standard Time": return "Asia/Seoul"; - case "Libya Standard Time": return "Africa/Tripoli"; - case "Line Islands Standard Time": return "Pacific/Kiritimati"; - case "Lord Howe Standard Time": return "Australia/Lord_Howe"; - case "Magadan Standard Time": return "Asia/Magadan"; - case "Marquesas Standard Time": return "Pacific/Marquesas"; - case "Mauritius Standard Time": return "Indian/Mauritius"; - // Same as with E. Europe Standard Time. - case "Mexico Standard Time": return "America/Mexico_City"; - // Same as with E. Europe Standard Time. - case "Mexico Standard Time 2": return "America/Chihuahua"; - // Same as with E. Europe Standard Time. - case "Mid-Atlantic Standard Time": return "Etc/GMT+2"; - case "Middle East Standard Time": return "Asia/Beirut"; - case "Montevideo Standard Time": return "America/Montevideo"; - case "Morocco Standard Time": return "Africa/Casablanca"; - case "Mountain Standard Time": return "America/Denver"; - case "Mountain Standard Time (Mexico)": return "America/Chihuahua"; - case "Myanmar Standard Time": return "Asia/Rangoon"; - case "N. Central Asia Standard Time": return "Asia/Novosibirsk"; - case "Namibia Standard Time": return "Africa/Windhoek"; - case "Nepal Standard Time": return "Asia/Katmandu"; - case "New Zealand Standard Time": return "Pacific/Auckland"; - case "Newfoundland Standard Time": return "America/St_Johns"; - case "Norfolk Standard Time": return "Pacific/Norfolk"; - case "North Asia East Standard Time": return "Asia/Irkutsk"; - case "North Asia Standard Time": return "Asia/Krasnoyarsk"; - case "North Korea Standard Time": return "Asia/Pyongyang"; - case "Pacific SA Standard Time": return "America/Santiago"; - case "Pacific Standard Time": return "America/Los_Angeles"; - case "Pacific Standard Time (Mexico)": return "America/Santa_Isabel"; - case "Pakistan Standard Time": return "Asia/Karachi"; - case "Paraguay Standard Time": return "America/Asuncion"; - case "Romance Standard Time": return "Europe/Paris"; - case "Russia Time Zone 10": return "Asia/Srednekolymsk"; - case "Russia Time Zone 11": return "Asia/Anadyr"; - case "Russia Time Zone 3": return "Europe/Samara"; - case "Russian Standard Time": return "Europe/Moscow"; - case "SA Eastern Standard Time": return "America/Cayenne"; - case "SA Pacific Standard Time": return "America/Bogota"; - case "SA Western Standard Time": return "America/La_Paz"; - case "SE Asia Standard Time": return "Asia/Bangkok"; - case "Sakhalin Standard Time": return "Asia/Sakhalin"; - case "Saint Pierre Standard Time": return "America/Miquelon"; - case "Samoa Standard Time": return "Pacific/Apia"; - case "Singapore Standard Time": return "Asia/Singapore"; - case "South Africa Standard Time": return "Africa/Johannesburg"; - case "Sri Lanka Standard Time": return "Asia/Colombo"; - case "Syria Standard Time": return "Asia/Damascus"; - case "Taipei Standard Time": return "Asia/Taipei"; - case "Tasmania Standard Time": return "Australia/Hobart"; - case "Tocantins Standard Time": return "America/Arguaina"; - case "Tokyo Standard Time": return "Asia/Tokyo"; - case "Tomsk Standard Time": return "Asia/Tomsk"; - case "Tonga Standard Time": return "Pacific/Tongatapu"; - case "Transbaikal Standard Time": return "Asia/Chita"; - case "Turkey Standard Time": return "Europe/Istanbul"; - case "Turks And Caicos Standard Time": return "America/Grand_Turk"; - case "US Eastern Standard Time": return "America/Indianapolis"; - case "US Mountain Standard Time": return "America/Phoenix"; - case "UTC": return "Etc/GMT"; - case "UTC+12": return "Etc/GMT-12"; - case "UTC-02": return "Etc/GMT+2"; - case "UTC-08": return "Etc/GMT+8"; - case "UTC-09": return "Etc/GMT+9"; - case "UTC-11": return "Etc/GMT+11"; - case "Ulaanbaatar Standard Time": return "Asia/Ulaanbaatar"; - case "Venezuela Standard Time": return "America/Caracas"; - case "Vladivostok Standard Time": return "Asia/Vladivostok"; - case "W. Australia Standard Time": return "Australia/Perth"; - case "W. Central Africa Standard Time": return "Africa/Lagos"; - case "W. Europe Standard Time": return "Europe/Berlin"; - case "W. Mongolia Standard Time": return "Asia/Hovd"; - case "West Asia Standard Time": return "Asia/Tashkent"; - case "West Bank Standard Time": return "Asia/Hebron"; - case "West Pacific Standard Time": return "Pacific/Port_Moresby"; - case "Yakutsk Standard Time": return "Asia/Yakutsk"; - default: return null; - } -} - -version (Windows) version (UpdateWindowsTZTranslations) deprecated @system unittest -{ - import std.stdio : stderr; - - foreach (winName; WindowsTimeZone.getInstalledTZNames()) - { - if (windowsTZNameToTZDatabaseName(winName) is null) - stderr.writeln("Missing Windows to TZName translation: ", winName); - } -} - - -// This script is for regenerating tzDatabaseNameToWindowsTZName and -// windowsTZNameToTZDatabaseName from -// http://unicode.org/cldr/data/common/supplemental/windowsZones.xml - -/+ -#!/bin/rdmd - -import std.algorithm; -import std.array; -import std.conv; -import std.datetime; -import std.exception; -import std.path; -import std.stdio; -import std.string; - -int main(string[] args) -{ - if (args.length != 4 || args[1].baseName != "windowsZones.xml") - { - stderr.writeln("genTZs.d windowsZones.xml "); - return -1; - } - - string[][string] win2Nix; - string[][string] nix2Win; - immutable f1 = ` %s", nix, wins)); - - // We'll try to eliminate multiples by favoring a conversion if it's already - // in Phobos, but if it's new, then the correct one will have to be chosen - // manually from the results. - string[] haveMultiple; - foreach (win, nixes; win2Nix) - { - if (nixes.length > 1) - haveMultiple ~= win; - } - bool[string] haveConflicts; - foreach (win; haveMultiple) - { - if (auto curr = windowsTZNameToTZDatabaseName(win)) - { - if (auto other = curr in nix2Win) - { - if ((*other)[0] == win) - { - win2Nix[win] = [curr]; - continue; - } - } - } - haveConflicts[win] = true; - writefln("Warning: %s -> %s", win, win2Nix[win]); - } - - - string[] nix2WinLines = [ - `string tzDatabaseNameToWindowsTZName(string tzName) @safe pure nothrow @nogc`, - `{`, - ` switch (tzName)`, - ` {`]; - - foreach (nix; nix2Win.keys.sort()) - nix2WinLines ~= format(` case "%s": return "%s";`, nix, nix2Win[nix][0]); - - nix2WinLines ~= [ - ` default: return null;`, - ` }`, - `}`]; - - - string[] win2NixLines = [ - `string windowsTZNameToTZDatabaseName(string tzName) @safe pure nothrow @nogc`, - `{`, - ` switch (tzName)`, - ` {`]; - foreach (win; win2Nix.keys.sort()) - { - immutable hasMultiple = cast(bool)(win in haveConflicts); - foreach (nix; win2Nix[win]) - win2NixLines ~= format(` case "%s": return "%s";%s`, win, nix, hasMultiple ? " FIXME" : ""); - } - - win2NixLines ~= [ - ` default: return null;`, - ` }`, - `}`]; - - - auto nix2WinFile = args[2]; - std.file.write(nix2WinFile, nix2WinLines.join("\n")); - - auto win2NixFile = args[3]; - std.file.write(win2NixFile, win2NixLines.join("\n")); - - return 0; -} -+/ diff --git a/libphobos/src/std/internal/windows/advapi32.d b/libphobos/src/std/internal/windows/advapi32.d index b25956bf078..9ed67629df0 100644 --- a/libphobos/src/std/internal/windows/advapi32.d +++ b/libphobos/src/std/internal/windows/advapi32.d @@ -14,8 +14,7 @@ version (Windows): import core.sys.windows.windows; -version (GNU) {} -else pragma(lib, "advapi32.lib"); +pragma(lib, "advapi32.lib"); immutable bool isWow64; diff --git a/libphobos/src/std/json.d b/libphobos/src/std/json.d index fd6cf41968c..8ba0f05f782 100644 --- a/libphobos/src/std/json.d +++ b/libphobos/src/std/json.d @@ -1123,14 +1123,6 @@ if (isInputRange!T && !isInfinite!T && isSomeChar!(ElementEncodingType!T)) return parseJSON!T(json, -1, options); } -deprecated( - "Please use the overload that takes a ref JSONValue rather than a pointer. This overload will " - ~ "be removed in November 2017.") -string toJSON(in JSONValue* root, in bool pretty = false, in JSONOptions options = JSONOptions.none) @safe -{ - return toJSON(*root, pretty, options); -} - /** Takes a tree of JSON values and returns the serialized string. diff --git a/libphobos/src/std/process.d b/libphobos/src/std/process.d index 6571d471517..a1cac2c9fdf 100644 --- a/libphobos/src/std/process.d +++ b/libphobos/src/std/process.d @@ -3966,8 +3966,7 @@ version (Windows) { import core.sys.windows.windows; - version (GNU) {} - else pragma(lib,"shell32.lib"); + pragma(lib,"shell32.lib"); void browse(const(char)[] url) { diff --git a/libphobos/src/std/range/primitives.d b/libphobos/src/std/range/primitives.d index d602048b2ae..1a4e6fb2b91 100644 --- a/libphobos/src/std/range/primitives.d +++ b/libphobos/src/std/range/primitives.d @@ -1388,41 +1388,13 @@ This is because a narrow string's length does not reflect the number of characters, but instead the number of encoding units, and as such is not useful with range-oriented algorithms. To use strings as random-access ranges with length, use $(REF representation, std, string) or $(REF byCodeUnit, std, utf). - -Deprecation: Historically `hasLength!R` yielded `true` for types whereby -`R.length` returns other types convertible to `ulong`, such as `int`, `ushort`, -`const(size_t)`, user-defined types using `alias this`, or notably `ulong` on -32-bit systems. This behavior has been deprecated. After December 2017, -`hasLength` will yield `true` only if `R.length` yields the exact type `size_t`. */ template hasLength(R) { static if (is(typeof(((R* r) => r.length)(null)) Length)) - { - static if (is(Length == size_t)) - { - enum bool hasLength = !isNarrowString!R; - } - else static if (is(Length : ulong)) - { - // @@@DEPRECATED_2017-12@@@ - // Uncomment the deprecated(...) message and take the pragma(msg) - // out once https://issues.dlang.org/show_bug.cgi?id=10181 is fixed. - pragma(msg, __FILE__ ~ "(" ~ __LINE__.stringof ~ - "): Note: length must have type size_t on all systems" ~ - ", please update your code by December 2017."); - //deprecated("length must have type size_t on all systems") - enum bool hasLength = true; - } - else - { - enum bool hasLength = false; - } - } + enum bool hasLength = is(Length == size_t) && !isNarrowString!R; else - { enum bool hasLength = false; - } } /// @@ -1432,12 +1404,41 @@ template hasLength(R) static assert( hasLength!(int[])); static assert( hasLength!(inout(int)[])); - struct A { ulong length; } - struct B { size_t length() { return 0; } } - struct C { @property size_t length() { return 0; } } + struct A { size_t length() { return 0; } } + struct B { @property size_t length() { return 0; } } static assert( hasLength!(A)); static assert( hasLength!(B)); - static assert( hasLength!(C)); +} + +// test combinations which are invalid on some platforms +unittest +{ + struct A { ulong length; } + struct B { @property uint length() { return 0; } } + + version (X86) + { + static assert(!hasLength!(A)); + static assert(hasLength!(B)); + } + else version(X86_64) + { + static assert(hasLength!(A)); + static assert(!hasLength!(B)); + } +} + +// test combinations which are invalid on all platforms +unittest +{ + struct A { long length; } + struct B { int length; } + struct C { ubyte length; } + struct D { char length; } + static assert(!hasLength!(A)); + static assert(!hasLength!(B)); + static assert(!hasLength!(C)); + static assert(!hasLength!(D)); } /** diff --git a/libphobos/src/std/socket.d b/libphobos/src/std/socket.d index c008d62c9a4..78479c85b58 100644 --- a/libphobos/src/std/socket.d +++ b/libphobos/src/std/socket.d @@ -57,12 +57,8 @@ import std.internal.cstring; version (Windows) { - version (GNU) {} - else - { - pragma (lib, "ws2_32.lib"); - pragma (lib, "wsock32.lib"); - } + pragma (lib, "ws2_32.lib"); + pragma (lib, "wsock32.lib"); import core.sys.windows.windows, std.windows.syserror; public import core.sys.windows.winsock2; diff --git a/libphobos/src/std/string.d b/libphobos/src/std/string.d index 34a1452a536..5b61cde4ac1 100644 --- a/libphobos/src/std/string.d +++ b/libphobos/src/std/string.d @@ -5174,30 +5174,8 @@ body assert(buffer.data == "h5 rd"); } -//@@@DEPRECATED_2018-05@@@ -/*********************************************** - * $(RED This function is deprecated and will be removed May 2018.) - * Please use the functions in $(MREF std, regex) and $(MREF std, algorithm) - * instead. If you still need this function, it will be available in - * $(LINK2 https://github.com/dlang/undeaD, undeaD). - * - * See if character c is in the pattern. - * Patterns: - * - * A $(I pattern) is an array of characters much like a $(I character - * class) in regular expressions. A sequence of characters - * can be given, such as "abcde". The '-' can represent a range - * of characters, as "a-e" represents the same pattern as "abcde". - * "a-fA-F0-9" represents all the hex characters. - * If the first character of a pattern is '^', then the pattern - * is negated, i.e. "^0-9" means any character except a digit. - * The functions inPattern, $(B countchars), $(B removeschars), - * and $(B squeeze) use patterns. - * - * Note: In the future, the pattern syntax may be improved - * to be more like regular expression character classes. - */ -deprecated("This function is obsolete and will be removed May 2018. See the docs for more details") +//@@@DEPRECATED_2.086@@@ +deprecated("This function is obsolete. It is available in https://github.com/dlang/undeaD if necessary.") bool inPattern(S)(dchar c, in S pattern) @safe pure @nogc if (isSomeString!S) { @@ -5262,16 +5240,8 @@ deprecated }); } -//@@@DEPRECATED_2018-05@@@ -/*********************************************** - * $(RED This function is deprecated and will be removed May 2018.) - * Please use the functions in $(MREF std, regex) and $(MREF std, algorithm) - * instead. If you still need this function, it will be available in - * $(LINK2 https://github.com/dlang/undeaD, undeaD). - * - * See if character c is in the intersection of the patterns. - */ -deprecated("This function is obsolete and will be removed May 2018. See the docs for more details") +//@@@DEPRECATED_2.086@@@ +deprecated("This function is obsolete. It is available in https://github.com/dlang/undeaD if necessary.") bool inPattern(S)(dchar c, S[] patterns) @safe pure @nogc if (isSomeString!S) { @@ -5285,16 +5255,8 @@ if (isSomeString!S) return true; } -//@@@DEPRECATED_2018-05@@@ -/******************************************** - * $(RED This function is deprecated and will be removed May 2018.) - * Please use the functions in $(MREF std, regex) and $(MREF std, algorithm) - * instead. If you still need this function, it will be available in - * $(LINK2 https://github.com/dlang/undeaD, undeaD). - * - * Count characters in s that match pattern. - */ -deprecated("This function is obsolete and will be removed May 2018. See the docs for more details") +//@@@DEPRECATED_2.086@@@ +deprecated("This function is obsolete. It is available in https://github.com/dlang/undeaD if necessary.") size_t countchars(S, S1)(S s, in S1 pattern) @safe pure @nogc if (isSomeString!S && isSomeString!S1) { @@ -5319,16 +5281,8 @@ deprecated }); } -//@@@DEPRECATED_2018-05@@@ -/******************************************** - * $(RED This function is deprecated and will be removed May 2018.) - * Please use the functions in $(MREF std, regex) and $(MREF std, algorithm) - * instead. If you still need this function, it will be available in - * $(LINK2 https://github.com/dlang/undeaD, undeaD). - * - * Return string that is s with all characters removed that match pattern. - */ -deprecated("This function is obsolete and will be removed May 2018. See the docs for more details") +//@@@DEPRECATED_2.086@@@ +deprecated("This function is obsolete. It is available in https://github.com/dlang/undeaD if necessary.") S removechars(S)(S s, in S pattern) @safe pure if (isSomeString!S) { @@ -5380,18 +5334,8 @@ deprecated assert(removechars("abc", "x") == "abc"); } -//@@@DEPRECATED_2018-05@@@ -/*************************************************** - * $(RED This function is deprecated and will be removed May 2018.) - * Please use the functions in $(MREF std, regex) and $(MREF std, algorithm) - * instead. If you still need this function, it will be available in - * $(LINK2 https://github.com/dlang/undeaD, undeaD). - * - * Return string where sequences of a character in s[] from pattern[] - * are replaced with a single instance of that character. - * If pattern is null, it defaults to all characters. - */ -deprecated("This function is obsolete and will be removed May 2018. See the docs for more details") +//@@@DEPRECATED_2.086@@@ +deprecated("This function is obsolete. It is available in https://github.com/dlang/undeaD if necessary.") S squeeze(S)(S s, in S pattern = null) { import std.utf : encode, stride; @@ -5456,24 +5400,8 @@ deprecated }); } -//@@@DEPRECATED_2018-05@@@ -/*************************************************************** - $(RED This function is deprecated and will be removed May 2018.) - Please use the functions in $(MREF std, regex) and $(MREF std, algorithm) - instead. If you still need this function, it will be available in - $(LINK2 https://github.com/dlang/undeaD, undeaD). - - Finds the position $(D_PARAM pos) of the first character in $(D_PARAM - s) that does not match $(D_PARAM pattern) (in the terminology used by - $(REF inPattern, std,string)). Updates $(D_PARAM s = - s[pos..$]). Returns the slice from the beginning of the original - (before update) string up to, and excluding, $(D_PARAM pos). - -The $(D_PARAM munch) function is mostly convenient for skipping -certain category of characters (e.g. whitespace) when parsing -strings. (In such cases, the return value is not used.) - */ -deprecated("This function is obsolete and will be removed May 2018. See the docs for more details") +//@@@DEPRECATED_2.086@@@ +deprecated("This function is obsolete. It is available in https://github.com/dlang/undeaD if necessary.") S1 munch(S1, S2)(ref S1 s, S2 pattern) @safe pure @nogc { size_t j = s.length; diff --git a/libphobos/src/std/utf.d b/libphobos/src/std/utf.d index 63ae7363686..beb4d8fc4a3 100644 --- a/libphobos/src/std/utf.d +++ b/libphobos/src/std/utf.d @@ -2699,14 +2699,6 @@ if (isSomeString!S) }()); } -//@@@DEPRECATED_2017-10@@@ -deprecated("To be removed November 2017. Please use std.utf.encode instead.") -char[] toUTF8(return out char[4] buf, dchar c) nothrow @nogc @safe pure -{ - const sz = encode!(Yes.useReplacementDchar)(buf, c); - return buf[0 .. sz]; -} - /** * Encodes the elements of `s` to UTF-8 and returns a newly allocated * string of the elements. @@ -2748,14 +2740,6 @@ if (isInputRange!S && !isInfinite!S && isSomeChar!(ElementEncodingType!S)) assert(r2.toUTF8.equal([0xF0, 0x90, 0x90, 0xB7])); } -//@@@DEPRECATED_2017-10@@@ -deprecated("To be removed November 2017. Please use std.utf.encode instead.") -wchar[] toUTF16(return ref wchar[2] buf, dchar c) nothrow @nogc @safe pure -{ - const sz = encode!(Yes.useReplacementDchar)(buf, c); - return buf[0 .. sz]; -} - /** * Encodes the elements of `s` to UTF-16 and returns a newly GC allocated * `wstring` of the elements.