From 109dddb649f6c13f5700f0a35315dfa3e2c93b44 Mon Sep 17 00:00:00 2001 From: Dennis Date: Fri, 10 May 2024 17:02:53 +0200 Subject: [PATCH 1/7] Fix error message in deprecation-limit.dd (#16471) --- changelog/dmd.deprecation-limit.dd | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/changelog/dmd.deprecation-limit.dd b/changelog/dmd.deprecation-limit.dd index fc3364c087f7..a61060bbbc02 100644 --- a/changelog/dmd.deprecation-limit.dd +++ b/changelog/dmd.deprecation-limit.dd @@ -19,8 +19,8 @@ void main() $(CONSOLE > dmd -verrors=3 app.d -app.d(7): Deprecation: function `deprecationlimit.x` is deprecated -app.d(8): Deprecation: function `deprecationlimit.x` is deprecated -app.d(9): Deprecation: function `deprecationlimit.x` is deprecated +app.d(7): Deprecation: function `app.f` is deprecated +app.d(8): Deprecation: function `app.f` is deprecated +app.d(9): Deprecation: function `app.f` is deprecated 1 deprecation warning omitted, use `-verrors=0` to show all ) From 23f6757be95a0bf930ab090c72e5b46d773cdecd Mon Sep 17 00:00:00 2001 From: Nick Treleaven Date: Fri, 10 May 2024 16:03:18 +0100 Subject: [PATCH 2/7] Add changelog for #16334 (#16470) --- changelog/dmd.foreach-array-index-type.dd | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 changelog/dmd.foreach-array-index-type.dd diff --git a/changelog/dmd.foreach-array-index-type.dd b/changelog/dmd.foreach-array-index-type.dd new file mode 100644 index 000000000000..df1a415ce5bc --- /dev/null +++ b/changelog/dmd.foreach-array-index-type.dd @@ -0,0 +1,12 @@ +`foreach` on a dynamic array can have an index type smaller than `size_t` + +The array length is known at compile-time for the following cases: + +* The array is a literal +* The array is a slice expression whose upper bound is known at + compile-time + +For an array `a`, the index type can be any integer type `I` where +`a.length <= I.max`. + +Other cases [are not implemented](https://issues.dlang.org/show_bug.cgi?id=24542) yet. From cc66e60109fb99b0983b908ebd70f1a7f9499d76 Mon Sep 17 00:00:00 2001 From: Johan Engelen Date: Sun, 19 May 2024 12:09:09 +0200 Subject: [PATCH 3/7] Fix bugzilla 24546 for musl libc (#16507) --- druntime/src/importc.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/druntime/src/importc.h b/druntime/src/importc.h index 138917151991..72d62d8e442e 100644 --- a/druntime/src/importc.h +++ b/druntime/src/importc.h @@ -70,12 +70,18 @@ typedef unsigned long long __uint64_t; * Obsolete detritus */ #define __cdecl +#define __pascal + +/********************* + * DMC-specific extensions, https://digitalmars.com/ctg/pointers16.html + */ +#ifdef __DMC__ #define __ss #define __cs #define __far #define __near #define __handle -#define __pascal +#endif /**************************** * __extension__ is a GNU C extension. It suppresses warnings From 673ddf38bc08976a42607d246b8f7fcb1a37c1f0 Mon Sep 17 00:00:00 2001 From: Johan Engelen Date: Mon, 20 May 2024 00:17:23 +0200 Subject: [PATCH 4/7] Only test druntime exceptions gdb test case (rt_trap_exceptions_drt_gdb) when gdb is available. (#16513) --- druntime/test/exceptions/Makefile | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/druntime/test/exceptions/Makefile b/druntime/test/exceptions/Makefile index 230013cc6504..fbcf0df032b3 100644 --- a/druntime/test/exceptions/Makefile +++ b/druntime/test/exceptions/Makefile @@ -1,5 +1,9 @@ include ../common.mak +DIFF:=diff +SED:=sed +GDB:=gdb + TESTS=stderr_msg unittest_assert invalid_memory_operation unknown_gc static_dtor \ future_message refcounted rt_trap_exceptions_drt catch_in_finally \ message_with_null @@ -9,7 +13,10 @@ ifeq ($(OS)-$(BUILD),linux-debug) LINE_TRACE_DFLAGS:=-L--export-dynamic endif ifeq ($(OS),linux) - TESTS+=rt_trap_exceptions_drt_gdb + # Only add this test if gdb is available. + ifneq (, $(shell which $(GDB))) + TESTS+=rt_trap_exceptions_drt_gdb + endif endif ifeq ($(OS)-$(BUILD),freebsd-debug) TESTS+=line_trace line_trace_21656 long_backtrace_trunc cpp_demangle @@ -31,10 +38,6 @@ ifeq ($(BUILD),debug) TESTS+=assert_fail endif -DIFF:=diff -SED:=sed -GDB:=gdb - .PHONY: all clean all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS))) From aa3533b4e55213faa9c6c052aefd3bfb1312ea3c Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Mon, 20 May 2024 12:59:09 +0200 Subject: [PATCH 5/7] machobj: Parse version string using strtoul --- compiler/src/dmd/backend/machobj.d | 47 ++++++++++++++++++++++++++---- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/compiler/src/dmd/backend/machobj.d b/compiler/src/dmd/backend/machobj.d index 1b61cf7c8388..a47dbbb2e7ac 100644 --- a/compiler/src/dmd/backend/machobj.d +++ b/compiler/src/dmd/backend/machobj.d @@ -2898,7 +2898,7 @@ const struct VersionCommand } /// Holds an operating system version or a SDK version. -immutable struct Version +struct Version { /// int major; @@ -2910,7 +2910,7 @@ immutable struct Version int build; /// Returns: `true` if the version is valid - bool isValid() pure nothrow @nogc @safe + bool isValid() pure nothrow @nogc @safe inout { return major >= 10 && major < 100 && minor >= 0 && minor < 100 && @@ -2979,17 +2979,52 @@ Version operatingSystemVersion() * Returns: the converted `Version`. */ @trusted -Version toVersion(const char* str) @nogc +Version toVersion(const(char)* str) @nogc { - import core.stdc.stdio : sscanf; - if (!str) return Version(); + const str_len = strlen(str); + if (str_len < 1) + return Version(); + + if (strspn(str, "0123456789.") != str_len) + return Version(); + + if (!isdigit(str[0]) || !isdigit(str[str_len - 1])) + return Version(); + Version version_; + const(char)* endptr; with (version_) - str.sscanf("%d.%d.%d", &major, &minor, &build); + { + major = cast(int)strtoul(str, &endptr, 10); + str = endptr + ((*endptr == '.') ? 1 : 0); + + if (*str == '.') + return Version(); + + minor = cast(int)strtoul(str, &endptr, 10); + str = endptr + ((*endptr == '.') ? 1 : 0); + + build = cast(int)strtoul(str, &endptr, 10); + if (*endptr != '\0') + return Version(); + } return version_; } + +unittest +{ + assert(toVersion("10") == Version(10, 0, 0)); + assert(toVersion("10.10") == Version(10, 10, 0)); + assert(toVersion("10.10.1") == Version(10, 10, 1)); + assert(toVersion("10.000010.1") == Version(10, 10, 1)); + assert(toVersion("10.010.001") == Version(10, 10, 1)); + assert(toVersion("000010.10.00001") == Version(10, 10, 1)); + assert(toVersion(".9.1") == Version(0, 0, 0)); + assert(toVersion("10..9") == Version(0, 0, 0)); + assert(toVersion("10.10.") == Version(0, 0, 0)); +} From b74b711f17882e1213d00d59ec9130c59c1873e2 Mon Sep 17 00:00:00 2001 From: "Richard (Rikki) Andrew Cattermole" Date: Sat, 25 May 2024 23:54:31 +1200 Subject: [PATCH 6/7] Add missing word to CLI documentation of UAX31 table selection flag --- compiler/src/dmd/cli.d | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/compiler/src/dmd/cli.d b/compiler/src/dmd/cli.d index ab7dcfa6e1ee..1dade3e08150 100644 --- a/compiler/src/dmd/cli.d +++ b/compiler/src/dmd/cli.d @@ -473,7 +473,7 @@ dmd -cov -unittest myprog.d $(LI $(I UAX31): UAX31) $(LI $(I c99): C99) $(LI $(I c11): C11) - $(LI $(I all): All, the least restrictive set, which comes all others (default)) + $(LI $(I all): All, the least restrictive set, which comes with all others (default)) )` ), Option("identifiers-importc=", @@ -483,7 +483,7 @@ dmd -cov -unittest myprog.d $(LI $(I UAX31): UAX31) $(LI $(I c99): C99) $(LI $(I c11): C11 (default)) - $(LI $(I all): All, the least restrictive set, which comes all others) + $(LI $(I all): All, the least restrictive set, which comes with all others) )` ), Option("ignore", From 0e6f8c1b9aa11b7030b3cb61eca78b1bafcf9ea3 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Mon, 27 May 2024 06:26:35 +0000 Subject: [PATCH 7/7] bump VERSION to v2.109.0-rc.1 --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 0b680c471728..1ce117e7ef2c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.109.0-beta.1 +v2.109.0-rc.1