Cleanup: Clang warning fixes.

No warnings left on a '-Wall' build except for a single tautological
compare in gen/asm-x86-32.h, which indeed seems like a bug.
This commit is contained in:
David Nadlinger 2012-12-20 00:23:44 +01:00
parent 289bb57adf
commit 0cd78dd579
13 changed files with 34 additions and 37 deletions

View file

@ -515,7 +515,8 @@ void errorSupplemental(Loc loc, const char *format, ...);
void verror(Loc loc, const char *format, va_list ap, const char *p1 = NULL, const char *p2 = NULL);
void vwarning(Loc loc, const char *format, va_list);
void verrorSupplemental(Loc loc, const char *format, va_list);
#ifdef __GNUC__
#if defined(__GNUC__) || defined(__clang__)
__attribute__((noreturn))
#endif
void fatal();

View file

@ -514,7 +514,12 @@ void errorSupplemental(Loc loc, const char *format, ...);
void verror(Loc loc, const char *format, va_list ap, const char *p1 = NULL, const char *p2 = NULL);
void vwarning(Loc loc, const char *format, va_list);
void verrorSupplemental(Loc loc, const char *format, va_list);
#if defined(__GNUC__) || defined(__clang__)
__attribute__((noreturn))
#endif
void fatal();
void err_nomem();
#if IN_LLVM
void error(const char *format, ...) IS_PRINTF(1);

View file

@ -33,8 +33,10 @@ private:
unsigned length;
#ifndef IN_GCC
#if _MSC_VER
// Disable warning about nonstandard extension
#pragma warning (disable : 4200)
#endif
#endif
char lstring[];

View file

@ -2973,11 +2973,11 @@ namespace AsmParserx8632
void doData()
{
// FIXME: data instructions not implemented.
#if 0
static const char * directives[] = { ".byte", ".short", ".long", ".long",
"", "", ""
};
// FIXME
/*
machine_mode mode;
insnTemplate->writestring(static_cast<char*>(directives[op - Op_db]));
@ -3048,7 +3048,8 @@ namespace AsmParserx8632
}
} while (1);
setAsmCode();*/
setAsmCode();
#endif
}
};

View file

@ -420,9 +420,9 @@ namespace AsmParserx8664
typedef struct
{
Opr operands[3];
unsigned char
unsigned short
needsType : 3,
implicitClobbers : 8,
implicitClobbers : 9,
linkType : 2;
unsigned link;
@ -3111,11 +3111,12 @@ namespace AsmParserx8664
void doData()
{
// FIXME: data instructions not implemented.
#if 0
static const char * directives[] = { ".byte", ".short", ".long", ".long",
"", "", ""
};
// FIXME
/*
machine_mode mode;
insnTemplate->writestring(static_cast<char*>(directives[op - Op_db]));
@ -3186,7 +3187,8 @@ namespace AsmParserx8664
}
} while (1);
setAsmCode();*/
setAsmCode();
#endif
}
};

View file

@ -178,10 +178,12 @@ Statement *AsmStatement::semantic(Scope *sc)
return this;
if (!asmparser)
{
if (global.params.cpu == ARCHx86)
asmparser = new AsmParserx8632::AsmParser;
else if (global.params.cpu == ARCHx86_64)
asmparser = new AsmParserx8664::AsmParser;
}
asmparser->run(sc, this);

View file

@ -1252,7 +1252,7 @@ DValue* DtoDeclarationExp(Dsymbol* declaration)
}
}
// template
else if (TemplateDeclaration* t = declaration->isTemplateDeclaration())
else if (declaration->isTemplateDeclaration())
{
Logger::println("TemplateDeclaration");
// do nothing
@ -1437,7 +1437,7 @@ DValue* DtoInitializer(LLValue* target, Initializer* init)
assert(ex->exp);
return ex->exp->toElem(gIR);
}
else if (ArrayInitializer* ai = init->isArrayInitializer())
else if (init->isArrayInitializer())
{
// TODO: do nothing ?
}
@ -1445,7 +1445,7 @@ DValue* DtoInitializer(LLValue* target, Initializer* init)
{
// do nothing
}
else if (StructInitializer *si = init->isStructInitializer()) {
else if (init->isStructInitializer()) {
// TODO: again nothing ?
}
else {

View file

@ -197,7 +197,7 @@ static LLFunction* build_module_reference_and_ctor(LLConstant* moduleinfo)
IRBuilder<> builder(bb);
// debug info
llvm::DISubprogram subprog = DtoDwarfSubProgramInternal(fname.c_str(), fname.c_str());
DtoDwarfSubProgramInternal(fname.c_str(), fname.c_str());
// get current beginning
LLValue* curbeg = builder.CreateLoad(mref, "current");

View file

@ -96,7 +96,6 @@ DValue* DtoNestedVariable(Loc loc, Type* astype, VarDeclaration* vd, bool byref)
LLValue *dwarfValue = 0;
std::vector<LLValue*> dwarfAddr;
LLType *int64Ty = LLType::getInt64Ty(gIR->context());
// get the nested context
LLValue* ctx = 0;

View file

@ -170,14 +170,6 @@ static LLType* rt_dg2()
return LLStructType::get(gIR->context(), types);
}
static LLType* rt_complex(LLType* type)
{
llvm::SmallVector<LLType*, 2> types;
types.push_back(type);
types.push_back(type);
return llvm::StructType::get(gIR->context(), types);
}
static void LLVM_D_BuildRuntimeModule()
{
Logger::println("building module");
@ -187,24 +179,17 @@ static void LLVM_D_BuildRuntimeModule()
LLType* voidTy = LLType::getVoidTy(gIR->context());
LLType* boolTy = LLType::getInt1Ty(gIR->context());
LLType* byteTy = LLType::getInt8Ty(gIR->context());
LLType* shortTy = LLType::getInt16Ty(gIR->context());
LLType* intTy = LLType::getInt32Ty(gIR->context());
LLType* longTy = LLType::getInt64Ty(gIR->context());
LLType* sizeTy = DtoSize_t();
Logger::println("building float types");
LLType* floatTy = LLType::getFloatTy(gIR->context());
LLType* doubleTy = LLType::getDoubleTy(gIR->context());
LLType* realTy;
if ((global.params.cpu == ARCHx86) || (global.params.cpu == ARCHx86_64))
realTy = LLType::getX86_FP80Ty(gIR->context());
else
realTy = LLType::getDoubleTy(gIR->context());
LLType* cfloatTy = rt_complex(floatTy);
LLType* cdoubleTy = rt_complex(doubleTy);
LLType* crealTy = rt_complex(realTy);
Logger::println("building aggr types");
LLType* voidPtrTy = rt_ptr(byteTy);
LLType* voidArrayTy = rt_array(byteTy);
@ -247,8 +232,6 @@ static void LLVM_D_BuildRuntimeModule()
= Attr_ReadOnly.addAttr(gIR->context(), 1, llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::NoCapture))),
Attr_ReadOnly_1_3_NoCapture
= Attr_ReadOnly_1_NoCapture.addAttr(gIR->context(), 3, llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::NoCapture))),
Attr_ReadOnly_1_4_NoCapture
= Attr_ReadOnly_1_NoCapture.addAttr(gIR->context(), 4, llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::NoCapture))),
Attr_ReadOnly_NoUnwind_1_NoCapture
= Attr_ReadOnly_1_NoCapture.addAttr(gIR->context(), ~0U, llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::NoUnwind))),
Attr_ReadNone
@ -257,8 +240,10 @@ static void LLVM_D_BuildRuntimeModule()
= NoAttrs.addAttr(gIR->context(), 1, llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::NoCapture))),
Attr_NoAlias_1_NoCapture
= Attr_1_NoCapture.addAttr(gIR->context(), 0, llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::NoAlias))),
#if DMDV1
Attr_NoAlias_3_NoCapture
= Attr_NoAlias.addAttr(gIR->context(), 3, llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::NoCapture))),
#endif
Attr_1_2_NoCapture
= Attr_1_NoCapture.addAttr(gIR->context(), 2, llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::NoCapture))),
Attr_1_3_NoCapture
@ -280,8 +265,6 @@ static void LLVM_D_BuildRuntimeModule()
= Attr_ReadOnly.addAttr(1, NoCapture),
Attr_ReadOnly_1_3_NoCapture
= Attr_ReadOnly_1_NoCapture.addAttr(3, NoCapture),
Attr_ReadOnly_1_4_NoCapture
= Attr_ReadOnly_1_NoCapture.addAttr(4, NoCapture),
Attr_ReadOnly_NoUnwind_1_NoCapture
= Attr_ReadOnly_1_NoCapture.addAttr(~0U, NoUnwind),
Attr_ReadNone
@ -290,8 +273,10 @@ static void LLVM_D_BuildRuntimeModule()
= NoAttrs.addAttr(1, NoCapture),
Attr_NoAlias_1_NoCapture
= Attr_1_NoCapture.addAttr(0, NoAlias),
#if DMDV1
Attr_NoAlias_3_NoCapture
= Attr_NoAlias.addAttr(3, NoCapture),
#endif
Attr_1_2_NoCapture
= Attr_1_NoCapture.addAttr(2, NoCapture),
Attr_1_3_NoCapture

View file

@ -732,7 +732,7 @@ void DtoStore(LLValue* src, LLValue* dst)
{
// if (Logger::enabled())
// Logger::cout() << "storing " << *src << " into " << *dst << '\n';
LLValue* st = gIR->ir->CreateStore(src,dst);
gIR->ir->CreateStore(src,dst);
//st->setVolatile(gIR->func()->inVolatile);
}

View file

@ -271,9 +271,9 @@ int TypeBasic::builtinTypeInfo()
int TypeDArray::builtinTypeInfo()
{
#if DMDV2
return !mod && (next->isTypeBasic() != NULL && !next->mod ||
return !mod && ((next->isTypeBasic() != NULL && !next->mod) ||
// strings are so common, make them builtin
next->ty == Tchar && next->mod == MODimmutable);
(next->ty == Tchar && next->mod == MODimmutable));
#else
return next->isTypeBasic() != NULL;
#endif

View file

@ -101,12 +101,12 @@ struct IrFuncTy : IrBase
IrFuncTy()
: ret(NULL),
args(),
arg_sret(NULL),
arg_this(NULL),
arg_nest(NULL),
arg_arguments(NULL),
arg_argptr(NULL),
args(),
c_vararg(false),
reverseParams(false)
{}