Skip to content

Commit 211f2b4

Browse files
authored
Merge branch 'master' into poc_v2_pragma_lint
2 parents db171ba + 87a06cb commit 211f2b4

194 files changed

Lines changed: 6090 additions & 5239 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/run.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ install_deps() {
6666

6767
download "https://dlang.org/install.sh" "https://nightlies.dlang.org/install.sh" "install.sh"
6868

69-
source "$(CURL_USER_AGENT=\"$CURL_USER_AGENT\" bash install.sh dmd-$HOST_DMD_VER --activate)"
69+
source "$(CURL_USER_AGENT="$CURL_USER_AGENT" bash install.sh dmd-$HOST_DMD_VER --activate)"
7070
$DC --version
7171
env
7272
deactivate
@@ -109,7 +109,7 @@ setup_repos() {
109109
coverage()
110110
{
111111
# load environment for bootstrap compiler
112-
source "$(CURL_USER_AGENT=\"$CURL_USER_AGENT\" bash ~/dlang/install.sh dmd-$HOST_DMD_VER --activate)"
112+
source "$(CURL_USER_AGENT="$CURL_USER_AGENT" bash ~/dlang/install.sh dmd-$HOST_DMD_VER --activate)"
113113

114114
local build_path=generated/linux/$BUILD/$MODEL
115115
local builder=generated/build
@@ -172,7 +172,7 @@ check_d_builder()
172172
{
173173
echo "Testing D build"
174174
# load environment for bootstrap compiler
175-
source "$(CURL_USER_AGENT=\"$CURL_USER_AGENT\" bash ~/dlang/install.sh dmd-$HOST_DMD_VER --activate)"
175+
source "$(CURL_USER_AGENT="$CURL_USER_AGENT" bash ~/dlang/install.sh dmd-$HOST_DMD_VER --activate)"
176176
./compiler/src/build.d clean
177177
rm -rf generated # just to be sure
178178
# TODO: add support for 32-bit builds
@@ -186,7 +186,7 @@ check_d_builder()
186186
test_cxx()
187187
{
188188
# load environment for bootstrap compiler
189-
source "$(CURL_USER_AGENT=\"$CURL_USER_AGENT\" bash ~/dlang/install.sh dmd-$HOST_DMD_VER --activate)"
189+
source "$(CURL_USER_AGENT="$CURL_USER_AGENT" bash ~/dlang/install.sh dmd-$HOST_DMD_VER --activate)"
190190
echo "Test CXX frontend.h header generation"
191191
./compiler/src/build.d
192192
make -j$N -C druntime MODEL=$MODEL BUILD=$BUILD

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ repos:
2121
- id: detect-private-key
2222
- id: no-commit-to-branch
2323
args: [--branch, master]
24-
- repo: https://github.com/sirosen/check-jsonschema
25-
rev: 0.34.1
24+
- repo: https://github.com/python-jsonschema/check-jsonschema
25+
rev: 0.37.1
2626
hooks:
2727
- id: check-github-workflows

changelog/dmd.atomic.dd

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Shared static constructors/destructors in templates now lower to `object._d_atomicOp`
2+
3+
When a shared static constructor or destructor appears inside a template, it may
4+
be instantiated in multiple modules, causing it to run multiple times. A shared
5+
gate variable is used to count and guard executions, ensuring the body runs
6+
exactly once across all modules. The atomic operation on that gate is necessary
7+
because multiple threads may initialize modules concurrently.
8+
9+
This gate operation previously called `core.atomic.atomicOp` directly.
10+
11+
---
12+
shared static this()
13+
{
14+
if (atomicOp!"+="(gate, 1) != 1) return;
15+
// inside a template instantiation
16+
}
17+
---
18+
19+
It now lowers to `object._d_atomicOp`, consistent with how other compiler-generated
20+
runtime hooks are handled.
21+
22+
---
23+
if (.object._d_atomicOp!"+="(gate, 1) != 1) return;
24+
---
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Foreach variable shadowing is now an error
2+
3+
A deprecation introduced in DMD 2.089.0 for foreach variables shadowing
4+
outer scope symbols has been upgraded to an error.
5+
6+
This affects both variables declared inside a foreach body that shadow
7+
outer variables, and duplicate variable names in foreach parameter lists
8+
when using `opApply`.
9+
10+
---
11+
void main()
12+
{
13+
int[int] arr;
14+
int x;
15+
foreach (i, j; arr)
16+
{
17+
int x; // Error: variable `x` is shadowing variable `...x`
18+
}
19+
}
20+
---
21+
22+
---
23+
struct Foo
24+
{
25+
int opApply(scope int delegate(size_t, size_t, ref uint)) => 0;
26+
}
27+
28+
void main()
29+
{
30+
foreach (x, y, x; Foo()) {} // Error: variable `x` is shadowing variable `...x`
31+
}
32+
---
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
`-ftime-trace`: add instrumentation for the inliner pass
2+
3+
The `-ftime-trace` output previously had no coverage for the inliner pass.
4+
When compiling with `-inline`, the time spent scanning and inlining functions
5+
did not appear in the trace at all.
6+
7+
Two new spans are now emitted: `Inlining` covers the entire inliner pass, and
8+
`Inline: <function>` covers each function scanned individually.
9+
These are visible in trace viewers like $(LINK2 https://ui.perfetto.dev/, Perfetto).
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
`-ftime-trace`: break up the template instance span into sub-phases
2+
3+
The `-ftime-trace` output previously showed template instantiation as a single
4+
flat block, making it hard to tell where the time was actually going.
5+
6+
The `Sema1: Template Instance` span now contains sub-spans for each phase:
7+
`Sema1: Template Arg Semantic`, `Sema1: Overload Resolution`,
8+
`Sema1: Template Members`, `Sema2: Template Instance`, and `Sema3: Template Instance`.
9+
These are visible in trace viewers like $(LINK2 https://ui.perfetto.dev/, Perfetto).

changelog/dmd.named-args-ifti.dd

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
Implicit Function Template Instantiation (IFTI) handled named arguments better
2+
3+
https://github.com/dlang/dmd/issues/21335
4+
https://github.com/dlang/dmd/issues/22878
5+
6+
When calling a function template with named arguments, parameters that are
7+
skipped (because their named argument was not provided) now correctly use
8+
their template parameter defaults for type deduction.
9+
10+
---
11+
void f(A = int, B = int)(A a = A.init, B b = B.init) {}
12+
13+
void main()
14+
{
15+
f(b: "hello"); // A = int (template default), B = string (deduced)
16+
}
17+
---
18+
19+
Named arguments that appear behind variadic arguments can now be assigned to:
20+
21+
---
22+
void error(T...)(T args, string file = __FILE__, int line = __LINE__) {}
23+
24+
auto text(T...)(T args, Allocator alloc) {}
25+
26+
void foo(Allocator gc)
27+
{
28+
error("Code: ", code, file: __FILE__, line: __LINE__)
29+
30+
return text("hello", "world", alloc: gc);
31+
}
32+
---

changelog/dmd.timerfd.dd

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
core.sys.linux.timerfd moved to core.sys.linux.sys.timerfd
2+
3+
Usually, a linux header that's included in C like `#include <sys/time.h>` gets its translation in `core/sys/linux/sys/time.d`.
4+
timerfd.d was an exception, not being put in the `sys` package.
5+
The module has been moved there, and the old module still exists as a deprecated module that publicly imports the new module.
6+
7+
---
8+
import core.sys.linux.timerfd; // deprecated
9+
import core.sys.linux.sys.timerfd; // corrective action
10+
---

compiler/src/build.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,7 +1596,7 @@ auto sourceFiles()
15961596
"),
15971597
backendHeaders: fileArray(env["C"], "
15981598
cc.d cdef.d cgcv.d code.d dt.d el.d global.d
1599-
obj.d oper.d rtlsym.d iasm.d codebuilder.d
1599+
obj.d oper.d iasm.d codebuilder.d
16001600
ty.d type.d dlist.d
16011601
dwarf.d dwarf2.d cv4.d
16021602
melf.d mscoff.d mach.d
@@ -1639,7 +1639,7 @@ auto sourceFiles()
16391639
dout.d inliner.d eh.d aarray.d
16401640
gloop.d cgelem.d cgcs.d ee.d blockopt.d mem.d cg.d
16411641
dtype.d debugprint.d fp.d symbol.d symtab.d elem.d dcode.d cgsched.d
1642-
pdata.d util2.d var.d backconfig.d drtlsym.d ptrntab.d
1642+
pdata.d util2.d var.d backconfig.d rtlsym.d ptrntab.d
16431643
dvarstats.d cgen.d goh.d barray.d cgcse.d elpicpie.d
16441644
dwarfeh.d dwarfdbginf.d cv8.d dcgcv.d
16451645
machobj.d elfobj.d mscoffobj.d

compiler/src/dmd/access.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ bool checkAccess(AggregateDeclaration ad, Loc loc, Scope* sc, Dsymbol smember)
5050

5151
if (!symbolIsVisible(sc, smember))
5252
{
53-
error(loc, "%s `%s` %s `%s` is not accessible", ad.kind(), ad.toPrettyChars(), smember.kind(), smember.toChars());
53+
error(loc, "%s `%s` %s `%s` is not accessible", ad.kind(), ad.toPrettyChars(), smember.kind(), smember.toErrMsg());
5454
//printf("smember = %s %s, vis = %d, semanticRun = %d\n",
5555
// smember.kind(), smember.toPrettyChars(), smember.visible() smember.semanticRun);
5656
return true;

0 commit comments

Comments
 (0)