Skip to content

Commit e87ace5

Browse files
authored
Merge pull request #5069 from kinke/merge_stable
Merge upstream stable
2 parents 71240ad + d0c342d commit e87ace5

8 files changed

Lines changed: 67 additions & 21 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# LDC master
22

33
#### Big news
4-
- Frontend, druntime and Phobos are at version [2.112.1+](https://dlang.org/changelog/2.112.0.html), incl. new command-line options `-extI`, `-dllimport=externalOnly` and `-edition`. (#4949, #4962, #4988, #5029, #5042, #5046, #5051, #5061, #5067)
4+
- Frontend, druntime and Phobos are at version [2.112.1+](https://dlang.org/changelog/2.112.0.html), incl. new command-line options `-extI`, `-dllimport=externalOnly` and `-edition`. (#4949, #4962, #4988, #5029, #5042, #5046, #5051, #5061, #5067, #5069)
55
- Support for [LLVM 21](https://releases.llvm.org/21.1.0/docs/ReleaseNotes.html). The prebuilt packages use v21.1.8. (#4950, #5033)
66
- New prebuilt package for Alpine Linux aarch64 with musl libc, analogous to the existing x86_64 package. (#4943)
77
- **Breaking change for dcompute**: The special `@kernel` UDA is now a function and _**requires**_ parentheses as in `@kernel() void foo(){}`. Optionally you can provide launch dimensions, `@kernel([2,4,8])`, to specify to the compute runtime how the kernel is intended to be launched.

dmd/common/charactertables.d

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,13 @@ bool c_isalnum(const int c)
185185
( c >= 'A' && c <= 'Z'));
186186
}
187187

188+
///
189+
bool isAlphaASCII(const dchar c)
190+
{
191+
return (( c >= 'a' && c <= 'z') ||
192+
( c >= 'A' && c <= 'Z'));
193+
}
194+
188195
extern(D) private:
189196

190197
// originally from dmd.root.utf

dmd/frontend.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8193,6 +8193,8 @@ extern bool c_isxdigit(const int32_t c);
81938193

81948194
extern bool c_isalnum(const int32_t c);
81958195

8196+
extern bool isAlphaASCII(const char32_t c);
8197+
81968198
extern void error(Loc loc, const char* format, ...);
81978199

81988200
extern void error(const char* filename, uint32_t linnum, uint32_t charnum, const char* format, ...);

dmd/lexer.d

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,11 @@ struct CompileEnv
6262
*/
6363
class Lexer
6464
{
65-
private __gshared OutBuffer stringbuffer;
65+
private __gshared
66+
{
67+
OutBuffer stringbuffer;
68+
OutBuffer stringbuffersecondary; // functions that use stringbuffer can call scan that needs this.
69+
}
6670

6771
BaseLoc* baseLoc; // Used to generate `scanloc`, which is just an index into this data structure
6872
Loc scanloc; // for error messages
@@ -1431,7 +1435,7 @@ class Lexer
14311435
p++;
14321436
break;
14331437
default:
1434-
if (isalpha(*p) || (p != idstart && isdigit(*p)))
1438+
if (isAlphaASCII(*p) || (p != idstart && isdigit(*p)))
14351439
continue;
14361440
error(loc, "unterminated named entity &%.*s;", cast(int)(p - idstart + 1), idstart);
14371441
c = '?';
@@ -1766,7 +1770,7 @@ class Lexer
17661770
uint blankrol = 0;
17671771
uint startline = 0;
17681772
p++;
1769-
stringbuffer.setsize(0);
1773+
stringbuffersecondary.setsize(0);
17701774
while (1)
17711775
{
17721776
const s = p;
@@ -1785,7 +1789,7 @@ class Lexer
17851789
}
17861790
if (hereid)
17871791
{
1788-
stringbuffer.writeUTF8(c);
1792+
stringbuffersecondary.writeUTF8(c);
17891793
continue;
17901794
}
17911795
break;
@@ -1825,7 +1829,7 @@ class Lexer
18251829
delimright = ']';
18261830
else if (c == '<')
18271831
delimright = '>';
1828-
else if (isalpha(c) || c == '_' || (c >= 0x80 && charLookup.isStart(c)))
1832+
else if (isAlphaASCII(c) || c == '_' || (c >= 0x80 && charLookup.isStart(c)))
18291833
{
18301834
// Start of identifier; must be a heredoc
18311835
Token tok;
@@ -1875,7 +1879,7 @@ class Lexer
18751879
goto Ldone;
18761880

18771881
// we're looking for a new identifier token
1878-
if (startline && (isalpha(c) || c == '_' || (c >= 0x80 && charLookup.isStart(c))) && hereid)
1882+
if (startline && (isAlphaASCII(c) || c == '_' || (c >= 0x80 && charLookup.isStart(c))) && hereid)
18791883
{
18801884
Token tok;
18811885
auto psave = p;
@@ -1890,7 +1894,7 @@ class Lexer
18901894
}
18911895
p = psave;
18921896
}
1893-
stringbuffer.writeUTF8(c);
1897+
stringbuffersecondary.writeUTF8(c);
18941898
startline = 0;
18951899
}
18961900
}
@@ -1903,7 +1907,7 @@ class Lexer
19031907
error("delimited string must end in `\"`");
19041908
else
19051909
error(token.loc, "delimited string must end in `%c\"`", delimright);
1906-
result.setString(stringbuffer);
1910+
result.setString(stringbuffersecondary);
19071911
stringPostfix(result);
19081912
}
19091913

@@ -2398,7 +2402,7 @@ class Lexer
23982402
case '.':
23992403
if (p[1] == '.')
24002404
goto Ldone; // if ".."
2401-
if (isalpha(p[1]) || p[1] == '_' || p[1] & 0x80)
2405+
if (isAlphaASCII(p[1]) || p[1] == '_' || p[1] & 0x80)
24022406
{
24032407
if (Ccompile && (p[1] == 'f' || p[1] == 'F' || p[1] == 'l' || p[1] == 'L'))
24042408
goto Lreal; // if `0.f` or `0.L`
@@ -2471,7 +2475,7 @@ class Lexer
24712475
case '.':
24722476
if (p[1] == '.')
24732477
goto Ldone; // if ".."
2474-
if (base <= 10 && n > 0 && (isalpha(p[1]) || p[1] == '_' || p[1] & 0x80))
2478+
if (base <= 10 && n > 0 && (isAlphaASCII(p[1]) || p[1] == '_' || p[1] & 0x80))
24752479
{
24762480
if (Ccompile && base == 10 &&
24772481
(p[1] == 'e' || p[1] == 'E' || p[1] == 'f' || p[1] == 'F' || p[1] == 'l' || p[1] == 'L'))

ir/irclass.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,12 +325,10 @@ unsigned buildClassinfoFlags(ClassDeclaration *cd) {
325325
flags |= ClassFlags::isAbstract;
326326
}
327327
for (ClassDeclaration *pc = cd; pc; pc = pc->baseClass) {
328-
if (pc->members) {
329-
for (Dsymbol *sm : *pc->members) {
330-
// printf("sm = %s %s\n", sm->kind(), sm->toChars());
331-
if (hasPointers(sm)) {
332-
return flags;
333-
}
328+
for (VarDeclaration *vd : pc->fields) {
329+
// printf("vd = %s %s\n", vd->kind(), vd->toChars());
330+
if (hasPointers(vd)) {
331+
return flags;
334332
}
335333
}
336334
}

runtime/druntime/src/core/sys/windows/winuser.d

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3720,8 +3720,8 @@ nothrow @nogc {
37203720
alias GetWindow GetNextWindow;
37213721

37223722
extern (Windows) nothrow @nogc:
3723-
LONG DispatchMessageA(const(MSG)*);
3724-
LONG DispatchMessageW(const(MSG)*);
3723+
LRESULT DispatchMessageA(const(MSG)*);
3724+
LRESULT DispatchMessageW(const(MSG)*);
37253725
int DlgDirListA(HWND, LPSTR, int, int, UINT);
37263726
int DlgDirListW(HWND, LPWSTR, int, int, UINT);
37273727
int DlgDirListComboBoxA(HWND, LPSTR, int, int, UINT);
@@ -4034,8 +4034,8 @@ BOOL ScreenToClient(HWND, LPPOINT);
40344034
BOOL ScrollDC(HDC, int, int, LPCRECT, LPCRECT, HRGN, LPRECT);
40354035
BOOL ScrollWindow(HWND, int, int, LPCRECT, LPCRECT);
40364036
int ScrollWindowEx(HWND, int, int, LPCRECT, LPCRECT, HRGN, LPRECT, UINT);
4037-
LONG SendDlgItemMessageA(HWND, int, UINT, WPARAM, LPARAM);
4038-
LONG SendDlgItemMessageW(HWND, int, UINT, WPARAM, LPARAM);
4037+
LRESULT SendDlgItemMessageA(HWND, int, UINT, WPARAM, LPARAM);
4038+
LRESULT SendDlgItemMessageW(HWND, int, UINT, WPARAM, LPARAM);
40394039
LRESULT SendMessageA(HWND, UINT, WPARAM, LPARAM);
40404040
BOOL SendMessageCallbackA(HWND, UINT, WPARAM, LPARAM, SENDASYNCPROC, ULONG_PTR);
40414041
BOOL SendMessageCallbackW(HWND, UINT, WPARAM, LPARAM, SENDASYNCPROC, ULONG_PTR);

tests/dmd/runnable/lexer.d

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,18 @@ foo
4242

4343
s = q{{foo}"}"};
4444
assert(s == "{foo}\"}\"");
45+
46+
// https://github.com/dlang/dmd/issues/22535
47+
s = q"EOS
48+
*是是是*
49+
的的的.
50+
*000*
51+
EOS";
52+
assert(s == "*是是是*
53+
的的的.
54+
*000*
55+
");
56+
assert(s.length == 29);
4557
}
4658

4759
/*********************************************************/

tests/dmd/runnable/test22594.d

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// https://github.com/dlang/dmd/issues/22594
2+
// PERMUTE_ARGS:
3+
4+
import core.memory : GC;
5+
6+
class C(Ts...) {
7+
Ts tuple;
8+
}
9+
10+
void main() {
11+
alias NoPointers = C!int;
12+
alias WithPointers = C!(void*);
13+
14+
assert(typeid(NoPointers).m_flags & TypeInfo_Class.ClassFlags.noPointers);
15+
assert(!(typeid(WithPointers).m_flags & TypeInfo_Class.ClassFlags.noPointers));
16+
17+
auto noPointers = new NoPointers;
18+
// FIXME: regressed with v2.103
19+
//assert(GC.getAttr(cast(void*) noPointers) & GC.BlkAttr.NO_SCAN);
20+
21+
auto withPointers = new WithPointers;
22+
assert(!(GC.getAttr(cast(void*) withPointers) & GC.BlkAttr.NO_SCAN));
23+
}

0 commit comments

Comments
 (0)