diff options
author | Iain Buclaw <ibuclaw@gdcproject.org> | 2025-01-06 22:12:03 +0100 |
---|---|---|
committer | Iain Buclaw <ibuclaw@gdcproject.org> | 2025-01-10 23:40:53 +0100 |
commit | a7ae0c31245a7db7abf2e80d0016510afe9c8ad0 (patch) | |
tree | 8668f3071f30b2d55e83e1785757dffb14829552 /libphobos/src/std/datetime | |
parent | 086031c058598512d09bf898e4db3735b3e1f22c (diff) | |
download | gcc-a7ae0c31245a7db7abf2e80d0016510afe9c8ad0.zip gcc-a7ae0c31245a7db7abf2e80d0016510afe9c8ad0.tar.gz gcc-a7ae0c31245a7db7abf2e80d0016510afe9c8ad0.tar.bz2 |
d: Merge dmd, druntime 6884b433d2, phobos 48d581a1f
D front-end changes:
- It's now deprecated to declare `auto ref' parameters without
putting those two keywords next to each other.
- An error is now given for case fallthough for multivalued
cases.
- An error is now given for constructors with field destructors
with stricter attributes.
- An error is now issued for `in'/`out' contracts of `nothrow'
functions that may throw.
- `auto ref' can now be applied to local, static, extern, and
global variables.
D runtime changes:
- Import latest fixes from druntime v2.110.0-beta.1.
Phobos changes:
- Import latest fixes from phobos v2.110.0-beta.1.
gcc/d/ChangeLog:
* dmd/MERGE: Merge upstream dmd 6884b433d2.
* d-builtins.cc (build_frontend_type): Update for new front-end
interface.
(d_build_builtins_module): Likewise.
(matches_builtin_type): Likewise.
(covariant_with_builtin_type_p): Likewise.
* d-codegen.cc (lower_struct_comparison): Likewise.
(call_side_effect_free_p): Likewise.
* d-compiler.cc (Compiler::paintAsType): Likewise.
* d-convert.cc (convert_expr): Likewise.
(convert_for_assignment): Likewise.
* d-target.cc (Target::isVectorTypeSupported): Likewise.
(Target::isVectorOpSupported): Likewise.
(Target::isReturnOnStack): Likewise.
* decl.cc (get_symbol_decl): Likewise.
* expr.cc (build_return_dtor): Likewise.
* imports.cc (class ImportVisitor): Likewise.
* toir.cc (class IRVisitor): Likewise.
* types.cc (class TypeVisitor): Likewise.
libphobos/ChangeLog:
* libdruntime/MERGE: Merge upstream druntime 6884b433d2.
* src/MERGE: Merge upstream phobos 48d581a1f.
Diffstat (limited to 'libphobos/src/std/datetime')
-rw-r--r-- | libphobos/src/std/datetime/date.d | 40 | ||||
-rw-r--r-- | libphobos/src/std/datetime/systime.d | 18 |
2 files changed, 32 insertions, 26 deletions
diff --git a/libphobos/src/std/datetime/date.d b/libphobos/src/std/datetime/date.d index 7526f2d..c757b1e 100644 --- a/libphobos/src/std/datetime/date.d +++ b/libphobos/src/std/datetime/date.d @@ -3161,10 +3161,10 @@ public: auto str = strip(isoString); - enforce(str.length >= 15, new DateTimeException(format("Invalid ISO String: %s", isoString))); + enforce!DateTimeException(str.length >= 15, format("Invalid format for DateTime.fromISOString %s", isoString)); auto t = str.byCodeUnit.countUntil('T'); - enforce(t != -1, new DateTimeException(format("Invalid ISO String: %s", isoString))); + enforce!DateTimeException(t != -1, format("Invalid format for DateTime.fromISOString: %s", isoString)); immutable date = Date.fromISOString(str[0 .. t]); immutable tod = TimeOfDay.fromISOString(str[t+1 .. $]); @@ -3262,10 +3262,11 @@ public: auto str = strip(isoExtString); - enforce(str.length >= 15, new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString))); + enforce!DateTimeException(str.length >= 15, + format("Invalid format for DateTime.fromISOExtString: %s", isoExtString)); auto t = str.byCodeUnit.countUntil('T'); - enforce(t != -1, new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString))); + enforce!DateTimeException(t != -1, format("Invalid format for DateTime.fromISOExtString: %s", isoExtString)); immutable date = Date.fromISOExtString(str[0 .. t]); immutable tod = TimeOfDay.fromISOExtString(str[t+1 .. $]); @@ -3362,10 +3363,11 @@ public: auto str = strip(simpleString); - enforce(str.length >= 15, new DateTimeException(format("Invalid string format: %s", simpleString))); + enforce!DateTimeException(str.length >= 15, + format("Invalid format for DateTime.fromSimpleString: %s", simpleString)); auto t = str.byCodeUnit.countUntil(' '); - enforce(t != -1, new DateTimeException(format("Invalid string format: %s", simpleString))); + enforce!DateTimeException(t != -1, format("Invalid format for DateTime.fromSimpleString: %s", simpleString)); immutable date = Date.fromSimpleString(str[0 .. t]); immutable tod = TimeOfDay.fromISOExtString(str[t+1 .. $]); @@ -7628,7 +7630,7 @@ public: auto str = isoString.strip; - enforce!DateTimeException(str.length >= 8, text("Invalid ISO String: ", isoString)); + enforce!DateTimeException(str.length >= 8, text("Invalid format for Date.fromISOString: ", isoString)); int day, month, year; auto yearStr = str[0 .. $ - 4]; @@ -7643,7 +7645,7 @@ public: if (yearStr.length > 4) { enforce!DateTimeException(yearStr.startsWith('-', '+'), - text("Invalid ISO String: ", isoString)); + text("Invalid format for Date.fromISOString: ", isoString)); year = to!int(yearStr); } else @@ -7653,7 +7655,7 @@ public: } catch (ConvException) { - throw new DateTimeException(text("Invalid ISO String: ", isoString)); + throw new DateTimeException(text("Invalid format for Date.fromISOString: ", isoString)); } return Date(year, month, day); @@ -7774,13 +7776,13 @@ public: ubyte month, day; if (str.length < 10 || str[$-3] != '-' || str[$-6] != '-') - throw new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString)); + throw new DateTimeException(format("Invalid format for Date.fromISOExtString: %s", isoExtString)); auto yearStr = str[0 .. $-6]; auto signAtBegining = cast(bool) yearStr.startsWith('-', '+'); if ((yearStr.length > 4) != signAtBegining) { - throw new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString)); + throw new DateTimeException(format("Invalid format for Date.fromISOExtString: %s", isoExtString)); } try @@ -7791,7 +7793,7 @@ public: } catch (ConvException) { - throw new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString)); + throw new DateTimeException(format("Invalid format for Date.fromISOExtString: %s", isoExtString)); } return Date(year, month, day); @@ -7910,7 +7912,7 @@ public: auto str = strip(simpleString); if (str.length < 11 || str[$-3] != '-' || str[$-7] != '-') - throw new DateTimeException(format!"Invalid string format: %s"(simpleString)); + throw new DateTimeException(format!"Invalid format for Date.fromSimpleString: %s"(simpleString)); int year; uint day; @@ -7919,7 +7921,7 @@ public: auto signAtBegining = cast(bool) yearStr.startsWith('-', '+'); if ((yearStr.length > 4) != signAtBegining) { - throw new DateTimeException(format!"Invalid string format: %s"(simpleString)); + throw new DateTimeException(format!"Invalid format for Date.fromSimpleString: %s"(simpleString)); } try @@ -7929,7 +7931,7 @@ public: } catch (ConvException) { - throw new DateTimeException(format!"Invalid string format: %s"(simpleString)); + throw new DateTimeException(format!"Invalid format for Date.fromSimpleString: %s"(simpleString)); } return Date(year, month, day); @@ -9208,7 +9210,7 @@ public: int hours, minutes, seconds; auto str = strip(isoString); - enforce!DateTimeException(str.length == 6, text("Invalid ISO String: ", isoString)); + enforce!DateTimeException(str.length == 6, text("Invalid format for TimeOfDay.fromISOString: ", isoString)); try { @@ -9220,7 +9222,7 @@ public: } catch (ConvException) { - throw new DateTimeException(text("Invalid ISO String: ", isoString)); + throw new DateTimeException(text("Invalid format for TimeOfDay.fromISOString: ", isoString)); } return TimeOfDay(hours, minutes, seconds); @@ -9333,7 +9335,7 @@ public: int hours, minutes, seconds; if (str.length != 8 || str[2] != ':' || str[5] != ':') - throw new DateTimeException(text("Invalid ISO Extended String: ", isoExtString)); + throw new DateTimeException(text("Invalid format for TimeOfDay.fromISOExtString: ", isoExtString)); try { @@ -9345,7 +9347,7 @@ public: } catch (ConvException) { - throw new DateTimeException(text("Invalid ISO Extended String: ", isoExtString)); + throw new DateTimeException(text("Invalid format for TimeOfDay.fromISOExtString: ", isoExtString)); } return TimeOfDay(hours, minutes, seconds); diff --git a/libphobos/src/std/datetime/systime.d b/libphobos/src/std/datetime/systime.d index a1d8ef3..a2e52ae 100644 --- a/libphobos/src/std/datetime/systime.d +++ b/libphobos/src/std/datetime/systime.d @@ -8879,7 +8879,7 @@ public: return retval; } catch (DateTimeException dte) - throw new DateTimeException(format("Invalid ISO String: %s", isoString)); + throw new DateTimeException(format("Invalid format for SysTime.fromISOString: %s", isoString)); } /// @@ -9109,7 +9109,8 @@ public: auto str = strip(isoExtString); auto tIndex = str.indexOf('T'); - enforce(tIndex != -1, new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString))); + enforce!DateTimeException(tIndex != -1, + format("Invalid format for SysTime.fromISOExtString: %s", isoExtString)); auto found = str[tIndex + 1 .. $].find('.', 'Z', '+', '-'); auto dateTimeStr = str[0 .. $ - found[0].length]; @@ -9157,7 +9158,7 @@ public: return retval; } catch (DateTimeException dte) - throw new DateTimeException(format("Invalid ISO Extended String: %s", isoExtString)); + throw new DateTimeException(format("Invalid format for SysTime.fromISOExtString: %s", isoExtString)); } /// @@ -9359,7 +9360,8 @@ public: auto str = strip(simpleString); auto spaceIndex = str.indexOf(' '); - enforce(spaceIndex != -1, new DateTimeException(format("Invalid Simple String: %s", simpleString))); + enforce!DateTimeException(spaceIndex != -1, + format("Invalid format for SysTime.fromSimpleString: %s", simpleString)); auto found = str[spaceIndex + 1 .. $].find('.', 'Z', '+', '-'); auto dateTimeStr = str[0 .. $ - found[0].length]; @@ -9407,7 +9409,7 @@ public: return retval; } catch (DateTimeException dte) - throw new DateTimeException(format("Invalid Simple String: %s", simpleString)); + throw new DateTimeException(format("Invalid format for SysTime.fromSimpleString: %s", simpleString)); } /// @@ -11170,6 +11172,7 @@ if (isSomeString!S) import std.algorithm.searching : all; import std.ascii : isDigit; import std.conv : to; + import std.format : format; import std.string : representation; if (isoString.empty) @@ -11177,10 +11180,11 @@ if (isSomeString!S) auto str = isoString.representation; - enforce(str[0] == '.', new DateTimeException("Invalid ISO String")); + enforce!DateTimeException(str[0] == '.', format("Invalid format for fracSecsFromISOString: %s", isoString)); str.popFront(); - enforce(!str.empty && all!isDigit(str), new DateTimeException("Invalid ISO String")); + enforce!DateTimeException(!str.empty && all!isDigit(str), + format("Invalid format for fracSecsFromISOString: %s", isoString)); dchar[7] fullISOString = void; foreach (i, ref dchar c; fullISOString) |