diff --unified --recursive dmd/backend/cc.h ..\..\dmd\src\dmd/backend/cc.h --- dmd/backend/cc.h 2010-11-06 18:23:47.092128700 +0000 +++ ..\..\dmd\src\dmd/backend/cc.h 2010-11-06 15:39:03.673755300 +0000 @@ -1443,7 +1443,11 @@ /* Format the identifier for presentation to the user */ char *cpp_prettyident (Symbol *s); +#if SCPP inline char *prettyident(Symbol *s) { return CPP ? cpp_prettyident(s) : s->Sident; } +#else +inline char *prettyident(Symbol *s) { return s->Sident; } +#endif /********************************** * Function parameters: diff --unified --recursive dmd/backend/cdef.h ..\..\dmd\src\dmd/backend/cdef.h --- dmd/backend/cdef.h 2010-11-06 18:23:46.145074600 +0000 +++ ..\..\dmd\src\dmd/backend/cdef.h 2010-11-06 17:58:12.627362400 +0000 @@ -228,7 +228,7 @@ #if __GNUC__ #define LONGLONG 1 -#elif __SC__ < 0x700 || _MSC_VER +#elif defined(__SC__) && __SC__ < 0x700 #define LONGLONG 0 #else #define LONGLONG 1 // add in code to support 64 bit integral types Only in ..\..\dmd\src\dmd/backend: cdxxx.c diff --unified --recursive dmd/backend/cgobj.c ..\..\dmd\src\dmd/backend/cgobj.c --- dmd/backend/cgobj.c 2010-11-06 18:23:46.529096500 +0000 +++ ..\..\dmd\src\dmd/backend/cgobj.c 2010-11-06 13:37:59.527269900 +0000 @@ -1141,7 +1141,7 @@ STATIC void obj_defaultlib() { char library[4]; // default library - static const char model[MEMMODELS] = "SMCLV"; + static const char model[MEMMODELS + 1] = "SMCLV"; #if MARS memcpy(library,"SM?",4); @@ -1262,7 +1262,7 @@ void obj_compiler() { - static const char compiler[] = "\0\xDBDigital Mars C/C++" + static const char compiler[] = "\0\xDB" "Digital Mars C/C++" VERSION ; // compiled by ... @@ -1290,7 +1290,7 @@ int texti = 8; // index of _TEXT static char comment[] = {0,0x9D,'0','?','O'}; // memory model - static char model[MEMMODELS] = "smclv"; + static char model[MEMMODELS + 1] = "smclv"; static char exten[] = {0,0xA1,1,'C','V'}; // extended format static char pmdeb[] = {0x80,0xA1,1,'H','L','L',0}; // IBM PM debug format @@ -1606,7 +1606,7 @@ { // We need to always put out the segments in triples, so that the // linker will put them in the correct order. - static char lnames[4][5+4+5] = + static char lnames[4][5+4+5 +1] = { "\03XIB\02XI\03XIE", // near constructor "\03XCB\02XC\03XCE", // near destructor "\04XIFB\03XIF\04XIFE", // far constructor @@ -2893,10 +2893,11 @@ * nbytes */ -unsigned obj_bytes(int seg,targ_size_t offset,unsigned nbytes, void *p) +unsigned obj_bytes(int seg,targ_size_t offset,unsigned nbytes, void *_p) { unsigned n = nbytes; //dbg_printf("obj_bytes(seg=%d, offset=x%lx, nbytes=x%x, p=%p)\n",seg,offset,nbytes,p); + char* p = (char*)_p; L1: if ( (seg != obj.ledata->lseg || // and segments don't match @@ -2909,7 +2910,7 @@ while (nbytes) { obj_byte(seg,offset,*(char *)p); offset++; - ((char *)p)++; + ((char *)(p))++; nbytes--; if (obj.ledata->i + nbytes <= LEDATAMAX) goto L1; diff --unified --recursive dmd/backend/cod3.c ..\..\dmd\src\dmd/backend/cod3.c --- dmd/backend/cod3.c 2010-11-06 18:23:47.279139400 +0000 +++ ..\..\dmd\src\dmd/backend/cod3.c 2010-11-06 13:00:44.294421900 +0000 @@ -3834,7 +3834,7 @@ #define GEN(c) (*pgen++ = (c)) #define GENP(n,p) (memcpy(pgen,(p),(n)), pgen += (n)) -#if ELFOBJ || MACHOBJ +#if ELFOBJ || MACHOBJ || _MSC_VER #define FLUSH() if (pgen-bytes) cod3_flush() #else #define FLUSH() ((pgen - bytes) && cod3_flush()) Only in ..\..\dmd\src\dmd/backend: debtab.c Only in ..\..\dmd\src\dmd/backend: elxxx.c Only in ..\..\dmd\src\dmd/backend: fltables.c Only in ..\..\dmd\src\dmd/backend: id.c diff --unified --recursive dmd/backend/md5.h ..\..\dmd\src\dmd/backend/md5.h --- dmd/backend/md5.h 2010-11-06 18:23:46.840114300 +0000 +++ ..\..\dmd\src\dmd/backend/md5.h 2010-11-06 18:08:35.233973400 +0000 @@ -48,10 +48,18 @@ unsigned char digest[16]; /* actual digest after MD5Final call */ } MD5_CTX; +#ifdef __cplusplus +extern "C" { +#endif + void MD5Init (MD5_CTX *mdContext); void MD5Update (MD5_CTX *mdContext, unsigned char *inBuf, unsigned inLen); void MD5Final (MD5_CTX *mdContext); +#ifdef __cplusplus +} +#endif + /* ********************************************************************** ** End of md5.h ** diff --unified --recursive dmd/backend/newman.c ..\..\dmd\src\dmd/backend/newman.c --- dmd/backend/newman.c 2010-11-06 18:23:47.161132700 +0000 +++ ..\..\dmd\src\dmd/backend/newman.c 2010-11-06 18:16:26.705940100 +0000 @@ -194,7 +194,7 @@ * Convert from identifier to operator */ -#if __GNUC__ // NOT DONE - FIX +#if __GNUC__ || _MSC_VER // NOT DONE - FIX char * unmangle_pt(const char **s) { return (char *)*s; Only in ..\..\dmd\src\dmd/backend: optab.c diff --unified --recursive dmd/backend/os.c ..\..\dmd\src\dmd/backend/os.c --- dmd/backend/os.c 2010-11-06 18:23:47.193134500 +0000 +++ ..\..\dmd\src\dmd/backend/os.c 2010-11-06 18:38:22.777215000 +0000 @@ -40,7 +40,7 @@ #include #endif -#if __DMC__ || __GNUC__ +#if __DMC__ || __GNUC__ || _MSC_VER static char __file__[] = __FILE__; /* for tassert.h */ #include "tassert.h" #else @@ -678,7 +678,7 @@ long os_file_size(int fd) { -#if _WIN32 +#if _WIN32 && !defined(_MSC_VER) return GetFileSize(_osfhnd[fd],NULL); #else struct stat buf; diff --unified --recursive dmd/backend/out.c ..\..\dmd\src\dmd/backend/out.c --- dmd/backend/out.c 2010-11-06 18:23:46.916118700 +0000 +++ ..\..\dmd\src\dmd/backend/out.c 2010-11-06 18:29:11.334674300 +0000 @@ -1269,6 +1269,7 @@ blockopt(0); /* optimize */ } +#if SCPP if (CPP) { // Look for any blocks that return nothing. @@ -1294,6 +1295,7 @@ func_noreturnvalue(); } } +#endif assert(funcsym_p == sfunc); if (eecontext.EEcompile != 1) { Only in ..\..\dmd\src\dmd/backend: tytab.c Only in ..\..\dmd\src\dmd: id.c Only in ..\..\dmd\src\dmd: id.h Only in ..\..\dmd\src\dmd: impcnvtab.c diff --unified --recursive dmd/libomf.c ..\..\dmd\src\dmd/libomf.c --- dmd/libomf.c 2010-11-06 18:23:45.722050400 +0000 +++ ..\..\dmd\src\dmd/libomf.c 2010-11-06 14:07:25.844297500 +0000 @@ -259,6 +259,7 @@ if (easyomf) recTyp = COMDAT+1; // convert to MS format case COMDAT+1: + { int pickAny = 0; if (*p++ & 5) // if continuation or local comdat @@ -290,6 +291,7 @@ //printf("[s] name='%s'\n",name); addSymbol(om, (char *)names.data[idx],pickAny); + } break; case ALIAS: @@ -488,10 +490,12 @@ om->length = pnext - om->base; om = NULL; } + { // Round up to next page unsigned t = pnext - pstart; t = (t + g_page_size - 1) & ~(unsigned)(g_page_size - 1); pnext = pstart + t; + } break; default: diff --unified --recursive dmd/module.h ..\..\dmd\src\dmd/module.h --- dmd/module.h 2010-11-06 18:23:44.584985300 +0000 +++ ..\..\dmd\src\dmd/module.h 2010-11-06 13:48:13.923411400 +0000 @@ -21,7 +21,7 @@ struct ModuleInfoDeclaration; struct ClassDeclaration; struct ModuleDeclaration; -struct Macro; +class Macro; struct Escape; struct VarDeclaration; struct Library; diff --unified --recursive dmd/tocsym.c ..\..\dmd\src\dmd/tocsym.c --- dmd/tocsym.c 2010-11-06 18:23:43.695934500 +0000 +++ ..\..\dmd\src\dmd/tocsym.c 2010-11-07 19:03:44.237776900 +0000 @@ -86,8 +86,13 @@ n += 2; } #endif - id = (char *) alloca(2 + nlen + sizeof(size_t) * 3 + strlen(prefix) + strlen(suffix) + 1); - sprintf(id,"_D%s%zu%s%s", n, strlen(prefix), prefix, suffix); + size_t size = 2 + nlen + sizeof(size_t) * 3 + strlen(prefix) + strlen(suffix) + 1; + id = (char *) alloca(size); +#ifdef _MSC_VER + sprintf(id,"_D%s%Iu%s%s", n, strlen(prefix), prefix, suffix); +#else + sprintf(id,"_D%s%zu%s%s", n, strlen(prefix), prefix, suffix); +#endif #if 0 if (global.params.isWindows && (type_mangle(t) == mTYman_c || type_mangle(t) == mTYman_std)) diff --unified --recursive dmd/util.c ..\..\dmd\src\dmd/util.c --- dmd/util.c 2010-11-06 18:23:43.790939900 +0000 +++ ..\..\dmd\src\dmd/util.c 2010-11-06 17:54:01.346989900 +0000 @@ -81,7 +81,7 @@ } -#if _WIN32 +#if _WIN32 && !defined(_MSC_VER) volatile int controlc_saw; @@ -131,7 +131,7 @@ #endif -#if linux || __APPLE__ || __FreeBSD__ || __sun&&__SVR4 +#if linux || __APPLE__ || __FreeBSD__ || __sun&&__SVR4 || _MSC_VER void util_progress() { } @@ -237,7 +237,7 @@ * If c is a power of 2, return that power else -1. */ -int ispow2(unsigned long long c) +int ispow2(targ_ullong c) { int i; if (c == 0 || (c & (c - 1)))