mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 05:00:16 +03:00
Merge remote-tracking branch 'upstream/stable' into merge_stable
This commit is contained in:
commit
9ca85e493d
7 changed files with 74 additions and 18 deletions
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
v2.109.0-beta.1
|
||||
v2.109.0-rc.1
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
|
12
changelog/dmd.foreach-array-index-type.dd
Normal file
12
changelog/dmd.foreach-array-index-type.dd
Normal file
|
@ -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.
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -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=<table>",
|
||||
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue