Skip to content

Commit 1a93fc7

Browse files
authored
Merge pull request #4440 from kinke/merge-2.104
Upgrade frontend & libs to v2.104.2
2 parents f806ce1 + 1a1c2a2 commit 1a93fc7

File tree

291 files changed

+7779
-4054
lines changed

Some content is hidden

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

291 files changed

+7779
-4054
lines changed

CHANGELOG.md

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

33
#### Big news
4+
- Frontend, druntime and Phobos are at version [2.104.2](https://dlang.org/changelog/2.104.0.html). (#4440)
45

56
#### Platform support
67

CMakeLists.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ include(GetLinuxDistribution)
111111
#
112112

113113
# Version information
114-
set(LDC_VERSION "1.33.0") # May be overridden by git hash tag
114+
set(LDC_VERSION "1.34.0") # May be overridden by git hash tag
115115
set(DMDFE_MAJOR_VERSION 2)
116-
set(DMDFE_MINOR_VERSION 103)
117-
set(DMDFE_PATCH_VERSION 1)
116+
set(DMDFE_MINOR_VERSION 104)
117+
set(DMDFE_PATCH_VERSION 2)
118118

119119
set(DMD_VERSION ${DMDFE_MAJOR_VERSION}.${DMDFE_MINOR_VERSION}.${DMDFE_PATCH_VERSION})
120120

dmd/aggregate.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ class AggregateDeclaration : public ScopeDsymbol
108108
Expression *getRTInfo; // pointer to GC info generated by object.RTInfo(this)
109109

110110
Visibility visibility;
111-
bool noDefaultCtor; // no default construction
112-
bool disableNew; // disallow allocations using `new`
111+
d_bool noDefaultCtor; // no default construction
112+
d_bool disableNew; // disallow allocations using `new`
113113
Sizeok sizeok; // set when structsize contains valid data
114114

115115
virtual Scope *newScope(Scope *sc);
@@ -273,10 +273,10 @@ class ClassDeclaration : public AggregateDeclaration
273273
// their own vtbl[]
274274

275275
TypeInfoClassDeclaration *vclassinfo; // the ClassInfo object for this ClassDeclaration
276-
bool com; // true if this is a COM class (meaning it derives from IUnknown)
277-
bool stack; // true if this is a scope class
276+
d_bool com; // true if this is a COM class (meaning it derives from IUnknown)
277+
d_bool stack; // true if this is a scope class
278278
int cppDtorVtblIndex; // slot reserved for the virtual destructor [extern(C++)]
279-
bool inuse; // to prevent recursive attempts
279+
d_bool inuse; // to prevent recursive attempts
280280

281281
ThreeState isabstract; // if abstract class
282282
Baseok baseok; // set the progress of base classes resolving

dmd/aliasthis.d

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ extern (C++) final class AliasThis : Dsymbol
7878
* Params:
7979
* sc = context
8080
* e = expression forming the `this`
81-
* gag = if true do not print errors, return null instead
81+
* gag = do not print errors, return `null` instead
8282
* findOnly = don't do further processing like resolving properties,
8383
* i.e. just return plain dotExp() result.
8484
* Returns:
@@ -93,7 +93,7 @@ Expression resolveAliasThis(Scope* sc, Expression e, bool gag = false, bool find
9393
{
9494
Loc loc = e.loc;
9595
Type tthis = (e.op == EXP.type ? e.type : null);
96-
const flags = DotExpFlag.noAliasThis | (gag ? DotExpFlag.gag : 0);
96+
const flags = cast(DotExpFlag) (DotExpFlag.noAliasThis | (gag * DotExpFlag.gag));
9797
uint olderrors = gag ? global.startGagging() : 0;
9898
e = dotExp(ad.type, sc, e, ad.aliasthis.ident, flags);
9999
if (!e || findOnly)
@@ -200,15 +200,29 @@ bool checkDeprecatedAliasThis(AliasThis at, const ref Loc loc, Scope* sc)
200200

201201
/**************************************
202202
* Check and set 'att' if 't' is a recursive 'alias this' type
203+
*
204+
* The goal is to prevent endless loops when there is a cycle in the alias this chain.
205+
* Since there is no multiple `alias this`, the chain either ends in a leaf,
206+
* or it loops back on itself as some point.
207+
*
208+
* Example: S0 -> (S1 -> S2 -> S3 -> S1)
209+
*
210+
* `S0` is not a recursive alias this, so this returns `false`, and a rewrite to `S1` can be tried.
211+
* `S1` is a recursive alias this type, but since `att` is initialized to `null`,
212+
* this still returns `false`, but `att1` is set to `S1`.
213+
* A rewrite to `S2` and `S3` can be tried, but when we want to try a rewrite to `S1` again,
214+
* we notice `att == t`, so we're back at the start of the loop, and this returns `true`.
215+
*
203216
* Params:
204-
* att = type reference used to detect recursion
205-
* t = 'alias this' type
217+
* att = type reference used to detect recursion. Should be initialized to `null`.
218+
* t = type of 'alias this' rewrite to attempt
206219
*
207220
* Returns:
208-
* Whether the 'alias this' is recursive or not
221+
* `false` if the rewrite is safe, `true` if it would loop back around
209222
*/
210223
bool isRecursiveAliasThis(ref Type att, Type t)
211224
{
225+
//printf("+isRecursiveAliasThis(att = %s, t = %s)\n", att ? att.toChars() : "null", t.toChars());
212226
auto tb = t.toBasetype();
213227
if (att && tb.equivalent(att))
214228
return true;

dmd/apply.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ public:
170170
{
171171
if (e.stageflags & stageApply)
172172
return;
173-
int old = e.stageflags;
173+
const old = e.stageflags;
174174
e.stageflags |= stageApply;
175175
doCond(e.elements.peekSlice()) || applyTo(e);
176176
e.stageflags = old;

dmd/astenums.d

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ enum TY : ubyte
214214
Tmixin,
215215
Tnoreturn,
216216
Ttag,
217-
TMAX
218217
}
218+
enum TMAX = TY.max + 1;
219219

220220
alias Tarray = TY.Tarray;
221221
alias Tsarray = TY.Tsarray;
@@ -265,7 +265,6 @@ alias Ttraits = TY.Ttraits;
265265
alias Tmixin = TY.Tmixin;
266266
alias Tnoreturn = TY.Tnoreturn;
267267
alias Ttag = TY.Ttag;
268-
alias TMAX = TY.TMAX;
269268

270269
enum TFlags
271270
{
@@ -328,6 +327,7 @@ enum VarArg : ubyte
328327
variadic = 1, /// (T t, ...) can be C-style (core.stdc.stdarg) or D-style (core.vararg)
329328
typesafe = 2, /// (T t ...) typesafe https://dlang.org/spec/function.html#typesafe_variadic_functions
330329
/// or https://dlang.org/spec/function.html#typesafe_variadic_functions
330+
KRvariadic = 3, /// K+R C style variadics (no function prototype)
331331
}
332332

333333
/*************************
@@ -339,7 +339,7 @@ enum STMT : ubyte
339339
Error,
340340
Peel,
341341
Exp, DtorExp,
342-
Compile,
342+
Mixin,
343343
Compound, CompoundDeclaration, CompoundAsm,
344344
UnrolledLoop,
345345
Scope,
@@ -439,3 +439,22 @@ enum FileType : ubyte
439439
ddoc, /// Ddoc documentation file (.dd)
440440
c, /// C source file
441441
}
442+
443+
extern (C++) struct structalign_t
444+
{
445+
private:
446+
ushort value = 0; // unknown
447+
enum STRUCTALIGN_DEFAULT = 1234; // default = match whatever the corresponding C compiler does
448+
bool pack; // use #pragma pack semantics
449+
450+
public:
451+
pure @safe @nogc nothrow:
452+
bool isDefault() const { return value == STRUCTALIGN_DEFAULT; }
453+
void setDefault() { value = STRUCTALIGN_DEFAULT; }
454+
bool isUnknown() const { return value == 0; } // value is not set
455+
void setUnknown() { value = 0; }
456+
void set(uint value) { this.value = cast(ushort)value; }
457+
uint get() const { return value; }
458+
bool isPack() const { return pack; }
459+
void setPack(bool pack) { this.pack = pack; }
460+
}

dmd/attrib.d

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ extern (C++) abstract class AttribDeclaration : Dsymbol
6262
this.decl = decl;
6363
}
6464

65+
extern (D) this(const ref Loc loc, Dsymbols* decl)
66+
{
67+
super(loc, null);
68+
this.decl = decl;
69+
}
70+
6571
extern (D) this(const ref Loc loc, Identifier ident, Dsymbols* decl)
6672
{
6773
super(loc, ident);
@@ -228,6 +234,12 @@ extern (C++) class StorageClassDeclaration : AttribDeclaration
228234
this.stc = stc;
229235
}
230236

237+
extern (D) this(const ref Loc loc, StorageClass stc, Dsymbols* decl)
238+
{
239+
super(loc, decl);
240+
this.stc = stc;
241+
}
242+
231243
override StorageClassDeclaration syntaxCopy(Dsymbol s)
232244
{
233245
assert(!s);
@@ -1300,7 +1312,8 @@ extern(C++) final class ForwardingAttribDeclaration : AttribDeclaration
13001312
* mixin("int x");
13011313
* https://dlang.org/spec/module.html#mixin-declaration
13021314
*/
1303-
extern (C++) final class CompileDeclaration : AttribDeclaration
1315+
// Note: was CompileDeclaration
1316+
extern (C++) final class MixinDeclaration : AttribDeclaration
13041317
{
13051318
Expressions* exps;
13061319
ScopeDsymbol scopesym;
@@ -1309,19 +1322,19 @@ extern (C++) final class CompileDeclaration : AttribDeclaration
13091322
extern (D) this(const ref Loc loc, Expressions* exps)
13101323
{
13111324
super(loc, null, null);
1312-
//printf("CompileDeclaration(loc = %d)\n", loc.linnum);
1325+
//printf("MixinDeclaration(loc = %d)\n", loc.linnum);
13131326
this.exps = exps;
13141327
}
13151328

1316-
override CompileDeclaration syntaxCopy(Dsymbol s)
1329+
override MixinDeclaration syntaxCopy(Dsymbol s)
13171330
{
1318-
//printf("CompileDeclaration::syntaxCopy('%s')\n", toChars());
1319-
return new CompileDeclaration(loc, Expression.arraySyntaxCopy(exps));
1331+
//printf("MixinDeclaration::syntaxCopy('%s')\n", toChars());
1332+
return new MixinDeclaration(loc, Expression.arraySyntaxCopy(exps));
13201333
}
13211334

13221335
override void addMember(Scope* sc, ScopeDsymbol sds)
13231336
{
1324-
//printf("CompileDeclaration::addMember(sc = %p, sds = %p, memnum = %d)\n", sc, sds, memnum);
1337+
//printf("MixinDeclaration::addMember(sc = %p, sds = %p, memnum = %d)\n", sc, sds, memnum);
13251338
this.scopesym = sds;
13261339
}
13271340

@@ -1335,7 +1348,7 @@ extern (C++) final class CompileDeclaration : AttribDeclaration
13351348
return "mixin";
13361349
}
13371350

1338-
override inout(CompileDeclaration) isCompileDeclaration() inout
1351+
override inout(MixinDeclaration) isMixinDeclaration() inout
13391352
{
13401353
return this;
13411354
}

dmd/attrib.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class AlignDeclaration final : public AttribDeclaration
132132
class AnonDeclaration final : public AttribDeclaration
133133
{
134134
public:
135-
bool isunion;
135+
d_bool isunion;
136136
int sem; // 1 if successful semantic()
137137
unsigned anonoffset; // offset of anonymous struct
138138
unsigned anonstructsize; // size of anonymous struct
@@ -175,8 +175,8 @@ class StaticIfDeclaration final : public ConditionalDeclaration
175175
{
176176
public:
177177
ScopeDsymbol *scopesym;
178-
bool addisdone;
179-
bool onStack;
178+
d_bool addisdone;
179+
d_bool onStack;
180180

181181
StaticIfDeclaration *syntaxCopy(Dsymbol *s) override;
182182
Dsymbols *include(Scope *sc) override;
@@ -193,8 +193,8 @@ class StaticForeachDeclaration final : public AttribDeclaration
193193
public:
194194
StaticForeach *sfe;
195195
ScopeDsymbol *scopesym;
196-
bool onStack;
197-
bool cached;
196+
d_bool onStack;
197+
d_bool cached;
198198
Dsymbols *cache;
199199

200200
StaticForeachDeclaration *syntaxCopy(Dsymbol *s) override;
@@ -221,15 +221,15 @@ class ForwardingAttribDeclaration final : public AttribDeclaration
221221

222222
// Mixin declarations
223223

224-
class CompileDeclaration final : public AttribDeclaration
224+
class MixinDeclaration final : public AttribDeclaration
225225
{
226226
public:
227227
Expressions *exps;
228228

229229
ScopeDsymbol *scopesym;
230-
bool compiled;
230+
d_bool compiled;
231231

232-
CompileDeclaration *syntaxCopy(Dsymbol *s) override;
232+
MixinDeclaration *syntaxCopy(Dsymbol *s) override;
233233
void addMember(Scope *sc, ScopeDsymbol *sds) override;
234234
void setScope(Scope *sc) override;
235235
const char *kind() const override;

0 commit comments

Comments
 (0)