Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 4d83c59

Browse files
committed
Merge remote-tracking branch 'upstream/stable' into merge_stable
2 parents 077db71 + 68f8561 commit 4d83c59

File tree

18 files changed

+105
-20
lines changed

18 files changed

+105
-20
lines changed

.cirrus.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ task:
5858

5959
# Mac
6060
task:
61-
name: macOS 10.15 x64
61+
name: macOS 11.x x64
6262
osx_instance:
63-
image: catalina-xcode
63+
image: big-sur-xcode
6464
timeout_in: 60m
6565
environment:
6666
OS_NAME: darwin

mak/COPY

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ COPY=\
260260
$(IMPDIR)\core\sys\openbsd\dlfcn.d \
261261
$(IMPDIR)\core\sys\openbsd\err.d \
262262
$(IMPDIR)\core\sys\openbsd\execinfo.d \
263+
$(IMPDIR)\core\sys\openbsd\pthread_np.d \
263264
$(IMPDIR)\core\sys\openbsd\stdlib.d \
264265
$(IMPDIR)\core\sys\openbsd\string.d \
265266
$(IMPDIR)\core\sys\openbsd\time.d \

mak/SRCS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ SRCS=\
261261
src\core\sys\openbsd\dlfcn.d \
262262
src\core\sys\openbsd\err.d \
263263
src\core\sys\openbsd\execinfo.d \
264+
src\core\sys\openbsd\pthread_np.d \
264265
src\core\sys\openbsd\stdlib.d \
265266
src\core\sys\openbsd\string.d \
266267
src\core\sys\openbsd\time.d \

posix.mak

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -403,11 +403,7 @@ ifeq ($(OS),linux)
403403
endif
404404
endif
405405

406-
ifeq ($(OS),freebsd)
407406
DISABLED_TESTS =
408-
else
409-
DISABLED_TESTS =
410-
endif
411407

412408
$(addprefix $(ROOT)/unittest/,$(DISABLED_TESTS)) :
413409
@echo $@ - disabled

src/core/demangle.d

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@ pure @safe:
643643
TypeDelegate
644644
TypeNone
645645
TypeVoid
646+
TypeNoreturn
646647
TypeByte
647648
TypeUbyte
648649
TypeShort
@@ -722,6 +723,9 @@ pure @safe:
722723
TypeVoid:
723724
v
724725
726+
TypeNoreturn
727+
Nn
728+
725729
TypeByte:
726730
g
727731
@@ -880,6 +884,10 @@ pure @safe:
880884
popFront();
881885
switch ( front )
882886
{
887+
case 'n': // Noreturn
888+
popFront();
889+
put("noreturn");
890+
return dst[beg .. len];
883891
case 'g': // Wild (Ng Type)
884892
popFront();
885893
// TODO: Anything needed here?
@@ -1171,9 +1179,11 @@ pure @safe:
11711179
case 'g':
11721180
case 'h':
11731181
case 'k':
1182+
case 'n':
11741183
// NOTE: The inout parameter type is represented as "Ng".
11751184
// The vector parameter type is represented as "Nh".
11761185
// The return parameter type is represented as "Nk".
1186+
// The noreturn parameter type is represented as "Nn".
11771187
// These make it look like a FuncAttr, but infact
11781188
// if we see these, then we know we're really in
11791189
// the parameter list. Rewind and break.
@@ -2690,6 +2700,25 @@ unittest
26902700
assert(s.demangle == expected);
26912701
}
26922702

2703+
// https://issues.dlang.org/show_bug.cgi?id=22235
2704+
unittest
2705+
{
2706+
enum parent = __MODULE__ ~ '.' ~ __traits(identifier, __traits(parent, {}));
2707+
2708+
static noreturn abort() { assert(false); }
2709+
assert(demangle(abort.mangleof) == "pure nothrow @nogc @safe noreturn " ~ parent ~ "().abort()");
2710+
2711+
static void accept(noreturn) {}
2712+
assert(demangle(accept.mangleof) == "pure nothrow @nogc @safe void " ~ parent ~ "().accept(noreturn)");
2713+
2714+
static void templ(T)(T, T) {}
2715+
assert(demangle(templ!noreturn.mangleof) == "pure nothrow @nogc @safe void " ~ parent ~ "().templ!(noreturn).templ(noreturn, noreturn)");
2716+
2717+
static struct S(T) {}
2718+
static void aggr(S!noreturn) { assert(0); }
2719+
assert(demangle(aggr.mangleof) == "pure nothrow @nogc @safe void " ~ parent ~ "().aggr(" ~ parent ~ "().S!(noreturn).S)");
2720+
}
2721+
26932722
/*
26942723
*
26952724
*/

src/core/internal/dassert.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ private string miniFormat(V)(const scope ref V v)
191191
}
192192

193193
// Fall back to a simple cast - we're violating the type system anyways
194-
return miniFormat(__ctfe ? cast(const T) v : *cast(const T*) &v);
194+
return miniFormat(*cast(const T*) &v);
195195
}
196196
// Format enum members using their name
197197
else static if (is(V BaseType == enum))

src/core/runtime.d

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,7 @@ else static if (hasExecinfo) private class DefaultTraceInfo : Throwable.TraceInf
783783
version (linux) enum enableDwarf = true;
784784
else version (FreeBSD) enum enableDwarf = true;
785785
else version (DragonFlyBSD) enum enableDwarf = true;
786+
else version (OpenBSD) enum enableDwarf = true;
786787
else version (Darwin) enum enableDwarf = true;
787788
else enum enableDwarf = false;
788789

src/core/sys/openbsd/pthread_np.d

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/**
2+
* D header file for OpenBSD pthread_np.h.
3+
*
4+
* Copyright: Copyright © 2021, The D Language Foundation
5+
* License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
6+
* Authors: Brian Callahan
7+
*/
8+
module core.sys.openbsd.pthread_np;
9+
10+
version (OpenBSD):
11+
extern (C):
12+
nothrow:
13+
@nogc:
14+
15+
public import core.sys.posix.sys.types;
16+
import core.sys.posix.signal : stack_t;
17+
18+
int pthread_mutexattr_getkind_np(pthread_mutexattr_t);
19+
int pthread_mutexattr_setkind_np(pthread_mutexattr_t*, int);
20+
void pthread_get_name_np(pthread_t, char*, size_t);
21+
void pthread_set_name_np(pthread_t, const(char)*);
22+
int pthread_stackseg_np(pthread_t, stack_t*);
23+
int pthread_main_np();

src/core/sys/openbsd/stdlib.d

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,11 @@ extern (C):
1313
nothrow:
1414
@nogc:
1515

16+
void freezero(void*, size_t);
17+
void* calloc_conceal(size_t, size_t);
18+
void* malloc_conceal(size_t);
19+
void* reallocarray(void*, size_t, size_t);
20+
void* recallocarray(void*, size_t, size_t, size_t);
21+
1622
const(char)* getprogname();
17-
void setprogname(scope const char* name);
23+
void setprogname(scope const char*);

src/core/sys/openbsd/string.d

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,13 @@ nothrow:
1717

1818
static if (__BSD_VISIBLE)
1919
{
20+
void explicit_bzero(void*, size_t);
2021
pure void* memmem(return const void* haystack, size_t haystacklen, scope const void* needle, size_t needlelen);
22+
void* memrchr(scope const void*, int, size_t);
23+
size_t strlcat(char*, scope const char*, size_t);
24+
size_t strlcpy(char*, scope const char*, size_t);
25+
void strmode(int, char*);
26+
char* strsep(char**, scope const char*);
2127
pure int timingsafe_bcmp(scope const void*, scope const void*, size_t);
2228
pure int timingsafe_memcmp(scope const void*, scope const void*, size_t);
2329
}

0 commit comments

Comments
 (0)