Skip to content

Commit f7f1e23

Browse files
committed
Unresolved differences between gdc/dmd front ends
1 parent b2e2f80 commit f7f1e23

19 files changed

Lines changed: 360 additions & 56 deletions

src/aggregate.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,6 @@ struct BaseClass
218218
void copyBaseInterfaces(BaseClasses *);
219219
};
220220

221-
#define CLASSINFO_SIZE_64 0x98 // value of ClassInfo.size
222-
#define CLASSINFO_SIZE (0x3C+12+4) // value of ClassInfo.size
223-
224221
struct ClassFlags
225222
{
226223
typedef unsigned Type;

src/arraytypes.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,11 @@ typedef Array<class GotoStatement *> GotoStatements;
6868

6969
typedef Array<class TemplateInstance *> TemplateInstances;
7070

71+
#ifdef IN_GCC
72+
typedef Array<struct Label *> Blocks;
73+
#else
7174
typedef Array<struct block *> Blocks;
75+
#endif
7276

7377
typedef Array<struct Symbol *> Symbols;
7478

src/declaration.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -534,10 +534,10 @@ class FuncDeclaration : public Declaration
534534
// scopes from having the same name
535535
VarDeclaration *vthis; // 'this' parameter (member and nested)
536536
VarDeclaration *v_arguments; // '_arguments' parameter
537-
#ifdef IN_GCC
537+
#ifdef IN_GCC // %%
538538
VarDeclaration *v_arguments_var; // '_arguments' variable
539539
VarDeclaration *v_argptr; // '_argptr' variable
540-
#endif
540+
#endif // %%
541541
VarDeclaration *v_argsave; // save area for args passed in registers for variadic functions
542542
VarDeclarations *parameters; // Array of VarDeclaration's for parameters
543543
DsymbolTable *labtab; // statement label symbol table

src/expression.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,12 @@ Expression *getRightThis(Loc loc, Scope *sc, AggregateDeclaration *ad,
118118
{
119119
//printf("rewriting e1 to %s's this\n", f->toChars());
120120
n++;
121+
#ifdef IN_GCC
122+
if (n > 1)
123+
e1 = new VarExp(loc, f->vthis);
124+
#else
121125
e1 = new VarExp(loc, f->vthis);
126+
#endif
122127
}
123128
else
124129
{

src/func.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -297,10 +297,10 @@ FuncDeclaration::FuncDeclaration(Loc loc, Loc endloc, Identifier *id, StorageCla
297297
localsymtab = NULL;
298298
vthis = NULL;
299299
v_arguments = NULL;
300-
#ifdef IN_GCC
300+
#ifdef IN_GCC // %%
301301
v_argptr = NULL;
302302
v_arguments_var = NULL;
303-
#endif
303+
#endif // %%
304304
v_argsave = NULL;
305305
parameters = NULL;
306306
labtab = NULL;
@@ -1333,7 +1333,7 @@ void FuncDeclaration::semantic3(Scope *sc)
13331333
// Declare hidden variable _arguments[] and _argptr
13341334
if (f->varargs == 1)
13351335
{
1336-
#ifndef IN_GCC
1336+
#ifndef IN_GCC // %%
13371337
if (global.params.is64bit && !global.params.isWindows)
13381338
{
13391339
// Declare save area for varargs registers
@@ -1353,7 +1353,7 @@ void FuncDeclaration::semantic3(Scope *sc)
13531353
v_argsave->parent = this;
13541354
}
13551355
}
1356-
#endif
1356+
#endif // %%
13571357

13581358
if (f->linkage == LINKd)
13591359
{
@@ -1885,11 +1885,11 @@ void FuncDeclaration::semantic3(Scope *sc)
18851885
if (argptr)
18861886
{
18871887
// Initialize _argptr
1888-
#ifdef IN_GCC
1888+
#ifdef IN_GCC // %%
18891889
// Handled in FuncDeclaration::toObjFile
18901890
v_argptr = argptr;
18911891
v_argptr->init = new VoidInitializer(loc);
1892-
#else
1892+
#else // %%
18931893
Type *t = argptr->type;
18941894
if (global.params.is64bit && !global.params.isWindows)
18951895
{
@@ -1970,10 +1970,10 @@ void FuncDeclaration::semantic3(Scope *sc)
19701970

19711971
if (_arguments)
19721972
{
1973-
#ifdef IN_GCC
1973+
#ifdef IN_GCC // %%
19741974
v_arguments_var = _arguments;
19751975
v_arguments_var->init = new VoidInitializer(loc);
1976-
#endif
1976+
#endif // %%
19771977
/* Advance to elements[] member of TypeInfo_Tuple with:
19781978
* _arguments = v_arguments.elements;
19791979
*/

src/globals.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,13 @@ struct Param
121121
const char *moduleDepsFile; // filename for deps output
122122
OutBuffer *moduleDeps; // contents to be written to deps file
123123

124+
#ifdef IN_GCC
125+
const char *makeDepsFile; // filename for make deps output
126+
OutBuffer *makeDeps; // contents to be written to make deps file
127+
char makeDepsStyle; // 0: include system header files
128+
// 1: ignore system header files
129+
#endif
130+
124131
// Hidden debug switches
125132
bool debugb;
126133
bool debugc;

src/interpret.c

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -683,6 +683,16 @@ class CtfeCompiler : public Visitor
683683
// we can't compile asm statements
684684
}
685685

686+
#ifdef IN_GCC
687+
void visit(ExtAsmStatement *s)
688+
{
689+
#if LOGCOMPILE
690+
printf("%s ExtAsmStatement::ctfeCompile\n", s->loc.toChars());
691+
#endif
692+
// we can't compile ext asm statements
693+
}
694+
#endif
695+
686696
void ctfeCompile(Statement *s)
687697
{
688698
s->accept(this);
@@ -1938,6 +1948,24 @@ class Interpreter : public Visitor
19381948
result = CTFEExp::cantexp;
19391949
}
19401950

1951+
#ifdef IN_GCC
1952+
void visit(ExtAsmStatement *s)
1953+
{
1954+
#if LOG
1955+
printf("%s ExtAsmStatement::interpret()\n", s->loc.toChars());
1956+
#endif
1957+
if (istate->start)
1958+
{
1959+
if (istate->start != s)
1960+
return;
1961+
istate->start = NULL;
1962+
}
1963+
1964+
s->error("extended asm statements cannot be interpreted at compile time");
1965+
result = EXP_CANT_INTERPRET;
1966+
}
1967+
#endif
1968+
19411969
void visit(ImportStatement *s)
19421970
{
19431971
#if LOG

src/magicport.json

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,6 @@
143143
[
144144
"function isf",
145145
"struct BaseClass",
146-
"variable CLASSINFO_SIZE_64",
147-
"variable CLASSINFO_SIZE",
148146
"struct ClassFlags",
149147
"struct ClassDeclaration",
150148
"struct InterfaceDeclaration"

src/mtype.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ class TypeBasic;
3939
class Parameter;
4040

4141
// Back end
42-
#ifdef IN_GCC
42+
#ifdef IN_GCC // %%
4343
typedef union tree_node type;
44-
#else
44+
#else // %%
4545
typedef struct TYPE type;
46-
#endif
46+
#endif // %%
4747

4848
void semanticTypeInfo(Scope *sc, Type *t);
4949
MATCH deduceType(RootObject *o, Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes, unsigned *wm = NULL, size_t inferStart = 0);

0 commit comments

Comments
 (0)