# HG changeset patch # User lindquist # Date 1214010889 -7200 # Node ID 297690b5d4a538d4eb14083e46a509ad1c96fca1 # Parent 70c370e97944c8ced91f73725649b639d06de6a4 [svn r306] Fixed: it's now possible to compile and link llvmdc with MinGW32 and msys on Win32 :D I tried it myself ;) Building the runtime still needs some work, but it's a step in the right direction. diff -r 70c370e97944 -r 297690b5d4a5 dmd/array.c --- a/dmd/array.c Sat Jun 21 02:48:53 2008 +0200 +++ b/dmd/array.c Sat Jun 21 03:14:49 2008 +0200 @@ -13,7 +13,7 @@ #include #include -#if _MSC_VER +#if _MSC_VER || __MINGW32__ #include #endif diff -r 70c370e97944 -r 297690b5d4a5 dmd/expression.c --- a/dmd/expression.c Sat Jun 21 02:48:53 2008 +0200 +++ b/dmd/expression.c Sat Jun 21 03:14:49 2008 +0200 @@ -19,6 +19,12 @@ extern "C" char * __cdecl __locale_decpoint; #endif +#if __MINGW32__ +#ifndef isnan +#define isnan _isnan +#endif +#endif + #if IN_GCC // Issues with using -include total.h (defines integer_t) and then complex.h fails... #undef integer_t diff -r 70c370e97944 -r 297690b5d4a5 dmd/inifile.c --- a/dmd/inifile.c Sat Jun 21 02:48:53 2008 +0200 +++ b/dmd/inifile.c Sat Jun 21 03:14:49 2008 +0200 @@ -13,6 +13,10 @@ #include "root.h" #include "mem.h" +#ifdef __MINGW32__ +#include +#endif + #define LOG 0 char *skipspace(const char *p); diff -r 70c370e97944 -r 297690b5d4a5 dmd/mars.c --- a/dmd/mars.c Sat Jun 21 02:48:53 2008 +0200 +++ b/dmd/mars.c Sat Jun 21 03:14:49 2008 +0200 @@ -328,8 +328,7 @@ #if _WIN32 inifile(argv[0], "llvmdc.ini"); -#endif -#if linux +#elif linux inifile(argv[0], "llvmdc.conf"); #else #error diff -r 70c370e97944 -r 297690b5d4a5 dmd/module.c --- a/dmd/module.c Sat Jun 21 02:48:53 2008 +0200 +++ b/dmd/module.c Sat Jun 21 03:14:49 2008 +0200 @@ -12,7 +12,7 @@ #include #include -#ifdef _MSC_VER +#if _MSC_VER || __MINGW32__ #include #endif diff -r 70c370e97944 -r 297690b5d4a5 dmd/mtype.c --- a/dmd/mtype.c Sat Jun 21 02:48:53 2008 +0200 +++ b/dmd/mtype.c Sat Jun 21 03:14:49 2008 +0200 @@ -25,6 +25,8 @@ #include #elif __DMC__ #include +#elif __MINGW32__ +#include #else //#define signbit 56 #endif @@ -32,6 +34,9 @@ #if __APPLE__ #include static double zero = 0; +#elif __MINGW32__ +#include +static double zero = 0; #elif __GNUC__ #include #include diff -r 70c370e97944 -r 297690b5d4a5 dmd/root.c --- a/dmd/root.c Sat Jun 21 02:48:53 2008 +0200 +++ b/dmd/root.c Sat Jun 21 03:14:49 2008 +0200 @@ -14,7 +14,7 @@ #include #include -#if _MSC_VER +#if _MSC_VER ||__MINGW32__ #include #endif diff -r 70c370e97944 -r 297690b5d4a5 dmd/template.c --- a/dmd/template.c Sat Jun 21 02:48:53 2008 +0200 +++ b/dmd/template.c Sat Jun 21 03:14:49 2008 +0200 @@ -13,15 +13,18 @@ #include #include +#if !IN_LLVM #if _WIN32 #include long __cdecl __ehfilter(LPEXCEPTION_POINTERS ep); #endif +#endif #include "root.h" #include "mem.h" #include "stringtable.h" - +#include "mars.h" +#include "identifier.h" #include "mtype.h" #include "template.h" #include "init.h" @@ -31,9 +34,6 @@ #include "aggregate.h" #include "declaration.h" #include "dsymbol.h" -#include "mars.h" -#include "dsymbol.h" -#include "identifier.h" #include "hdrgen.h" #define LOG 0 @@ -2944,10 +2944,12 @@ //printf("isnested = %d, sc->parent = %s\n", isnested, sc->parent->toChars()); sc2->parent = /*isnested ? sc->parent :*/ this; +#if !IN_LLVM #if _WIN32 __try { #endif +#endif for (int i = 0; i < members->dim; i++) { Dsymbol *s = (Dsymbol *)members->data[i]; @@ -2960,6 +2962,7 @@ //printf("test4: isnested = %d, s->parent = %s\n", isnested, s->parent->toChars()); sc2->module->runDeferredSemantic(); } +#if !IN_LLVM #if _WIN32 } __except (__ehfilter(GetExceptionInformation())) @@ -2969,6 +2972,7 @@ fatal(); } #endif +#endif /* If any of the instantiation members didn't get semantic() run * on them due to forward references, we cannot run semantic2() diff -r 70c370e97944 -r 297690b5d4a5 gen/classes.cpp --- a/gen/classes.cpp Sat Jun 21 02:48:53 2008 +0200 +++ b/gen/classes.cpp Sat Jun 21 03:14:49 2008 +0200 @@ -1388,10 +1388,10 @@ #endif } -static uint build_classinfo_flags(ClassDeclaration* cd) +static unsigned build_classinfo_flags(ClassDeclaration* cd) { // adapted from original dmd code - uint flags = 0; + unsigned flags = 0; //flags |= isCOMclass(); // IUnknown bool hasOffTi = false; if (cd->ctor) flags |= 8; @@ -1563,7 +1563,7 @@ c = defc->getOperand(9); } else { - uint flags = build_classinfo_flags(cd); + unsigned flags = build_classinfo_flags(cd); c = DtoConstUint(flags); } inits.push_back(c); diff -r 70c370e97944 -r 297690b5d4a5 gen/todebug.cpp --- a/gen/todebug.cpp Sat Jun 21 02:48:53 2008 +0200 +++ b/gen/todebug.cpp Sat Jun 21 03:14:49 2008 +0200 @@ -1,6 +1,7 @@ #include "gen/llvm.h" #include "llvm/Support/Dwarf.h" #include "llvm/CodeGen/MachineModuleInfo.h" +#include "llvm/System/Path.h" #include "declaration.h" #include "module.h" @@ -136,11 +137,8 @@ vals[2] = DtoConstUint(DW_LANG_C);// _D)); // doesn't seem to work vals[3] = DtoConstStringPtr(m->srcfile->name->toChars(), "llvm.metadata"); std::string srcpath(FileName::path(m->srcfile->name->toChars())); - if (srcpath.empty()) { - const char* str = get_current_dir_name(); - assert(str != NULL); - srcpath = str; - } + if (srcpath.empty()) + srcpath = llvm::sys::Path::GetCurrentDirectory().toString(); vals[4] = DtoConstStringPtr(srcpath.c_str(), "llvm.metadata"); vals[5] = DtoConstStringPtr("LLVMDC (http://www.dsource.org/projects/llvmdc)", "llvm.metadata"); diff -r 70c370e97944 -r 297690b5d4a5 premake.lua --- a/premake.lua Sat Jun 21 02:48:53 2008 +0200 +++ b/premake.lua Sat Jun 21 03:14:49 2008 +0200 @@ -2,7 +2,11 @@ -- options OPAQUE_VTBLS = 1 -USE_BOEHM_GC = 1 +if OS == "windows" then + USE_BOEHM_GC = 0 +else + USE_BOEHM_GC = 1 +end -- idgen package = newpackage()