Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CI test] #20786

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 47 additions & 48 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,63 +15,62 @@ jobs:
fail-fast: false
matrix:
include:
# Linux
- job_name: Ubuntu 22.04 x64, DMD (latest)
- job_name: Ubuntu 22.04 x86, DMD (bootstrap)
os: ubuntu-22.04
host_dmd: dmd
# Enable this to replace coverage tests on CircleCI
# - job_name: Ubuntu 22.04 x64, DMD (coverage)
# os: ubuntu-22.04
# host_dmd: dmd
# coverage: true
- job_name: Ubuntu 22.04 x64, DMD (bootstrap)
model: 32
host_dmd: dmd-2.097.1
- job_name: Ubuntu 22.04 x86, DMD 2.109.1
os: ubuntu-22.04
host_dmd: dmd-2.079.0
disable_debug_for_dmd_unittests: true # no `-debug` - host frontend too old
- job_name: Ubuntu 22.04 x86, DMD (latest)
model: 32
host_dmd: dmd-2.109.1
- job_name: Ubuntu 22.04 x86, DMD 2.108.1
os: ubuntu-22.04
model: 32
host_dmd: dmd
# Disabled because of failure https://issues.dlang.org/show_bug.cgi?id=24518
# - job_name: Ubuntu 22.04 x86, DMD (coverage)
# os: ubuntu-22.04
# model: 32
# host_dmd: dmd
# coverage: true
- job_name: Ubuntu 22.04 x86, DMD (bootstrap)
host_dmd: dmd-2.108.1
- job_name: Ubuntu 22.04 x86, DMD 2.107.1
os: ubuntu-22.04
model: 32
host_dmd: dmd-2.097.1
- job_name: Ubuntu 22.04 x64, LDC
host_dmd: dmd-2.107.1
- job_name: Ubuntu 22.04 x86, DMD 2.106.1
os: ubuntu-22.04
host_dmd: ldc
- job_name: Ubuntu 22.04 x64, GDC
model: 32
host_dmd: dmd-2.106.1
- job_name: Ubuntu 22.04 x86, DMD 2.105.3
os: ubuntu-22.04
model: 32
host_dmd: dmd-2.105.3
- job_name: Ubuntu 22.04 x86, DMD 2.104.2
os: ubuntu-22.04
model: 32
host_dmd: dmd-2.104.2
- job_name: Ubuntu 22.04 x86, DMD 2.103.1
os: ubuntu-22.04
model: 32
host_dmd: dmd-2.103.1
- job_name: Ubuntu 22.04 x86, DMD 2.102.2
os: ubuntu-22.04
model: 32
host_dmd: dmd-2.102.2
- job_name: Ubuntu 22.04 x86, DMD 2.101.2
os: ubuntu-22.04
model: 32
host_dmd: dmd-2.101.2
- job_name: Ubuntu 22.04 x86, LDC 1.36.0
os: ubuntu-22.04
model: 32
host_dmd: ldc-1.36.0
- job_name: Ubuntu 22.04 x86, LDC 1.35.0
os: ubuntu-22.04
model: 32
host_dmd: ldc-1.35.0
- job_name: Ubuntu 22.04 x86, LDC 1.34.0
os: ubuntu-22.04
model: 32
host_dmd: ldc-1.34.0
- job_name: Ubuntu 22.04 x86, LDC 1.33.0
os: ubuntu-22.04
host_dmd: gdmd-9
disable_debug_for_dmd_unittests: true # no `-debug` - host frontend too old
# macOS
- job_name: macOS 13 x64, DMD (latest)
os: macos-13
host_dmd: dmd
# Disabled because of failure https://issues.dlang.org/show_bug.cgi?id=24518
# - job_name: macOS 13 x64, DMD (coverage)
# os: macos-13
# host_dmd: dmd
# coverage: true
- job_name: macOS 13 x64, DMD (bootstrap)
os: macos-13
xcode: '14.3.1' # work around 'ld: multiple errors: symbol count from symbol table and dynamic symbol table differ' with old bootstrap compiler
# de-facto bootstrap version on OSX
# See: https://github.com/dlang/dmd/pull/13890
host_dmd: dmd-2.099.1
# Windows
- job_name: Windows x64, LDC
os: windows-2022
host_dmd: ldc-latest
- job_name: Windows x86, DMD (latest)
os: windows-2022
host_dmd: dmd-latest
model: 32
host_dmd: ldc-1.33.0
name: ${{ matrix.job_name }}
runs-on: ${{ matrix.os }}
timeout-minutes: 40
Expand Down
1 change: 1 addition & 0 deletions compiler/src/dmd/backend/arm/disasmarm.d
Original file line number Diff line number Diff line change
Expand Up @@ -2764,6 +2764,7 @@ unittest
}

/************************************* Tests ***********************************/
version(none):

unittest
{
Expand Down
6 changes: 5 additions & 1 deletion compiler/src/dmd/common/int128.d
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ alias I = long;
alias U = ulong;
enum Ubits = uint(U.sizeof * 8);

align(16) struct Cent
version (LDC) version (X86) version = LDC_X86;
version (LDC_X86) private enum alignment = U.alignof;
else private enum alignment = 16;

align(alignment) struct Cent
{
U lo; // low 64 bits
U hi; // high 64 bits
Expand Down
1 change: 0 additions & 1 deletion compiler/src/dmd/cparse.d
Original file line number Diff line number Diff line change
Expand Up @@ -6324,7 +6324,6 @@ final class CParser(AST) : Parser!AST
while (*p)
++p;
++p; // advance to start of next line
scanloc.linnum = scanloc.linnum + 1;
}

if (newSymbols.length)
Expand Down
4 changes: 2 additions & 2 deletions compiler/src/dmd/dmodule.d
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,7 @@ extern (C++) final class Module : Package
checkCompiledImport();
members = p.parseModule();
assert(!p.md); // C doesn't have module declarations
numlines = p.scanloc.linnum;
numlines = p.linnum;
}
else
{
Expand All @@ -831,7 +831,7 @@ extern (C++) final class Module : Package
checkCompiledImport();

members = p.parseModuleContent();
numlines = p.scanloc.linnum;
numlines = p.linnum;
}

/* The symbol table into which the module is to be inserted.
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dmd/dstruct.d
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ extern (C++) class StructDeclaration : AggregateDeclaration
extern (D) this(const ref Loc loc, Identifier id, bool inObject)
{
super(loc, id);
zeroInit = false; // assume false until we do semantic processing
// zeroInit = false; // assume false until we do semantic processing
ispod = ThreeState.none;
// For forward references
type = new TypeStruct(this);
Expand Down
41 changes: 24 additions & 17 deletions compiler/src/dmd/dsymbolsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -1848,8 +1848,9 @@ private extern(C++) final class DsymbolSemanticVisitor : Visitor
buf.writeByte(0);
const str = buf.extractSlice()[0 .. len];
const bool doUnittests = global.params.parsingUnittestsRequired();
auto loc = adjustLocForMixin(str, cd.loc, global.params.mixinOut);
scope p = new Parser!ASTCodegen(loc, sc._module, str, false, global.errorSink, &global.compileEnv, doUnittests);
scope p = new Parser!ASTCodegen(sc._module, str, false, global.errorSink, &global.compileEnv, doUnittests);
adjustLocForMixin(str, cd.loc, *p.baseLoc, global.params.mixinOut);
p.linnum = p.baseLoc.startLine;
p.nextToken();

auto d = p.parseDeclDefs(0);
Expand Down Expand Up @@ -5920,34 +5921,40 @@ private CallExp doAtomicOp (string op, Identifier var, Expression arg)
* Set up loc for a parse of a mixin. Append the input text to the mixin.
* Params:
* input = mixin text
* loc = location to adjust
* loc = location of expansion
* baseLoc = location to adjust
* mixinOut = sink for mixin text data
* Returns:
* adjusted loc suitable for Parser
*/

Loc adjustLocForMixin(const(char)[] input, ref const Loc loc, ref Output mixinOut)
void adjustLocForMixin(const(char)[] input, Loc loc, ref BaseLoc baseLoc, ref Output mixinOut)
{
Loc result;
if (mixinOut.doOutput)
{
const lines = mixinOut.bufferLines;
writeMixin(input, loc, mixinOut.bufferLines, *mixinOut.buffer);
result = Loc(mixinOut.name.ptr, lines + 2, loc.charnum);
baseLoc.startLine = lines + 2;
baseLoc.filename = mixinOut.name;
return;
}
else if (loc.filename)

SourceLoc sl = SourceLoc(loc);
if (sl.filename.length == 0)
{
/* Create a pseudo-filename for the mixin string, as it may not even exist
* in the source file.
*/
auto len = strlen(loc.filename) + 7 + (loc.linnum).sizeof * 3 + 1;
char* filename = cast(char*)mem.xmalloc(len);
snprintf(filename, len, "%s-mixin-%d", loc.filename, cast(int)loc.linnum);
result = Loc(filename, loc.linnum, loc.charnum);
// Rare case of compiler-generated mixin exp, e.g. __xtoHash
baseLoc.filename = "";
return;
}
else
result = loc;
return result;

/* Create a pseudo-filename for the mixin string, as it may not even exist
* in the source file.
*/
auto len = sl.filename.length + 7 + (sl.linnum).sizeof * 3 + 1;
char* filename = cast(char*) mem.xmalloc(len);
snprintf(filename, len, "%.*s-mixin-%d", cast(int) sl.filename.length, sl.filename.ptr, cast(int) sl.linnum);
baseLoc.startLine = sl.line;
baseLoc.filename = filename.toDString;
}

/**************************************
Expand Down
5 changes: 3 additions & 2 deletions compiler/src/dmd/expressionsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -7654,8 +7654,9 @@ private extern (C++) final class ExpressionSemanticVisitor : Visitor
const len = buf.length;
const str = buf.extractChars()[0 .. len];
const bool doUnittests = global.params.parsingUnittestsRequired();
auto loc = adjustLocForMixin(str, exp.loc, global.params.mixinOut);
scope p = new Parser!ASTCodegen(loc, sc._module, str, false, global.errorSink, &global.compileEnv, doUnittests);
scope p = new Parser!ASTCodegen(sc._module, str, false, global.errorSink, &global.compileEnv, doUnittests);
adjustLocForMixin(str, exp.loc, *p.baseLoc, global.params.mixinOut);
p.linnum = p.baseLoc.startLine;
p.nextToken();
//printf("p.loc.linnum = %d\n", p.loc.linnum);

Expand Down
45 changes: 20 additions & 25 deletions compiler/src/dmd/frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -380,28 +380,23 @@ enum class MessageStyle : uint8_t
struct Loc final
{
private:
uint32_t _linnum;
uint32_t _charnum;
uint32_t fileIndex;
uint32_t index;
public:
static bool showColumns;
static MessageStyle messageStyle;
static void set(bool showColumns, MessageStyle messageStyle);
Loc(const char* filename, uint32_t linnum, uint32_t charnum);
uint32_t charnum() const;
uint32_t charnum(uint32_t num);
uint32_t linnum() const;
uint32_t linnum(uint32_t num);
const char* filename() const;
void filename(const char* name);
const char* toChars(bool showColumns = Loc::showColumns, MessageStyle messageStyle = Loc::messageStyle) const;
bool equals(const Loc& loc) const;
Loc() :
_linnum(),
_charnum(),
fileIndex()
index(0u)
{
}
Loc(uint32_t index) :
index(index)
{}
};

enum class PASS : uint8_t
Expand Down Expand Up @@ -5402,23 +5397,23 @@ struct UnionExp final
private:
union _AnonStruct_u
{
char exp[30LLU];
char integerexp[40LLU];
char errorexp[30LLU];
char exp[22LLU];
char integerexp[32LLU];
char errorexp[22LLU];
char realexp[48LLU];
char complexexp[64LLU];
char symoffexp[64LLU];
char stringexp[51LLU];
char arrayliteralexp[48LLU];
char assocarrayliteralexp[56LLU];
char structliteralexp[72LLU];
char compoundliteralexp[40LLU];
char nullexp[30LLU];
char dotvarexp[49LLU];
char addrexp[40LLU];
char indexexp[58LLU];
char sliceexp[65LLU];
char vectorexp[53LLU];
char symoffexp[56LLU];
char stringexp[43LLU];
char arrayliteralexp[40LLU];
char assocarrayliteralexp[48LLU];
char structliteralexp[64LLU];
char compoundliteralexp[32LLU];
char nullexp[22LLU];
char dotvarexp[41LLU];
char addrexp[32LLU];
char indexexp[50LLU];
char sliceexp[57LLU];
char vectorexp[45LLU];
};
#pragma pack(pop)

Expand Down
23 changes: 7 additions & 16 deletions compiler/src/dmd/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,9 +417,12 @@ typedef unsigned long long uinteger_t;
struct Loc
{
private:
unsigned _linnum;
unsigned _charnum;
unsigned fileIndex;

#if defined(__linux__) && defined(__i386__)
unsigned int dummy;
#endif

unsigned int index;
public:
static void set(bool showColumns, MessageStyle messageStyle);

Expand All @@ -428,24 +431,12 @@ struct Loc

Loc()
{
_linnum = 0;
_charnum = 0;
fileIndex = 0;
}

Loc(const char *filename, unsigned linnum, unsigned charnum)
{
this->linnum(linnum);
this->charnum(charnum);
this->filename(filename);
index = 0;
}

uint32_t charnum() const;
uint32_t charnum(uint32_t num);
uint32_t linnum() const;
uint32_t linnum(uint32_t num);
const char *filename() const;
void filename(const char *name);

const char *toChars(
bool showColumns = Loc::showColumns,
Expand Down
Loading
Loading