diff options
Diffstat (limited to 'gcc/d/d-compiler.cc')
-rw-r--r-- | gcc/d/d-compiler.cc | 49 |
1 files changed, 7 insertions, 42 deletions
diff --git a/gcc/d/d-compiler.cc b/gcc/d/d-compiler.cc index 512ef4b..3df40073 100644 --- a/gcc/d/d-compiler.cc +++ b/gcc/d/d-compiler.cc @@ -20,7 +20,6 @@ along with GCC; see the file COPYING3. If not see #include "coretypes.h" #include "dmd/compiler.h" -#include "dmd/scope.h" #include "dmd/expression.h" #include "dmd/identifier.h" #include "dmd/module.h" @@ -34,40 +33,6 @@ along with GCC; see the file COPYING3. If not see /* Implements the Compiler interface used by the frontend. */ -/* Generate C main() in response to seeing D main(). This used to be in - libdruntime, but contained a reference to _Dmain which didn't work when - druntime was made into a shared library and was linked to a program, such - as a C++ program, that didn't have a _Dmain. */ - -void -Compiler::genCmain (Scope *sc) -{ - static bool initialized = false; - - if (initialized) - return; - - /* The D code to be generated is provided by __entrypoint.di, try to load it, - but don't fail if unfound. */ - unsigned errors = global.startGagging (); - Module *m = Module::load (Loc (), NULL, Identifier::idPool ("__entrypoint")); - - if (global.endGagging (errors)) - m = NULL; - - if (m != NULL) - { - m->importedFrom = m; - m->importAll (NULL); - dsymbolSemantic (m, NULL); - semantic2 (m, NULL); - semantic3 (m, NULL); - d_add_entrypoint_module (m, sc->_module); - } - - initialized = true; -} - /* Perform a reinterpret cast of EXPR to type TYPE for use in CTFE. The front end should have already ensured that EXPR is a constant, so we just lower the value to GCC and return the converted CST. */ @@ -123,7 +88,7 @@ Compiler::paintAsType (UnionExp *, Expression *expr, Type *type) /* Encode CST to buffer. */ int len = native_encode_expr (cst, buffer, sizeof (buffer)); - if (tb->ty == Tsarray) + if (tb->ty == TY::Tsarray) { /* Interpret value as a vector of the same size, then return the array literal. */ @@ -161,22 +126,22 @@ Compiler::onParseModule (Module *m) { ModuleDeclaration *md = m->md; - if (!md || !md->id || !md->packages) + if (!md || !md->id|| md->packages.length == 0) { Identifier *id = (md && md->id) ? md->id : m->ident; if (!strcmp (id->toChars (), "object")) create_tinfo_types (m); } - else if (md->packages->length == 1) + else if (md->packages.length == 1) { - if (!strcmp ((*md->packages)[0]->toChars (), "gcc") + if (!strcmp (md->packages.ptr[0]->toChars (), "gcc") && !strcmp (md->id->toChars (), "builtins")) d_build_builtins_module (m); } - else if (md->packages->length == 2) + else if (md->packages.length == 2) { - if (!strcmp ((*md->packages)[0]->toChars (), "core") - && !strcmp ((*md->packages)[1]->toChars (), "stdc")) + if (!strcmp (md->packages.ptr[0]->toChars (), "core") + && !strcmp (md->packages.ptr[1]->toChars (), "stdc")) d_add_builtin_module (m); } } |