Fix some warnings.

These are easy to solve and reduce the noise in the Travis build.
This commit is contained in:
kai 2014-12-26 15:03:59 +01:00
parent 1d12c61c62
commit 024b14cd7f
8 changed files with 10 additions and 16 deletions

View file

@ -1212,7 +1212,7 @@ int main(int argc, char **argv)
if (strcmp(m->srcfile->name->str, global.main_d) == 0) if (strcmp(m->srcfile->name->str, global.main_d) == 0)
{ {
static const char buf[] = "void main(){}"; static const char buf[] = "void main(){}";
m->srcfile->setbuffer((void *)buf, sizeof(buf)); m->srcfile->setbuffer(const_cast<char *>(buf), sizeof(buf));
m->srcfile->ref = 1; m->srcfile->ref = 1;
} }
else else

View file

@ -599,7 +599,6 @@ LLConstant* DtoDefineClassInfo(ClassDeclaration* cd)
LOG_SCOPE; LOG_SCOPE;
assert(cd->type->ty == Tclass); assert(cd->type->ty == Tclass);
TypeClass* cdty = static_cast<TypeClass*>(cd->type);
IrAggr* ir = getIrAggr(cd); IrAggr* ir = getIrAggr(cd);
ClassDeclaration* cinfo = Type::typeinfoclass; ClassDeclaration* cinfo = Type::typeinfoclass;

View file

@ -623,8 +623,7 @@ static void set_param_attrs(TypeFunction* f, llvm::Function* func, FuncDeclarati
size_t n = Parameter::dim(f->parameters); size_t n = Parameter::dim(f->parameters);
for (size_t k = 0; k < n; k++) for (size_t k = 0; k < n; k++)
{ {
Parameter* fnarg = Parameter::getNth(f->parameters, k); assert(Parameter::getNth(f->parameters, k));
assert(fnarg);
llvm::AttrBuilder a = irFty.args[k]->attrs; llvm::AttrBuilder a = irFty.args[k]->attrs;
if (a.hasAttributes()) if (a.hasAttributes())
@ -674,8 +673,7 @@ static void set_param_attrs(TypeFunction* f, llvm::Function* func, FuncDeclarati
for (size_t k = 0; k < n; ++k) for (size_t k = 0; k < n; ++k)
{ {
Parameter* fnarg = Parameter::getNth(f->parameters, k); assert(Parameter::getNth(f->parameters, k));
assert(fnarg);
attrptr[k] = irFty.args[k]->attrs; attrptr[k] = irFty.args[k]->attrs;
} }

View file

@ -234,7 +234,7 @@ void DtoBuildDVarArgList(std::vector<LLValue*>& args,
size_t asz = (sz + Target::ptrsize - 1) & ~(Target::ptrsize -1); size_t asz = (sz + Target::ptrsize - 1) & ~(Target::ptrsize -1);
if (sz != asz) if (sz != asz)
{ {
if (sz < Target::ptrsize) if (sz < static_cast<size_t>(Target::ptrsize))
{ {
vtypes.back() = DtoSize_t(); vtypes.back() = DtoSize_t();
} }

View file

@ -371,7 +371,7 @@ public:
const unsigned elemSize = gDataLayout->getTypeStoreSize( const unsigned elemSize = gDataLayout->getTypeStoreSize(
base->getType()->getContainedType(0)); base->getType()->getContainedType(0));
IF_LOG Logger::println("adding offset: %u (elem size: %u)", e->offset, elemSize); IF_LOG Logger::println("adding offset: %llu (elem size: %u)", static_cast<unsigned long long>(e->offset), elemSize);
if (e->offset % elemSize == 0) if (e->offset % elemSize == 0)
{ {

View file

@ -2030,7 +2030,7 @@ public:
{ {
LLValue* thisarg = p->func()->thisArg; LLValue* thisarg = p->func()->thisArg;
assert(thisarg && "null thisarg, but we're in assert(this) exp;"); assert(thisarg && "null thisarg, but we're in assert(this) exp;");
LLValue* thisptr = DtoLoad(p->func()->thisArg); LLValue* thisptr = DtoLoad(thisarg);
condty = e->e1->type->toBasetype(); condty = e->e1->type->toBasetype();
cond = new DImValue(condty, thisptr); cond = new DImValue(condty, thisptr);
} }
@ -2935,8 +2935,7 @@ public:
IF_LOG Logger::print("DotTypeExp::toElem: %s @ %s\n", e->toChars(), e->type->toChars()); IF_LOG Logger::print("DotTypeExp::toElem: %s @ %s\n", e->toChars(), e->type->toChars());
LOG_SCOPE; LOG_SCOPE;
Type* t = e->sym->getType(); assert(e->sym->getType());
assert(t);
result = toElem(e->e1); result = toElem(e->e1);
} }

View file

@ -613,13 +613,11 @@ public:
unsigned hasptrs = tc->hasPointers() ? 1 : 0; unsigned hasptrs = tc->hasPointers() ? 1 : 0;
b.push_uint(hasptrs); b.push_uint(hasptrs);
ClassDeclaration* tscd = Type::typeinfostruct;
// On x86_64, class TypeInfo_Struct contains 2 additional fields // On x86_64, class TypeInfo_Struct contains 2 additional fields
// (m_arg1/m_arg2) which are used for the X86_64 System V ABI varargs // (m_arg1/m_arg2) which are used for the X86_64 System V ABI varargs
// implementation. They are not present on any other cpu/os. // implementation. They are not present on any other cpu/os.
assert((global.params.targetTriple.getArch() != llvm::Triple::x86_64 && tscd->fields.dim == 11) || assert((global.params.targetTriple.getArch() != llvm::Triple::x86_64 && Type::typeinfostruct->fields.dim == 11) ||
(global.params.targetTriple.getArch() == llvm::Triple::x86_64 && tscd->fields.dim == 13)); (global.params.targetTriple.getArch() == llvm::Triple::x86_64 && Type::typeinfostruct->fields.dim == 13));
//void function(void*) xdtor; //void function(void*) xdtor;
b.push_funcptr(sd->dtor); b.push_funcptr(sd->dtor);

View file

@ -98,7 +98,7 @@ void AggrTypeBuilder::addAggregate(AggregateDeclaration *ad)
const size_t n = ad->fields.dim; const size_t n = ad->fields.dim;
LLSmallVector<VarDeclaration*, 16> data(n, NULL); LLSmallVector<VarDeclaration*, 16> data(n, NULL);
int errors = global.errors; unsigned int errors = global.errors;
// first fill in the fields with explicit initializers // first fill in the fields with explicit initializers
for (size_t index = 0; index < n; ++index) for (size_t index = 0; index < n; ++index)