Skip to content

Commit e33c664

Browse files
committed
Merge remote-tracking branch 'upstream/master' into stable
2 parents a18f759 + f00c817 commit e33c664

File tree

176 files changed

+5430
-3154
lines changed

Some content is hidden

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

176 files changed

+5430
-3154
lines changed

.github/workflows/runnable_cxx.yml

Lines changed: 104 additions & 259 deletions
Large diffs are not rendered by default.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
External import path switch
2+
3+
A new switch is added, the external import path (``-extI``).
4+
It is similar to the import path switch (``-I``) except it indicates that a module found from it is external to the currently compiling binary.
5+
6+
It is used on Windows when the ``dllimport`` override switch is set to anything other than ``none`` to force an external module's symbols as DllImport.
7+
8+
If a build system supports the external import path switch, it is recommend to **not** use the ``all`` option for the ``dllimport`` override switch which applies to symbols that should not be getting DllImport'd.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Templatize `_d_arrayappendcTX` runtime hook
2+
3+
This refactorization discards the `TypeInfo` parameter, replacing it with a template type parameter.

compiler/src/build.d

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1558,7 +1558,7 @@ auto sourceFiles()
15581558
}
15591559
DmdSources dmd = {
15601560
glue: fileArray(env["D"], "
1561-
dmsc.d e2ir.d iasmdmd.d glue.d objc_glue.d
1561+
dmsc.d e2ir.d iasm/dmdx86.d iasm/dmdaarch64.d glue.d objc_glue.d
15621562
s2ir.d tocsym.d toctype.d tocvdebug.d todt.d toir.d toobj.d
15631563
"),
15641564
driver: fileArray(env["D"], "dinifile.d dmdparams.d gluelayer.d lib/package.d lib/elf.d lib/mach.d lib/mscoff.d
@@ -1570,13 +1570,14 @@ auto sourceFiles()
15701570
cli.d clone.d compiler.d cond.d constfold.d cpreprocess.d ctfeexpr.d
15711571
ctorflow.d dcast.d dclass.d declaration.d delegatize.d denum.d deps.d dimport.d
15721572
dinterpret.d dmacro.d dmodule.d doc.d dscope.d dstruct.d dsymbol.d dsymbolsem.d
1573-
dtemplate.d dtoh.d dversion.d enumsem.d escape.d expression.d expressionsem.d func.d funcsem.d hdrgen.d iasm.d iasmgcc.d
1573+
dtemplate.d dtoh.d dversion.d enumsem.d escape.d expression.d expressionsem.d func.d funcsem.d hdrgen.d
15741574
impcnvtab.d imphint.d importc.d init.d initsem.d inline.d inlinecost.d intrange.d json.d lambdacomp.d
15751575
mtype.d mustuse.d nogc.d nspace.d ob.d objc.d opover.d optimize.d
15761576
parse.d pragmasem.d printast.d rootobject.d safe.d
15771577
semantic2.d semantic3.d sideeffect.d statement.d
15781578
statementsem.d staticassert.d staticcond.d stmtstate.d target.d templatesem.d templateparamsem.d traits.d
15791579
typesem.d typinf.d utils.d
1580+
iasm/package.d iasm/gcc.d
15801581
mangle/package.d mangle/basic.d mangle/cpp.d mangle/cppwin.d
15811582
visitor/package.d visitor/foreachvar.d visitor/parsetime.d visitor/permissive.d visitor/postorder.d visitor/statement_rewrite_walker.d
15821583
visitor/strict.d visitor/transitive.d

compiler/src/dmd/README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,10 @@ Note that these groups have no strict meaning, the category assignments are a bi
170170

171171
| File | Purpose |
172172
|-------------------------------------------------------------------------|-------------------------------------------|
173-
| [iasm.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/iasm.d) | Inline assembly depending on the compiler |
174-
| [iasmdmd.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/iasmdmd.d) | Inline assembly for DMD |
175-
| [iasmgcc.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/iasmgcc.d) | Inline assembly for GDC |
173+
| [iasm/package.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/iasm/package.d) | Inline assembly depending on the compiler |
174+
| [iasm/dmdx86.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/iasm/dmd.d) | Inline assembly for DMD X86_64 |
175+
| [iasm/dmdaarch64.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/iasm/aarch64.d) | Inline assembly for DMD AArch64 |
176+
| [iasm/gcc.d](https://github.com/dlang/dmd/blob/master/compiler/src/dmd/iasm/gcc.d) | Inline assembly for GDC |
176177

177178
**Other**
178179

compiler/src/dmd/aggregate.d

Lines changed: 1 addition & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import dmd.declaration;
2525
import dmd.dscope;
2626
import dmd.dstruct;
2727
import dmd.dsymbol;
28-
import dmd.dsymbolsem : dsymbolSemantic, determineFields, search, determineSize, include;
28+
import dmd.dsymbolsem : dsymbolSemantic, determineSize, include;
2929
import dmd.dtemplate;
3030
import dmd.errors;
3131
import dmd.expression;
@@ -37,7 +37,6 @@ import dmd.identifier;
3737
import dmd.location;
3838
import dmd.mtype;
3939
import dmd.tokens;
40-
import dmd.typesem : defaultInit, addMod, size;
4140
import dmd.visitor;
4241

4342
/**
@@ -195,86 +194,6 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
195194
return ok ? structsize : SIZE_INVALID;
196195
}
197196

198-
/***************************************
199-
* Calculate field[i].overlapped and overlapUnsafe, and check that all of explicit
200-
* field initializers have unique memory space on instance.
201-
* Returns:
202-
* true if any errors happen.
203-
*/
204-
extern (D) final bool checkOverlappedFields()
205-
{
206-
//printf("AggregateDeclaration::checkOverlappedFields() %s\n", toChars());
207-
assert(sizeok == Sizeok.done);
208-
size_t nfields = fields.length;
209-
if (isNested())
210-
{
211-
auto cd = isClassDeclaration();
212-
if (!cd || !cd.baseClass || !cd.baseClass.isNested())
213-
nfields--;
214-
if (vthis2 && !(cd && cd.baseClass && cd.baseClass.vthis2))
215-
nfields--;
216-
}
217-
bool errors = false;
218-
219-
// Fill in missing any elements with default initializers
220-
foreach (i; 0 .. nfields)
221-
{
222-
auto vd = fields[i];
223-
if (vd.errors)
224-
{
225-
errors = true;
226-
continue;
227-
}
228-
229-
const vdIsVoidInit = vd._init && vd._init.isVoidInitializer();
230-
231-
// Find overlapped fields with the hole [vd.offset .. vd.offset.size()].
232-
foreach (j; 0 .. nfields)
233-
{
234-
if (i == j)
235-
continue;
236-
auto v2 = fields[j];
237-
if (v2.errors)
238-
{
239-
errors = true;
240-
continue;
241-
}
242-
if (!vd.isOverlappedWith(v2))
243-
continue;
244-
245-
// vd and v2 are overlapping.
246-
vd.overlapped = true;
247-
v2.overlapped = true;
248-
249-
if (!MODimplicitConv(vd.type.mod, v2.type.mod))
250-
v2.overlapUnsafe = true;
251-
if (!MODimplicitConv(v2.type.mod, vd.type.mod))
252-
vd.overlapUnsafe = true;
253-
254-
if (i > j)
255-
continue;
256-
257-
if (!v2._init)
258-
continue;
259-
260-
if (v2._init.isVoidInitializer())
261-
continue;
262-
263-
if (vd._init && !vdIsVoidInit && v2._init)
264-
{
265-
.error(loc, "overlapping default initialization for field `%s` and `%s`", v2.toChars(), vd.toChars());
266-
errors = true;
267-
}
268-
else if (v2._init && i < j)
269-
{
270-
.error(v2.loc, "union field `%s` with default initialization `%s` must be before field `%s`",
271-
v2.toChars(), dmd.hdrgen.toChars(v2._init), vd.toChars());
272-
errors = true;
273-
}
274-
}
275-
}
276-
return errors;
277-
}
278197

279198
override final Type getType()
280199
{
@@ -433,46 +352,6 @@ extern (C++) abstract class AggregateDeclaration : ScopeDsymbol
433352
return visibility.kind == Visibility.Kind.export_;
434353
}
435354

436-
/*******************************************
437-
* Look for constructor declaration.
438-
*/
439-
extern (D) final Dsymbol searchCtor()
440-
{
441-
auto s = this.search(Loc.initial, Id.ctor);
442-
if (s)
443-
{
444-
if (!(s.isCtorDeclaration() ||
445-
s.isTemplateDeclaration() ||
446-
s.isOverloadSet()))
447-
{
448-
error(s.loc, "%s name `__ctor` is not allowed", s.kind);
449-
errorSupplemental(s.loc, "identifiers starting with `__` are reserved for internal use");
450-
errors = true;
451-
s = null;
452-
}
453-
}
454-
if (s && s.toParent() != this)
455-
s = null; // search() looks through ancestor classes
456-
if (s)
457-
{
458-
// Finish all constructors semantics to determine this.noDefaultCtor.
459-
static int searchCtor(Dsymbol s, void*)
460-
{
461-
auto f = s.isCtorDeclaration();
462-
if (f && f.semanticRun == PASS.initial)
463-
f.dsymbolSemantic(null);
464-
return 0;
465-
}
466-
467-
for (size_t i = 0; i < members.length; i++)
468-
{
469-
auto sm = (*members)[i];
470-
sm.apply(&searchCtor, null);
471-
}
472-
}
473-
return s;
474-
}
475-
476355
override final Visibility visible() pure nothrow @nogc @safe
477356
{
478357
return visibility;

compiler/src/dmd/astbase.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,7 @@ struct ASTBase
13831383

13841384
const FileName srcfile;
13851385
const(char)[] arg;
1386-
Edition edition = Edition.legacy;
1386+
Edition edition = Edition.min;
13871387

13881388
extern (D) this(Loc loc, const(char)[] filename, Identifier ident, int doDocComment, int doHdrGen)
13891389
{

compiler/src/dmd/astenums.d

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ enum Sizeok : ubyte
1919
}
2020

2121
/// D Language version
22-
enum Edition : ubyte
22+
enum Edition : ushort
2323
{
24-
none,
25-
legacy, /// Before the introduction of editions
26-
v2024, /// Experimental first new edition
27-
latest = v2024 /// Newest edition that this compiler knows of
24+
v2023 = 2023, /// Edition.min for default edition
25+
v2024, /// first Edition
26+
v2025, /// next Edition
27+
/// use Edition.max for latest edition
2828
}
2929

3030
enum Baseok : ubyte
@@ -77,9 +77,10 @@ enum STC : ulong // transfer changes to declaration.h
7777
ref_ = 0x4_0000, /// `ref`
7878
scope_ = 0x8_0000, /// `scope`
7979

80-
scopeinferred = 0x20_0000, /// `scope` has been inferred and should not be part of mangling, `scope_` must also be set
81-
return_ = 0x40_0000, /// 'return ref' or 'return scope' for function parameters
82-
returnScope = 0x80_0000, /// if `ref return scope` then resolve to `ref` and `return scope`
80+
scopeinferred = 0x10_0000, /// `scope` has been inferred and should not be part of mangling, `scope_` must also be set
81+
return_ = 0x20_0000, /// 'return ref' or 'return scope' for function parameters
82+
returnScope = 0x40_0000, /// if `ref return scope` then resolve to `ref` and `return scope`
83+
returnRef = 0x80_0000, /// if `return ref`
8384

8485
returninferred = 0x100_0000, /// `return` has been inferred and should not be part of mangling, `return_` must also be set
8586
immutable_ = 0x200_0000, /// `immutable`

compiler/src/dmd/attrib.d

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ import dmd.declaration;
3232
import dmd.dmodule;
3333
import dmd.dscope;
3434
import dmd.dsymbol;
35-
import dmd.dsymbolsem : include;
3635
import dmd.expression;
3736
import dmd.func;
3837
import dmd.globals;

0 commit comments

Comments
 (0)