changeset 1137:45d73f0a9b43

Automated merge with http://hg.dsource.org/projects/ldc
author Christian Kamm <kamm incasoftware de>
date Tue, 24 Mar 2009 14:34:16 +0100
parents 8ebbad15fc99 (diff) 9d308feaec27 (current diff)
children 4c8bb03e4fbc d82cc6e5bb65 f99a3b393c03
files
diffstat 19 files changed, 45 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/dmd/access.c	Tue Mar 24 14:33:57 2009 +0100
+++ b/dmd/access.c	Tue Mar 24 14:34:16 2009 +0100
@@ -257,7 +257,7 @@
     }
 }
 
-/****************************************   
+/****************************************
  * Determine if this is the same or friend of cd.
  */
 
--- a/dmd/cast.c	Tue Mar 24 14:33:57 2009 +0100
+++ b/dmd/cast.c	Tue Mar 24 14:34:16 2009 +0100
@@ -55,8 +55,8 @@
 	    }
 	    else
 	    {
-		warning("%s: implicit conversion of expression (%s) of type %s to %s can cause loss of data",
-		    loc.toChars(), toChars(), type->toChars(), t->toChars());
+		warning("implicit conversion of expression (%s) of type %s to %s can cause loss of data",
+		    toChars(), type->toChars(), t->toChars());
 	    }
 	}
 #if DMDV2
--- a/dmd/declaration.h	Tue Mar 24 14:33:57 2009 +0100
+++ b/dmd/declaration.h	Tue Mar 24 14:34:16 2009 +0100
@@ -634,7 +634,7 @@
     void toDocBuffer(OutBuffer *buf);
 
 // LDC: give argument types to runtime functions
-    static FuncDeclaration *genCfunc(Arguments *args, Type *treturn, char *name);
+    static FuncDeclaration *genCfunc(Arguments *args, Type *treturn, const char *name);
     static FuncDeclaration *genCfunc(Arguments *args, Type *treturn, Identifier *id);
 
     Symbol *toSymbol();
--- a/dmd/doc.c	Tue Mar 24 14:33:57 2009 +0100
+++ b/dmd/doc.c	Tue Mar 24 14:34:16 2009 +0100
@@ -17,7 +17,6 @@
 #include <assert.h>
 
 #include "rmem.h"
-
 #include "root.h"
 
 #include "mars.h"
--- a/dmd/dump.c	Tue Mar 24 14:33:57 2009 +0100
+++ b/dmd/dump.c	Tue Mar 24 14:34:16 2009 +0100
@@ -52,7 +52,7 @@
 void IntegerExp::dump(int i)
 {
     indent(i);
-    printf("%p %lld type=%s\n", this, (long long)value, type_print(type));
+    printf("%p %jd type=%s\n", this, (intmax_t)value, type_print(type));
 }
 
 void IdentifierExp::dump(int i)
--- a/dmd/expression.c	Tue Mar 24 14:33:57 2009 +0100
+++ b/dmd/expression.c	Tue Mar 24 14:34:16 2009 +0100
@@ -708,7 +708,6 @@
 	    }
 #endif
 
-
 	    // Convert lazy argument to a delegate
 	    if (p->storageClass & STClazy)
 	    {
--- a/dmd/func.c	Tue Mar 24 14:33:57 2009 +0100
+++ b/dmd/func.c	Tue Mar 24 14:34:16 2009 +0100
@@ -2043,7 +2043,7 @@
 // LDC: Adjusted to give argument info to the runtime function decl.
 //
 
-FuncDeclaration *FuncDeclaration::genCfunc(Arguments *args, Type *treturn, char *name)
+FuncDeclaration *FuncDeclaration::genCfunc(Arguments *args, Type *treturn, const char *name)
 {
     return genCfunc(args, treturn, Lexer::idPool(name));
 }
--- a/dmd/init.c	Tue Mar 24 14:33:57 2009 +0100
+++ b/dmd/init.c	Tue Mar 24 14:34:16 2009 +0100
@@ -384,7 +384,7 @@
     }
     unsigned long amax = 0x80000000;
     if ((unsigned long) dim * t->next->size() >= amax)
-	error(loc, "array dimension %u exceeds max of %llu", dim, amax / t->next->size());
+	error(loc, "array dimension %u exceeds max of %ju", dim, amax / t->next->size());
     return this;
 }
 
--- a/dmd/init.h	Tue Mar 24 14:33:57 2009 +0100
+++ b/dmd/init.h	Tue Mar 24 14:34:16 2009 +0100
@@ -26,7 +26,6 @@
 struct StructInitializer;
 struct ArrayInitializer;
 struct ExpInitializer;
-struct StructInitializer;
 #ifdef _DH
 struct HdrGenState;
 #endif
@@ -85,7 +84,7 @@
 
     dt_t *toDt();
 
-    StructInitializer  *isStructInitializer()  { return this; }
+    StructInitializer *isStructInitializer() { return this; }
 };
 
 struct ArrayInitializer : Initializer
--- a/dmd/lstring.c	Tue Mar 24 14:33:57 2009 +0100
+++ b/dmd/lstring.c	Tue Mar 24 14:34:16 2009 +0100
@@ -14,7 +14,11 @@
 #include "rmem.h"
 #include "lstring.h"
 
+#ifdef _MSC_VER // prevent compiler internal crash
+Lstring Lstring::zero;
+#else
 Lstring Lstring::zero = LSTRING_EMPTY();
+#endif
 
 Lstring *Lstring::ctor(const dchar *p, unsigned length)
 {
--- a/dmd/mangle.c	Tue Mar 24 14:33:57 2009 +0100
+++ b/dmd/mangle.c	Tue Mar 24 14:34:16 2009 +0100
@@ -155,11 +155,11 @@
 	if (isMain())
 	    return (char *)"_Dmain";
 
-    if (isWinMain() || isDllMain())
-        return ident->toChars();
+	if (isWinMain() || isDllMain())
+	    return ident->toChars();
 
-    assert(this);
-    return Declaration::mangle();
+	assert(this);
+	return Declaration::mangle();
     }
 
 char *StructDeclaration::mangle()
--- a/dmd/mars.c	Tue Mar 24 14:33:57 2009 +0100
+++ b/dmd/mars.c	Tue Mar 24 14:34:16 2009 +0100
@@ -59,7 +59,7 @@
 
     copyright = "Copyright (c) 1999-2009 by Digital Mars and Tomas Lindquist Olsen";
     written = "written by Walter Bright and Tomas Lindquist Olsen";
-    version = "v1.039";
+    version = "v1.041";
     ldc_version = LDC_REV;
     llvm_version = LLVM_REV_STR;
     global.structalign = 8;
--- a/dmd/module.c	Tue Mar 24 14:33:57 2009 +0100
+++ b/dmd/module.c	Tue Mar 24 14:34:16 2009 +0100
@@ -16,7 +16,7 @@
 #include <alloca.h>
 #endif
 
-#if _MSC_VER || __MINGW32__
+#if defined(_MSC_VER) || defined(__MINGW32__)
 #include <malloc.h>
 #endif
 
@@ -566,7 +566,7 @@
     }
 
 #ifdef IN_GCC
-    // dump utf-8 encoded source
+    // dump utf-8 encoded source 
     if (dump_source)
     {	// %% srcname could contain a path ...
 	d_gcc_dump_source(srcname, "utf-8", buf, buflen);
--- a/dmd/mtype.c	Tue Mar 24 14:33:57 2009 +0100
+++ b/dmd/mtype.c	Tue Mar 24 14:34:16 2009 +0100
@@ -15,7 +15,7 @@
 #include <alloca.h>
 #endif
 
-#include <cmath>
+#include <math.h>
 
 #include <stdio.h>
 #include <assert.h>
@@ -1741,7 +1741,7 @@
     return sz;
 
 Loverflow:
-    error(loc, "index %lld overflow for static array", sz);
+    error(loc, "index %jd overflow for static array", sz);
     return 1;
 }
 
@@ -1809,7 +1809,7 @@
 	    sc = sc->pop();
 
 	    if (d >= td->objects->dim)
-	    {	error(loc, "tuple index %llu exceeds %u", d, td->objects->dim);
+	    {	error(loc, "tuple index %ju exceeds %u", d, td->objects->dim);
 		goto Ldefault;
 	    }
 	    Object *o = (Object *)td->objects->data[(size_t)d];
@@ -1863,7 +1863,7 @@
 	uinteger_t d = dim->toUInteger();
 
 	if (d >= sd->objects->dim)
-	{   error(loc, "tuple index %llu exceeds %u", d, sd->objects->dim);
+	{   error(loc, "tuple index %ju exceeds %u", d, sd->objects->dim);
 	    return Type::terror;
 	}
 	Object *o = (Object *)sd->objects->data[(size_t)d];
--- a/dmd/opover.c	Tue Mar 24 14:33:57 2009 +0100
+++ b/dmd/opover.c	Tue Mar 24 14:34:16 2009 +0100
@@ -12,7 +12,11 @@
 #include <stdlib.h>
 #include <ctype.h>
 #include <assert.h>
+#if _MSC_VER
 #include <complex>
+#else
+#include <complex>
+#endif
 
 #ifdef __APPLE__
 #define integer_t dmd_integer_t
--- a/dmd/root.h	Tue Mar 24 14:33:57 2009 +0100
+++ b/dmd/root.h	Tue Mar 24 14:34:16 2009 +0100
@@ -38,6 +38,12 @@
 
 #if _MSC_VER
 #include <float.h>  // for _isnan
+#include <malloc.h> // for alloca
+// According to VC 8.0 docs, long double is the same as double
+#define strtold strtod
+#define strtof  strtod
+#define isnan   _isnan
+
 typedef __int64 longlong;
 typedef unsigned __int64 ulonglong;
 #else
--- a/dmd/statement.c	Tue Mar 24 14:33:57 2009 +0100
+++ b/dmd/statement.c	Tue Mar 24 14:34:16 2009 +0100
@@ -1647,7 +1647,6 @@
             flde->type = fldeTy;
         }
 		exps->push(flde);
-
 		e = new CallExp(loc, ec, exps);
 		e->type = Type::tindex;	// don't run semantic() on e
 	    }
@@ -1712,7 +1711,6 @@
             flde->type = dgty;
         }
 		exps->push(flde);
-
 		e = new CallExp(loc, ec, exps);
 		e->type = Type::tindex;	// don't run semantic() on e
 	    }
--- a/gen/abi-x86-64.cpp	Tue Mar 24 14:33:57 2009 +0100
+++ b/gen/abi-x86-64.cpp	Tue Mar 24 14:34:16 2009 +0100
@@ -400,13 +400,15 @@
     bool retStructInRegs(TypeStruct* st) {
         // 'fastcc' allows returns in up to two registers of each kind:
         DRegCount state(2, 2, 2);
-    #if 1
-        // TODO: Disable this if and when LLVM PR 3861 gets fixed.
-        
-        // LLVM currently doesn't allow a second int to be an i1 or i8.
-        // (See <http://llvm.org/PR3861>)
+    #if 1 //LLVM_REV < 67588
+        // LLVM before trunk r67588 doesn't allow a second int to be an i1 or
+        // i8. (See <http://llvm.org/PR3861>)
         // Rather than complicating shouldPassStructInRegs(), just disallow
         // second integers for now.
+        // FIXME: Disabling this for older LLVM only makes the abi dependent on
+        //        LLVM revision, which seems like a bad idea. We could extend
+        //        i8 parts to i16 to work around this issue until 2.6...
+        // TODO: Remove this workaround when support for LLVM 2.5 is dropped.
         state.ints = 1;
     #endif
         return shouldPassStructInRegs(st, state);
--- a/tests/mini/tuplestruct.d	Tue Mar 24 14:33:57 2009 +0100
+++ b/tests/mini/tuplestruct.d	Tue Mar 24 14:34:16 2009 +0100
@@ -2,14 +2,14 @@
     T v;
 }
 
-alias V!(Object, int) MyV;
+alias V!(float, int) MyV;
 
 void main()
 {
-    assert(MyV.sizeof == Object.sizeof + int.sizeof);
-    auto o = new Object;
-    auto v = MyV(o, 3);
-    assert(v.v[0] is o);
+    assert(MyV.sizeof == float.sizeof + int.sizeof);
+    auto f = 3.75f;
+    auto v = MyV(f, 3);
+    assert(v.v[0] == 3.75f);
     assert(v.v[1] == 3);
 }