+2018-11-05 Iain Buclaw <ibuclaw@gdcproject.org>
+
+ PR d/87865
+ * d-system.h: New file.
+
2018-11-01 Jakub Jelinek <jakub@redhat.com>
PR d/87824
--- /dev/null
+/* d-system.h -- DMD frontend inclusion of gcc header files.
+ * Copyright (C) 2018 Free Software Foundation, Inc.
+ *
+ * GCC is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GCC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GCC; see the file COPYING3. If not see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GCC_D_SYSTEM_H
+#define GCC_D_SYSTEM_H
+
+#include "config.h"
+#include "system.h"
+
+/* Used by the dmd front-end to determine if we have POSIX-style IO. */
+#define POSIX (__linux__ || __GLIBC__ || __gnu_hurd__ || __APPLE__ \
+ || __FreeBSD__ || __OpenBSD__ || __DragonFly__ || __sun)
+
+/* Forward assert invariants to gcc_assert. */
+#undef assert
+#define assert(EXPR) gcc_assert(EXPR)
+
+/* Forward ctype.h macros used by the dmd front-end to safe-ctype.h. */
+#undef isalpha
+#define isalpha(c) ISALPHA(c)
+#undef isalnum
+#define isalnum(c) ISALNUM(c)
+#undef isdigit
+#define isdigit(c) ISDIGIT(c)
+#undef islower
+#define islower(c) ISLOWER(c)
+#undef isprint
+#define isprint(c) ISPRINT(c)
+#undef isspace
+#define isspace(c) ISSPACE(c)
+#undef isupper
+#define isupper(c) ISUPPER(c)
+#undef isxdigit
+#define isxdigit(c) ISXDIGIT(c)
+#undef tolower
+#define tolower(c) TOLOWER(c)
+
+#endif /* GCC_D_SYSTEM_H */
--- /dev/null
+6243fa6d2ceab4615a9fe21c5bc9484e52bb2d1e
+
+The first line of this file holds the git revision number of the last
+merge done from the dlang/dmd repository.
* https://github.com/D-Programming-Language/dmd/blob/master/src/access.c
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-
+#include "root/dsystem.h"
#include "root/root.h"
#include "root/rmem.h"
void semantic(Scope *sc);
void semanticTypeInfoMembers();
Dsymbol *search(const Loc &loc, Identifier *ident, int flags = SearchLocalsOnly);
- const char *kind();
+ const char *kind() const;
void finalizeSize();
bool fit(Loc loc, Scope *sc, Expressions *elements, Type *stype);
bool isPOD();
public:
UnionDeclaration(Loc loc, Identifier *id);
Dsymbol *syntaxCopy(Dsymbol *s);
- const char *kind();
+ const char *kind() const;
UnionDeclaration *isUnionDeclaration() { return this; }
void accept(Visitor *v) { v->visit(this); }
virtual bool isCPPinterface() const;
bool isAbstract();
virtual int vtblOffset() const;
- const char *kind();
+ const char *kind() const;
void addLocalClass(ClassDeclarations *);
void semantic(Scope *sc);
bool isBaseOf(ClassDeclaration *cd, int *poffset);
bool isBaseOf(BaseClass *bc, int *poffset);
- const char *kind();
+ const char *kind() const;
int vtblOffset() const;
bool isCPPinterface() const;
bool isCOMinterface() const;
* https://github.com/D-Programming-Language/dmd/blob/master/src/aliasthis.c
*/
-#include <stdio.h>
-#include <assert.h>
+#include "root/dsystem.h"
#include "mars.h"
#include "identifier.h"
semanticRun = PASSsemanticdone;
}
-const char *AliasThis::kind()
+const char *AliasThis::kind() const
{
return "alias this";
}
Dsymbol *syntaxCopy(Dsymbol *);
void semantic(Scope *sc);
- const char *kind();
+ const char *kind() const;
AliasThis *isAliasThis() { return this; }
void accept(Visitor *v) { v->visit(this); }
};
* https://github.com/D-Programming-Language/dmd/blob/master/src/apply.c
*/
-#include <stdio.h>
-#include <assert.h>
+#include "root/dsystem.h"
#include "mars.h"
#include "expression.h"
* https://github.com/D-Programming-Language/dmd/blob/master/src/argtypes.c
*/
-#include <stdio.h>
-#include <assert.h>
-
-#include "checkedint.h"
+#include "root/dsystem.h"
+#include "root/checkedint.h"
#include "mars.h"
#include "dsymbol.h"
* https://github.com/D-Programming-Language/dmd/blob/master/src/arrayop.c
*/
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
+#include "root/dsystem.h"
#include "root/rmem.h"
#include "root/aav.h"
* https://github.com/D-Programming-Language/dmd/blob/master/src/attrib.c
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h> // memcpy()
-
+#include "root/dsystem.h" // memcmp()
#include "root/rmem.h"
#include "mars.h"
Dsymbols *cache;
Dsymbol *syntaxCopy(Dsymbol *s);
- bool oneMember(Dsymbol *ps, Identifier *ident);
+ bool oneMember(Dsymbol **ps, Identifier *ident);
Dsymbols *include(Scope *sc, ScopeDsymbol *sds);
void addMember(Scope *sc, ScopeDsymbol *sds);
- void addComment(const char *comment);
+ void addComment(const utf8_t *comment);
void setScope(Scope *sc);
void importAll(Scope *sc);
void semantic(Scope *sc);
* https://github.com/D-Programming-Language/dmd/blob/master/src/canthrow.c
*/
-#include <stdio.h>
-#include <assert.h>
+#include "root/dsystem.h"
#include "mars.h"
#include "init.h"
* https://github.com/D-Programming-Language/dmd/blob/master/src/clone.c
*/
-#include <stdio.h>
-#include <assert.h>
-#include <new>
-
+#include "root/dsystem.h"
#include "root/root.h"
+
#include "aggregate.h"
#include "scope.h"
#include "mtype.h"
#pragma once
+#include "root/array.h"
+
// This file contains a data structure that describes a back-end compiler
// and implements compiler-specific actions.
class Type;
struct Scope;
+// DMD-generated module `__entrypoint` where the C main resides
+extern Module *entrypoint;
+// Module in which the D main is
+extern Module *rootHasMain;
+
struct Compiler
{
// CTFE support for cross-compilation.
* https://github.com/D-Programming-Language/dmd/blob/master/src/cond.c
*/
-#include <stdio.h>
-#include <assert.h>
-#include <string.h> // strcmp()
+#include "root/dsystem.h" // strcmp()
#include "mars.h"
#include "id.h"
* https://github.com/D-Programming-Language/dmd/blob/master/src/constfold.c
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h> // mem{cpy|set|cmp}()
+#include "root/dsystem.h" // mem{cpy|set|cmp}()
+
+#ifndef IN_GCC
#include <math.h>
-#include <new>
+#endif
#include "root/rmem.h"
#include "root/root.h"
{
real_t r2 = e2->toReal();
+#ifdef IN_GCC
c = complex_t(e1->toReal() % r2, e1->toImaginary() % r2);
+#else
+ c = complex_t(::fmodl(e1->toReal(), r2), ::fmodl(e1->toImaginary(), r2));
+#endif
}
else if (e2->type->isimaginary())
{
real_t i2 = e2->toImaginary();
+#ifdef IN_GCC
c = complex_t(e1->toReal() % i2, e1->toImaginary() % i2);
+#else
+ c = complex_t(::fmodl(e1->toReal(), i2), ::fmodl(e1->toImaginary(), i2));
+#endif
}
else
assert(0);
* enter `C++, mangling` as the keywords.
*/
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
+#include "root/dsystem.h"
#include "mars.h"
#include "dsymbol.h"
{
Objects components; // array of components available for substitution
OutBuffer *buf; // append the mangling to buf[]
+ public:
Loc loc; // location for use in error messages
- public:
// Write <seq-id> to buf
void write_seq_id(size_t i)
{
* https://github.com/D-Programming-Language/dmd/blob/master/src/ctfeexpr.c
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h> // mem{cpy|set}()
-#include <new>
-
+#include "root/dsystem.h" // mem{cpy|set}()
#include "root/rmem.h"
#include "mars.h"
* https://github.com/D-Programming-Language/dmd/blob/master/src/cast.c
*/
-#include <stdio.h>
-#include <assert.h>
-#include <string.h> // mem{set|cpy}()
-
+#include "root/dsystem.h" // mem{set|cpy}()
#include "root/rmem.h"
#include "mars.h"
* https://github.com/D-Programming-Language/dmd/blob/master/src/class.c
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h> // mem{cpy|set}()
-
+#include "root/dsystem.h" // mem{cpy|set}()
#include "root/root.h"
#include "root/rmem.h"
/****************************************
*/
-const char *ClassDeclaration::kind()
+const char *ClassDeclaration::kind() const
{
return "class";
}
/*******************************************
*/
-const char *InterfaceDeclaration::kind()
+const char *InterfaceDeclaration::kind() const
{
return "interface";
}
* https://github.com/D-Programming-Language/dmd/blob/master/src/declaration.c
*/
-#include <stdio.h>
-#include <assert.h>
-
-#include "checkedint.h"
+#include "root/dsystem.h"
+#include "root/checkedint.h"
#include "errors.h"
#include "init.h"
{
}
-const char *Declaration::kind()
+const char *Declaration::kind() const
{
return "declaration";
}
return NULL;
}
-const char *TupleDeclaration::kind()
+const char *TupleDeclaration::kind() const
{
return "tuple";
}
return true;
}
-const char *AliasDeclaration::kind()
+const char *AliasDeclaration::kind() const
{
return "alias";
}
}
}
-const char *OverDeclaration::kind()
+const char *OverDeclaration::kind() const
{
return "overload alias"; // todo
}
//printf(" addField '%s' to '%s' at offset %d, size = %d\n", toChars(), ad->toChars(), offset, memsize);
}
-const char *VarDeclaration::kind()
+const char *VarDeclaration::kind() const
{
return "variable";
}
Declaration(Identifier *id);
void semantic(Scope *sc);
- const char *kind();
+ const char *kind() const;
d_uns64 size(Loc loc);
int checkModify(Loc loc, Scope *sc, Type *t, Expression *e1, int flag);
TupleDeclaration(Loc loc, Identifier *ident, Objects *objects);
Dsymbol *syntaxCopy(Dsymbol *);
- const char *kind();
+ const char *kind() const;
Type *getType();
Dsymbol *toAlias2();
bool needThis();
void semantic(Scope *sc);
void aliasSemantic(Scope *sc);
bool overloadInsert(Dsymbol *s);
- const char *kind();
+ const char *kind() const;
Type *getType();
Dsymbol *toAlias();
Dsymbol *toAlias2();
bool hasOverloads;
OverDeclaration(Identifier *ident, Dsymbol *s, bool hasOverloads = true);
- const char *kind();
+ const char *kind() const;
void semantic(Scope *sc);
bool equals(RootObject *o);
bool overloadInsert(Dsymbol *s);
void semantic(Scope *sc);
void setFieldOffset(AggregateDeclaration *ad, unsigned *poffset, bool isunion);
void semantic2(Scope *sc);
- const char *kind();
+ const char *kind() const;
AggregateDeclaration *isThis();
bool needThis();
bool isExport() const;
virtual bool isFinalFunc();
virtual bool addPreInvariant();
virtual bool addPostInvariant();
- const char *kind();
+ const char *kind() const;
FuncDeclaration *isUnique();
bool checkNestedReference(Scope *sc, Loc loc);
bool needsClosure();
FuncAliasDeclaration(Identifier *ident, FuncDeclaration *funcalias, bool hasOverloads = true);
FuncAliasDeclaration *isFuncAliasDeclaration() { return this; }
- const char *kind();
+ const char *kind() const;
FuncDeclaration *toAliasFunc();
void accept(Visitor *v) { v->visit(this); }
void modifyReturns(Scope *sc, Type *tret);
FuncLiteralDeclaration *isFuncLiteralDeclaration() { return this; }
- const char *kind();
+ const char *kind() const;
const char *toPrettyChars(bool QualifyTypes = false);
void accept(Visitor *v) { v->visit(this); }
};
CtorDeclaration(Loc loc, Loc endloc, StorageClass stc, Type *type);
Dsymbol *syntaxCopy(Dsymbol *);
void semantic(Scope *sc);
- const char *kind();
+ const char *kind() const;
const char *toChars();
bool isVirtual();
bool addPreInvariant();
DtorDeclaration(Loc loc, Loc endloc, StorageClass stc, Identifier *id);
Dsymbol *syntaxCopy(Dsymbol *);
void semantic(Scope *sc);
- const char *kind();
+ const char *kind() const;
const char *toChars();
bool isVirtual();
bool addPreInvariant();
NewDeclaration(Loc loc, Loc endloc, StorageClass stc, Parameters *arguments, int varargs);
Dsymbol *syntaxCopy(Dsymbol *);
void semantic(Scope *sc);
- const char *kind();
+ const char *kind() const;
bool isVirtual();
bool addPreInvariant();
bool addPostInvariant();
DeleteDeclaration(Loc loc, Loc endloc, StorageClass stc, Parameters *arguments);
Dsymbol *syntaxCopy(Dsymbol *);
void semantic(Scope *sc);
- const char *kind();
+ const char *kind() const;
bool isDelete();
bool isVirtual();
bool addPreInvariant();
* https://github.com/D-Programming-Language/dmd/blob/master/src/delegatize.c
*/
-#include <stdio.h>
-#include <assert.h>
+#include "root/dsystem.h"
#include "mars.h"
#include "expression.h"
* https://github.com/D-Programming-Language/dmd/blob/master/src/enum.c
*/
-#include <stdio.h>
-#include <assert.h>
-
+#include "root/dsystem.h"
#include "root/root.h"
+
#include "errors.h"
#include "enum.h"
#include "mtype.h"
return type;
}
-const char *EnumDeclaration::kind()
+const char *EnumDeclaration::kind() const
{
return "enum";
}
origType ? origType->syntaxCopy() : NULL);
}
-const char *EnumMember::kind()
+const char *EnumMember::kind() const
{
return "enum member";
}
* https://github.com/D-Programming-Language/dmd/blob/master/src/import.c
*/
-#include <stdio.h>
-#include <assert.h>
-
+#include "root/dsystem.h"
#include "root/root.h"
+
#include "mars.h"
#include "dsymbol.h"
#include "import.h"
aliases.push(alias);
}
-const char *Import::kind()
+const char *Import::kind() const
{
return isstatic ? "static import" : "import";
}
* https://github.com/D-Programming-Language/dmd/blob/master/src/interpret.c
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <string.h> // mem{cpy|set}()
-#include <new>
-
+#include "root/dsystem.h" // mem{cpy|set}()
#include "root/rmem.h"
#include "mars.h"
/* Simple macro text processor.
*/
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <ctype.h>
-#include <assert.h>
+#include "root/dsystem.h"
#include "mars.h"
#include "errors.h"
* https://github.com/D-Programming-Language/dmd/blob/master/src/mangle.c
*/
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <assert.h>
-
+#include "root/dsystem.h"
#include "root/root.h"
#include "mangle.h"
* https://github.com/D-Programming-Language/dmd/blob/master/src/module.c
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
+#include "root/dsystem.h"
+#include "root/rmem.h"
#include "mars.h"
#include "module.h"
#include "lexer.h"
#include "attrib.h"
-// For getcwd()
-#if _WIN32
-#include <direct.h>
-#endif
-#if POSIX
-#include <unistd.h>
-#endif
-
AggregateDeclaration *Module::moduleinfo;
Module *Module::rootModule;
docfile->remove();
}
-const char *Module::kind()
+const char *Module::kind() const
{
return "module";
}
{
::error(loc, "cannot find source code for runtime library file 'object.d'");
errorSupplemental(loc, "dmd might not be correctly installed. Run 'dmd -man' for installation instructions.");
- errorSupplemental(loc, "config file: %s", FileName::canonicalName(global.inifilename));
+ const char *dmdConfFile = FileName::canonicalName(global.inifilename);
+ errorSupplemental(loc, "config file: %s", dmdConfFile ? dmdConfFile : "not found");
}
else
{
}
else
{
- todo = (Dsymbol **)malloc(len * sizeof(Dsymbol *));
- assert(todo);
+ todo = (Dsymbol **)mem.xmalloc(len * sizeof(Dsymbol *));
todoalloc = todo;
}
memcpy(todo, deferred.tdata(), len * sizeof(Dsymbol *));
}
-const char *Package::kind()
+const char *Package::kind() const
{
return "package";
}
// This implements the Ddoc capability.
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <ctype.h>
-#include <assert.h>
-
+#include "root/dsystem.h"
#include "root/rmem.h"
#include "root/root.h"
#include "root/port.h"
#pragma once
+#include "root/dsystem.h"
+
+class Module;
+struct OutBuffer;
+
void escapeDdocString(OutBuffer *buf, size_t start);
void gendocfile(Module *m);
* https://github.com/D-Programming-Language/dmd/blob/master/src/scope.c
*/
-#include <stdio.h>
-#include <assert.h>
-#include <string.h> // strlen()
-
+#include "root/dsystem.h" // strlen()
#include "root/root.h"
#include "root/rmem.h"
#include "root/speller.h"
* https://github.com/D-Programming-Language/dmd/blob/master/src/struct.c
*/
-#include <stdio.h>
-#include <assert.h>
-
+#include "root/dsystem.h"
#include "root/root.h"
+
#include "errors.h"
#include "aggregate.h"
#include "scope.h"
return (ispod == ISPODyes);
}
-const char *StructDeclaration::kind()
+const char *StructDeclaration::kind() const
{
return "struct";
}
return StructDeclaration::syntaxCopy(ud);
}
-const char *UnionDeclaration::kind()
+const char *UnionDeclaration::kind() const
{
return "union";
}
* https://github.com/D-Programming-Language/dmd/blob/master/src/dsymbol.c
*/
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include <limits.h>
-
+#include "root/dsystem.h"
#include "root/rmem.h"
#include "root/speller.h"
#include "root/aav.h"
++complength;
// Allocate temporary array comp[]
- const char **comp = (const char **)malloc(complength * sizeof(char**));
- if (!comp)
- Mem::error();
+ const char **comp = (const char **)mem.xmalloc(complength * sizeof(char**));
// Fill in comp[] and compute length of final result
size_t length = 0;
return getLoc().toChars();
}
-const char *Dsymbol::kind()
+const char *Dsymbol::kind() const
{
return "symbol";
}
a.push(s);
}
-const char *OverloadSet::kind()
+const char *OverloadSet::kind() const
{
return "overloadset";
}
}
}
-const char *ScopeDsymbol::kind()
+const char *ScopeDsymbol::kind() const
{
return "ScopeDsymbol";
}
virtual Identifier *getIdent();
virtual const char *toPrettyChars(bool QualifyTypes = false);
- virtual const char *kind();
+ virtual const char *kind() const;
virtual Dsymbol *toAlias(); // resolve real symbol
virtual Dsymbol *toAlias2();
virtual int apply(Dsymbol_apply_ft_t fp, void *param);
virtual bool isPackageAccessible(Package *p, Prot protection, int flags = 0);
bool isforwardRef();
static void multiplyDefined(Loc loc, Dsymbol *s1, Dsymbol *s2);
- const char *kind();
+ const char *kind() const;
FuncDeclaration *findGetMembers();
virtual Dsymbol *symtabInsert(Dsymbol *s);
virtual Dsymbol *symtabLookup(Dsymbol *s, Identifier *id);
OverloadSet(Identifier *ident, OverloadSet *os = NULL);
void push(Dsymbol *s);
OverloadSet *isOverloadSet() { return this; }
- const char *kind();
+ const char *kind() const;
void accept(Visitor *v) { v->visit(this); }
};
Dsymbol *symtabLookup(Dsymbol *s, Identifier *id);
void importScope(Dsymbol *s, Prot protection);
void semantic(Scope *sc);
- const char *kind();
+ const char *kind() const;
ForwardingScopeDsymbol *isForwardingScopeDsymbol() { return this; }
};
// Handle template implementation
-#include <stdio.h>
-#include <assert.h>
-
+#include "root/dsystem.h"
#include "root/root.h"
#include "root/aav.h"
#include "root/rmem.h"
*/
}
-const char *TemplateDeclaration::kind()
+const char *TemplateDeclaration::kind() const
{
return (onemember && onemember->isAggregateDeclaration())
? onemember->kind()
return inst;
}
-const char *TemplateInstance::kind()
+const char *TemplateInstance::kind() const
{
return "template instance";
}
}
}
-const char *TemplateMixin::kind()
+const char *TemplateMixin::kind() const
{
return "mixin";
}
* https://github.com/D-Programming-Language/dmd/blob/master/src/version.c
*/
-#include <stdio.h>
-#include <assert.h>
-
+#include "root/dsystem.h"
#include "root/root.h"
#include "identifier.h"
semanticRun = PASSsemanticdone;
}
-const char *DebugSymbol::kind()
+const char *DebugSymbol::kind() const
{
return "debug";
}
semanticRun = PASSsemanticdone;
}
-const char *VersionSymbol::kind()
+const char *VersionSymbol::kind() const
{
return "version";
}
* https://github.com/D-Programming-Language/dmd/blob/master/src/entity.c
*/
-#include <string.h>
-#include <ctype.h>
-
+#include "root/dsystem.h"
#include "root/port.h"
/*********************************************
void semantic(Scope *sc);
bool oneMember(Dsymbol **ps, Identifier *ident);
Type *getType();
- const char *kind();
+ const char *kind() const;
Dsymbol *search(const Loc &loc, Identifier *ident, int flags = SearchLocalsOnly);
bool isDeprecated(); // is Dsymbol deprecated?
Prot prot();
EnumMember(Loc loc, Identifier *id, Expression *value, Type *origType);
Dsymbol *syntaxCopy(Dsymbol *s);
- const char *kind();
+ const char *kind() const;
void semantic(Scope *sc);
Expression *getVarExp(Loc loc, Scope *sc);
#pragma once
+#include "root/dsystem.h"
#include "globals.h"
bool isConsoleColorSupported();
* https://github.com/D-Programming-Language/dmd/blob/master/src/expression.c
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <math.h>
-#include <assert.h>
-
+#include "root/dsystem.h"
#include "root/rmem.h"
#include "root/root.h"
Expression *copy();
private:
+ // Ensure that the union is suitably aligned.
+#if defined(__GNUC__) || defined(__clang__)
+ __attribute__((aligned(8)))
+#elif defined(_MSC_VER)
+ __declspec(align(8))
+#elif defined(__DMC__)
+ #pragma pack(8)
+#endif
union
{
char exp [sizeof(Expression)];
char addrexp [sizeof(AddrExp)];
char indexexp [sizeof(IndexExp)];
char sliceexp [sizeof(SliceExp)];
-
- // Ensure that the union is suitably aligned.
- real_t for_alignment_only;
} u;
+#if defined(__DMC__)
+ #pragma pack()
+#endif
};
/****************************************************************/
* http://www.boost.org/LICENSE_1_0.txt
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <math.h>
-#include <assert.h>
-
+#include "root/dsystem.h"
#include "root/rmem.h"
#include "root/root.h"
* https://github.com/D-Programming-Language/dmd/blob/master/src/func.c
*/
-#include <stdio.h>
-#include <assert.h>
+#include "root/dsystem.h"
#include "mars.h"
#include "init.h"
error("parameters must be main() or main(string[] args)");
}
-const char *FuncDeclaration::kind()
+const char *FuncDeclaration::kind() const
{
return generated ? "generated function" : "function";
}
userAttribDecl = funcalias->userAttribDecl;
}
-const char *FuncAliasDeclaration::kind()
+const char *FuncAliasDeclaration::kind() const
{
return "function alias";
}
((TypeFunction *)type)->next = tret;
}
-const char *FuncLiteralDeclaration::kind()
+const char *FuncLiteralDeclaration::kind() const
{
return (tok != TOKfunction) ? "delegate" : "function";
}
}
}
-const char *CtorDeclaration::kind()
+const char *CtorDeclaration::kind() const
{
return "constructor";
}
return false;
}
-const char *DtorDeclaration::kind()
+const char *DtorDeclaration::kind() const
{
return "destructor";
}
FuncDeclaration::semantic(sc);
}
-const char *NewDeclaration::kind()
+const char *NewDeclaration::kind() const
{
return "allocator";
}
FuncDeclaration::semantic(sc);
}
-const char *DeleteDeclaration::kind()
+const char *DeleteDeclaration::kind() const
{
return "deallocator";
}
extern Global global;
-// Because int64_t and friends may be any integral type of the
-// correct size, we have to explicitly ask for the correct
-// integer type to get the correct mangling with ddmd
-#if __LP64__
// Be careful not to care about sign when using dinteger_t
// use this instead of integer_t to
// avoid conflicts with system #include's
-typedef unsigned long dinteger_t;
+typedef uint64_t dinteger_t;
// Signed and unsigned variants
-typedef long sinteger_t;
-typedef unsigned long uinteger_t;
-#else
-typedef unsigned long long dinteger_t;
-typedef long long sinteger_t;
-typedef unsigned long long uinteger_t;
-#endif
+typedef int64_t sinteger_t;
+typedef uint64_t uinteger_t;
typedef int8_t d_int8;
typedef uint8_t d_uns8;
// Routines to emit header files
-#include <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-
+#include "root/dsystem.h"
#include "root/rmem.h"
#include "mars.h"
(ie, 8 chars more than mantissa). Plus one for trailing \0.
Plus one for rounding. */
const size_t BUFFER_LEN = sizeof(value) * 3 + 8 + 1 + 1;
- char buffer[BUFFER_LEN] = {};
+ char buffer[BUFFER_LEN];
+ memset(buffer, 0, BUFFER_LEN);
CTFloat::sprint(buffer, 'g', value);
assert(strlen(buffer) < BUFFER_LEN);
#pragma once
-#include <string.h> // memset()
-
+#include "root/dsystem.h" // memset()
#include "dsymbol.h"
void genhdrfile(Module *m);
* https://github.com/D-Programming-Language/dmd/blob/master/src/identifier.c
*/
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-
+#include "root/dsystem.h"
#include "root/root.h"
+
#include "identifier.h"
#include "mars.h"
#include "id.h"
// id.h
// id.c
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
+#include "root/dsystem.h"
struct Msgtable
{
* https://github.com/D-Programming-Language/dmd/blob/master/src/impcnvgen.c
*/
-#include <stdio.h>
-#include <stdlib.h>
+#include "root/dsystem.h"
#include "mtype.h"
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <assert.h>
-#include <string.h>
+#include "root/dsystem.h"
#include "mars.h"
Import(Loc loc, Identifiers *packages, Identifier *id, Identifier *aliasId,
int isstatic);
void addAlias(Identifier *name, Identifier *alias);
- const char *kind();
+ const char *kind() const;
Prot prot();
Dsymbol *syntaxCopy(Dsymbol *s); // copy only syntax trees
void load(Scope *sc);
* https://github.com/D-Programming-Language/dmd/blob/master/src/init.c
*/
-#include <stdio.h>
-#include <assert.h>
+#include "root/dsystem.h"
+#include "root/checkedint.h"
-#include "checkedint.h"
#include "mars.h"
#include "init.h"
#include "expression.h"
* http://www.boost.org/LICENSE_1_0.txt
*/
-#include "checkedint.h"
+#include "root/checkedint.h"
#include "mars.h"
#include "init.h"
#include "expression.h"
* https://github.com/D-Programming-Language/dmd/blob/master/src/intrange.c
*/
-#include <stddef.h>
-#include <stdint.h>
+#include "root/dsystem.h"
#include "intrange.h"
#include "mars.h"
// This implements the JSON capability.
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-
+#include "root/dsystem.h"
#include "root/rmem.h"
#include "mars.h"
/* Lexical Analyzer */
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdarg.h>
-#include <errno.h>
-#include <wchar.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <time.h> // for time() and ctime()
-
+#include "root/dsystem.h" // for time() and ctime()
#include "root/rmem.h"
#include "mars.h"
#pragma once
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-#include <ctype.h>
-
+#include "root/dsystem.h"
#include "root/root.h"
*/
-#include <stdio.h>
-#include <stdint.h>
-#include <stdarg.h>
+#include "root/dsystem.h"
#ifdef __DMC__
#ifdef DEBUG
Module *mod; // != NULL if isPkgMod == PKGmodule
Package(Identifier *ident);
- const char *kind();
+ const char *kind() const;
static DsymbolTable *resolve(Identifiers *packages, Dsymbol **pparent, Package **ppkg);
static Module *load(Loc loc, Identifiers *packages, Identifier *ident);
- const char *kind();
+ const char *kind() const;
File *setOutfile(const char *name, const char *dir, const char *arg, const char *ext);
void setDocfile();
bool read(Loc loc); // read file, returns 'true' if succeed, 'false' otherwise.
* https://github.com/D-Programming-Language/dmd/blob/master/src/mtype.c
*/
-#define __C99FEATURES__ 1 // Needed on Solaris for NaN and more
-#define __USE_ISOC99 1 // so signbit() gets defined
-
-#include <math.h>
-#include <stdio.h>
-#include <assert.h>
-#include <float.h>
-
-#if _MSC_VER
-#include <malloc.h>
-#include <limits>
-#elif __MINGW32__
-#include <malloc.h>
-#endif
-
-#include "checkedint.h"
+#include "root/dsystem.h"
+#include "root/checkedint.h"
#include "root/rmem.h"
#include "mars.h"
// Allocate buffer on stack, fail over to using malloc()
char namebuf[128];
size_t namelen = 19 + sizeof(len) * 3 + len + 1;
- char *name = namelen <= sizeof(namebuf) ? namebuf : (char *)malloc(namelen);
- assert(name);
+ char *name = namelen <= sizeof(namebuf) ? namebuf : (char *)mem.xmalloc(namelen);
sprintf(name, "_D%lluTypeInfo_%s6__initZ", (unsigned long long) 9 + len, buf.data);
//printf("%p, deco = %s, name = %s\n", this, deco, name);
static unsigned buildSR(bool returnByRef, StorageClass stc)
{
unsigned result;
- switch (stc & (STCref | STCscope | STCreturn))
- {
- case 0: result = SRNone; break;
- case STCref: result = SRRef; break;
- case STCscope: result = SRScope; break;
- case STCreturn | STCref: result = SRReturnRef; break;
- case STCreturn | STCscope: result = SRReturnScope; break;
- case STCref | STCscope: result = SRRefScope; break;
- case STCreturn | STCref | STCscope:
- result = returnByRef ? SRReturnRef_Scope : SRRef_ReturnScope;
- break;
- default:
- assert(0);
- }
+ StorageClass stc2 = stc & (STCref | STCscope | STCreturn);
+ if (stc2 == 0)
+ result = SRNone;
+ else if (stc2 == STCref)
+ result = SRRef;
+ else if (stc2 == STCscope)
+ result = SRScope;
+ else if (stc2 == (STCscope | STCreturn))
+ result = SRReturnScope;
+ else if (stc2 == (STCref | STCreturn))
+ result = SRReturnRef;
+ else if (stc2 == (STCscope | STCref))
+ result = SRRefScope;
+ else if (stc2 == (STCscope | STCref | STCreturn))
+ result = returnByRef ? SRReturnRef_Scope : SRRef_ReturnScope;
+ else
+ assert(0);
return result;
}
// Source: https://github.com/D-Programming-Language/dmd/blob/master/src/nspace.c
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
+#include "root/dsystem.h"
#include "mars.h"
#include "dsymbol.h"
}
}
-const char *Nspace::kind()
+const char *Nspace::kind() const
{
return "namespace";
}
int apply(Dsymbol_apply_ft_t fp, void *param);
bool hasPointers();
void setFieldOffset(AggregateDeclaration *ad, unsigned *poffset, bool isunion);
- const char *kind();
+ const char *kind() const;
Nspace *isNspace() { return this; }
void accept(Visitor *v) { v->visit(this); }
};
* https://github.com/D-Programming-Language/dmd/blob/master/src/opover.c
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <assert.h>
-#include <string.h> // memset()
-
+#include "root/dsystem.h" // memset()
#include "root/rmem.h"
#include "mars.h"
* https://github.com/D-Programming-Language/dmd/blob/master/src/optimize.c
*/
-#include <stdio.h>
-#include <ctype.h>
-#include <assert.h>
-#include <math.h>
+#include "root/dsystem.h"
-#include "checkedint.h"
+#include "root/checkedint.h"
#include "lexer.h"
#include "mtype.h"
#include "expression.h"
// This is the D parser
-#include <stdio.h>
-#include <assert.h>
-#include <string.h> // strlen(),memcpy()
-
+#include "root/dsystem.h" // strlen(),memcpy()
#include "root/rmem.h"
+
#include "mars.h"
#include "lexer.h"
#include "parse.h"
PSscope = 2, // start a new scope
PScurly = 4, // { } statement is required
PScurlyscope = 8, // { } starts a new scope
- PSsemi_ok = 0x10, // empty ';' are really ok
+ PSsemi_ok = 0x10 // empty ';' are really ok
};
PREC_mul,
PREC_pow,
PREC_unary,
- PREC_primary,
+ PREC_primary
};
extern PREC precedence[TOKMAX];
*
*/
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
-
+#include "dsystem.h"
#include "aav.h"
#include "rmem.h"
#pragma once
+#include "dsystem.h"
+
typedef void* Value;
typedef void* Key;
#pragma once
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
+#include "dsystem.h"
#include "object.h"
#include "rmem.h"
* Copyright: Copyright (C) 2014-2018 by The D Language Foundation, All Rights Reserved
* License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0)
* Authors: Walter Bright
- * Source: https://github.com/D-Programming-Language/dmd/blob/master/src/root/port.c
+ * Source: https://github.com/D-Programming-Language/dmd/blob/master/src/root/checkedint.c
*/
-#include <assert.h>
-
+#include "dsystem.h"
#include "checkedint.h"
+
/*******************************
* Add two signed integers, checking for overflow.
*
* http://www.digitalmars.com
* Distributed under the Boost Software License, Version 1.0.
* http://www.boost.org/LICENSE_1_0.txt
- * https://github.com/D-Programming-Language/dmd/blob/master/src/checkedint.h
+ * https://github.com/D-Programming-Language/dmd/blob/master/src/root/checkedint.h
*/
-#pragma once
-
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS 1
-#endif
-#include <stdint.h>
+#include "dsystem.h"
int adds(int x, int y, bool& overflow);
#pragma once
+#include "dsystem.h"
+
/// Represents a D [ ] array
template<typename T>
struct DArray
--- /dev/null
+/* dsystem.h -- Get common system includes from the host.
+ * Copyright (C) 2018 Free Software Foundation, Inc.
+ *
+ * GCC is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3, or (at your option)
+ * any later version.
+ *
+ * GCC is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with GCC; see the file COPYING3. If not see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+/* This header is used in place of dmd upstream so that we can wrap
+ around gcc's system.h. */
+
+#pragma once
+
+#include "d-system.h"
* https://github.com/D-Programming-Language/dmd/blob/master/src/root/file.c
*/
+#include "dsystem.h"
#include "file.h"
-#if defined (__sun)
-#include <alloca.h>
-#endif
-
-#if _MSC_VER ||__MINGW32__
-#include <malloc.h>
-#include <string>
-#endif
-
#if _WIN32
#include <windows.h>
-#include <direct.h>
-#include <errno.h>
#endif
#if POSIX
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <unistd.h>
#include <utime.h>
#endif
goto err2;
}
size = (size_t)buf.st_size;
+#ifdef IN_GCC
+ buffer = (unsigned char *) ::xmalloc(size + 2);
+#else
buffer = (unsigned char *) ::malloc(size + 2);
+#endif
if (!buffer)
{
printf("\tmalloc error, errno = %d\n",errno);
ref = 0;
size = GetFileSize(h,NULL);
+#ifdef IN_GCC
+ buffer = (unsigned char *) ::xmalloc(size + 2);
+#else
buffer = (unsigned char *) ::malloc(size + 2);
+#endif
if (!buffer)
goto err2;
#pragma once
-#include <stddef.h>
-
+#include "dsystem.h"
#include "array.h"
typedef Array<struct File *> Files;
* https://github.com/D-Programming-Language/dmd/blob/master/src/root/filename.c
*/
+#include "dsystem.h"
#include "filename.h"
-#include <stdint.h>
-#include <ctype.h>
-
#include "outbuffer.h"
#include "array.h"
#include "file.h"
#include "rmem.h"
-#if defined (__sun)
-#include <alloca.h>
-#endif
-
-#if _MSC_VER ||__MINGW32__
-#include <malloc.h>
-#include <string>
-#endif
-
#if _WIN32
#include <windows.h>
-#include <direct.h>
-#include <errno.h>
#endif
#if POSIX
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <unistd.h>
#include <utime.h>
#endif
#pragma once
-#include <stdint.h> // uint{8|16|32}_t
-#include <stdlib.h>
+#include "dsystem.h" // uint{8|16|32}_t
// MurmurHash2 was written by Austin Appleby, and is placed in the public
// domain. The author hereby disclaims copyright to this source code.
* https://github.com/dlang/dmd/blob/master/src/root/object.h
*/
-#define POSIX (__linux__ || __APPLE__ || __FreeBSD__ || __OpenBSD__ || __sun)
-
#pragma once
-#include <stddef.h>
+#include "dsystem.h"
typedef size_t hash_t;
DYNCAST_IDENTIFIER,
DYNCAST_TUPLE,
DYNCAST_PARAMETER,
- DYNCAST_STATEMENT,
+ DYNCAST_STATEMENT
};
/*
* https://github.com/D-Programming-Language/dmd/blob/master/src/root/outbuffer.c
*/
-#include <assert.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#if __sun
-#include <alloca.h>
-#endif
-
+#include "dsystem.h"
#include "outbuffer.h"
#include "object.h"
#pragma once
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <assert.h>
+#include "dsystem.h"
#include "port.h"
#include "rmem.h"
// Portable wrapper around compiler/system specific things.
// The idea is to minimize #ifdef's in the app code.
-#include <stdlib.h> // for alloca
-#include <stdint.h>
+#include "dsystem.h" // for alloca
#if _MSC_VER
-#include <alloca.h>
typedef __int64 longlong;
typedef unsigned __int64 ulonglong;
#else
* https://github.com/D-Programming-Language/dmd/blob/master/src/root/rmem.c
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
+#include "dsystem.h"
#include "rmem.h"
/* This implementation of the storage allocator uses the standard C allocation package.
if (s)
{
+#ifdef IN_GCC
+ p = ::xstrdup(s);
+#else
p = strdup(s);
+#endif
if (p)
return p;
error();
p = NULL;
else
{
+#ifdef IN_GCC
+ p = ::xmalloc(size);
+#else
p = malloc(size);
+#endif
if (!p)
error();
}
p = NULL;
else
{
+#ifdef IN_GCC
+ p = ::xcalloc(size, n);
+#else
p = calloc(size, n);
+#endif
if (!p)
error();
}
}
else if (!p)
{
+#ifdef IN_GCC
+ p = ::xmalloc(size);
+#else
p = malloc(size);
+#endif
if (!p)
error();
}
else
{
void *psave = p;
+#ifdef IN_GCC
+ p = ::xrealloc(psave, size);
+#else
p = realloc(psave, size);
+#endif
if (!p)
{ xfree(psave);
error();
p = NULL;
else
{
+#ifdef IN_GCC
+ p = ::xmalloc(size);
+#else
p = malloc(size);
+#endif
if (!p)
error();
else
if (m_size > CHUNK_SIZE)
{
+#ifdef IN_GCC
+ void *p = xmalloc(m_size);
+#else
void *p = malloc(m_size);
+#endif
if (p)
return p;
printf("Error: out of memory\n");
}
heapleft = CHUNK_SIZE;
+#ifdef IN_GCC
+ heapp = xmalloc(CHUNK_SIZE);
+#else
heapp = malloc(CHUNK_SIZE);
+#endif
if (!heapp)
{
printf("Error: out of memory\n");
#pragma once
-#include <stddef.h> // for size_t
+#include "dsystem.h" // for size_t
#if __APPLE__ && __i386__
/* size_t is 'unsigned long', which makes it mangle differently
* https://github.com/D-Programming-Language/dmd/blob/master/src/root/object.c
*/
-#include <stdio.h>
-
+#include "dsystem.h"
#include "object.h"
#include "outbuffer.h"
* https://github.com/D-Programming-Language/dmd/blob/master/src/root/speller.c
*/
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <assert.h>
-#include <limits.h>
-
-#if __sun || _MSC_VER
-#include <alloca.h>
-#endif
-
+#include "dsystem.h"
#include "speller.h"
const char idchars[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
* https://github.com/D-Programming-Language/dmd/blob/master/src/root/stringtable.c
*/
-#include <stdio.h>
-#include <stdint.h> // uint{8|16|32}_t
-#include <string.h> // memcpy()
-#include <stdlib.h>
-
+#include "dsystem.h" // uint{8|16|32}_t, memcpy()
#include "root.h"
#include "rmem.h" // mem
#include "stringtable.h"
* https://github.com/D-Programming-Language/dmd/blob/master/src/sapply.c
*/
-#include <stdio.h>
-#include <assert.h>
+#include "root/dsystem.h"
#include "mars.h"
#include "statement.h"
* https://github.com/D-Programming-Language/dmd/blob/master/src/sideeffect.c
*/
-#include <stdio.h>
-#include <assert.h>
+#include "root/dsystem.h"
#include "mars.h"
#include "init.h"
* https://github.com/D-Programming-Language/dmd/blob/master/src/statement.c
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
+#include "root/dsystem.h"
#include "statement.h"
#include "errors.h"
* http://www.boost.org/LICENSE_1_0.txt
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <assert.h>
-
+#include "root/dsystem.h"
#include "root/rmem.h"
-#include "checkedint.h"
+#include "root/checkedint.h"
#include "errors.h"
#include "statement.h"
* https://github.com/D-Programming-Language/dmd/blob/master/src/staticassert.c
*/
-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
+#include "root/dsystem.h"
#include "mars.h"
#include "dsymbol.h"
return true;
}
-const char *StaticAssert::kind()
+const char *StaticAssert::kind() const
{
return "static assert";
}
void semantic(Scope *sc);
void semantic2(Scope *sc);
bool oneMember(Dsymbol **ps, Identifier *ident);
- const char *kind();
+ const char *kind() const;
void accept(Visitor *v) { v->visit(this); }
};
class ClassDeclaration;
class Dsymbol;
class Expression;
+class Parameter;
class Type;
struct OutBuffer;
void semantic(Scope *sc);
bool overloadInsert(Dsymbol *s);
bool hasStaticCtorOrDtor();
- const char *kind();
+ const char *kind() const;
const char *toChars();
Prot prot();
void semantic2(Scope *sc);
void semantic3(Scope *sc);
Dsymbol *toAlias(); // resolve real symbol
- const char *kind();
+ const char *kind() const;
bool oneMember(Dsymbol **ps, Identifier *ident);
const char *toChars();
const char* toPrettyCharsHelper();
void semantic(Scope *sc);
void semantic2(Scope *sc);
void semantic3(Scope *sc);
- const char *kind();
+ const char *kind() const;
bool oneMember(Dsymbol **ps, Identifier *ident);
int apply(Dsymbol_apply_ft_t fp, void *param);
bool hasPointers();
* https://github.com/D-Programming-Language/dmd/blob/master/src/lexer.c
*/
-#include <stdio.h>
-#include <ctype.h>
+#include "root/dsystem.h"
#include "tokens.h"
#include "root/rmem.h"
* https://github.com/D-Programming-Language/dmd/blob/master/src/traits.c
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <assert.h>
-#include <math.h>
-
+#include "root/dsystem.h"
#include "root/rmem.h"
#include "root/aav.h"
+#include "root/checkedint.h"
-#include "checkedint.h"
#include "errors.h"
#include "mtype.h"
#include "init.h"
+++ /dev/null
-
-/* Compiler implementation of the D programming language
- * Copyright (C) 1999-2018 by The D Language Foundation, All Rights Reserved
- * written by Walter Bright
- * http://www.digitalmars.com
- * Distributed under the Boost Software License, Version 1.0.
- * http://www.boost.org/LICENSE_1_0.txt
- * https://github.com/D-Programming-Language/dmd/blob/master/src/unittests.c
- */
-
-#include <stdio.h>
-
-#include "mars.h"
-
-void unittest_speller();
-void unittest_importHint();
-void unittest_aa();
-
-void unittests()
-{
-#if UNITTEST
- unittest_speller();
- unittest_importHint();
- unittest_aa();
-#endif
-}
/// [3] http://unicode.org/faq/utf_bom.html
/// [4] http://www.unicode.org/versions/Unicode6.1.0/ch03.pdf
-#include <assert.h>
-
#include "utf.h"
/* The following encodings are valid, except for the 5 and 6 byte
#pragma once
-#include <stdlib.h>
+#include "root/dsystem.h"
/// A UTF-8 code unit
typedef unsigned char utf8_t;
* http://www.boost.org/LICENSE_1_0.txt
*/
-#include <string.h>
+#include "root/dsystem.h"
#include "mars.h"
#include "globals.h"
#include "root/file.h"
#include "root/filename.h"
#include "root/outbuffer.h"
+#include "root/rmem.h"
/**
* Normalize path by turning forward slashes into backslashes
if (src == NULL)
return NULL;
- char *result = strdup(src);
+ char *result = mem.xstrdup(src);
char *p = result;
while (*p != '\0')
{
const char *toChars();
void addMember(Scope *sc, ScopeDsymbol *sds);
void semantic(Scope *sc);
- const char *kind();
+ const char *kind() const;
void accept(Visitor *v) { v->visit(this); }
};
const char *toChars();
void addMember(Scope *sc, ScopeDsymbol *sds);
void semantic(Scope *sc);
- const char *kind();
+ const char *kind() const;
void accept(Visitor *v) { v->visit(this); }
};
#pragma once
-#include <assert.h>
+#include "root/dsystem.h"
class Statement;
class ErrorStatement;