mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-11 18:33:14 +01:00
Automated merge with http://hg.dsource.org/projects/ldc
This commit is contained in:
@@ -257,7 +257,7 @@ halt();
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************
|
||||
/****************************************
|
||||
* Determine if this is the same or friend of cd.
|
||||
*/
|
||||
|
||||
|
||||
@@ -55,8 +55,8 @@ Expression *Expression::implicitCastTo(Scope *sc, Type *t)
|
||||
}
|
||||
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
|
||||
|
||||
@@ -634,7 +634,7 @@ struct FuncDeclaration : Declaration
|
||||
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();
|
||||
|
||||
@@ -17,7 +17,6 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "rmem.h"
|
||||
|
||||
#include "root.h"
|
||||
|
||||
#include "mars.h"
|
||||
|
||||
@@ -52,7 +52,7 @@ void Expression::dump(int i)
|
||||
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)
|
||||
|
||||
@@ -708,7 +708,6 @@ void functionArguments(Loc loc, Scope *sc, TypeFunction *tf, Expressions *argume
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
// Convert lazy argument to a delegate
|
||||
if (p->storageClass & STClazy)
|
||||
{
|
||||
|
||||
@@ -2043,7 +2043,7 @@ int FuncDeclaration::addPostInvariant()
|
||||
// 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));
|
||||
}
|
||||
|
||||
@@ -384,7 +384,7 @@ Initializer *ArrayInitializer::semantic(Scope *sc, Type *t)
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,6 @@ struct VoidInitializer;
|
||||
struct StructInitializer;
|
||||
struct ArrayInitializer;
|
||||
struct ExpInitializer;
|
||||
struct StructInitializer;
|
||||
#ifdef _DH
|
||||
struct HdrGenState;
|
||||
#endif
|
||||
@@ -85,7 +84,7 @@ struct StructInitializer : Initializer
|
||||
|
||||
dt_t *toDt();
|
||||
|
||||
StructInitializer *isStructInitializer() { return this; }
|
||||
StructInitializer *isStructInitializer() { return this; }
|
||||
};
|
||||
|
||||
struct ArrayInitializer : Initializer
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -155,11 +155,11 @@ char *FuncDeclaration::mangle()
|
||||
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()
|
||||
|
||||
@@ -59,7 +59,7 @@ Global::Global()
|
||||
|
||||
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;
|
||||
|
||||
@@ -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 @@ void Module::parse()
|
||||
}
|
||||
|
||||
#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);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <alloca.h>
|
||||
#endif
|
||||
|
||||
#include <cmath>
|
||||
#include <math.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
@@ -1741,7 +1741,7 @@ d_uns64 TypeSArray::size(Loc loc)
|
||||
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 @@ void TypeSArray::resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol
|
||||
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 @@ Type *TypeSArray::semantic(Loc loc, Scope *sc)
|
||||
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];
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -38,6 +38,12 @@ void warning(const char *format, ...);
|
||||
|
||||
#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
|
||||
|
||||
@@ -1647,7 +1647,6 @@ Statement *ForeachStatement::semantic(Scope *sc)
|
||||
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 @@ Statement *ForeachStatement::semantic(Scope *sc)
|
||||
flde->type = dgty;
|
||||
}
|
||||
exps->push(flde);
|
||||
|
||||
e = new CallExp(loc, ec, exps);
|
||||
e->type = Type::tindex; // don't run semantic() on e
|
||||
}
|
||||
|
||||
@@ -400,13 +400,15 @@ namespace x86_64_D_cc {
|
||||
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);
|
||||
|
||||
@@ -2,14 +2,14 @@ struct V(T...) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user