mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-02 16:11:08 +03:00
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:
parent
289bb57adf
commit
0cd78dd579
13 changed files with 34 additions and 37 deletions
|
@ -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 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 vwarning(Loc loc, const char *format, va_list);
|
||||||
void verrorSupplemental(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))
|
__attribute__((noreturn))
|
||||||
#endif
|
#endif
|
||||||
void fatal();
|
void fatal();
|
||||||
|
|
|
@ -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 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 vwarning(Loc loc, const char *format, va_list);
|
||||||
void verrorSupplemental(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 fatal();
|
||||||
|
|
||||||
void err_nomem();
|
void err_nomem();
|
||||||
#if IN_LLVM
|
#if IN_LLVM
|
||||||
void error(const char *format, ...) IS_PRINTF(1);
|
void error(const char *format, ...) IS_PRINTF(1);
|
||||||
|
|
|
@ -33,8 +33,10 @@ private:
|
||||||
unsigned length;
|
unsigned length;
|
||||||
|
|
||||||
#ifndef IN_GCC
|
#ifndef IN_GCC
|
||||||
|
#if _MSC_VER
|
||||||
// Disable warning about nonstandard extension
|
// Disable warning about nonstandard extension
|
||||||
#pragma warning (disable : 4200)
|
#pragma warning (disable : 4200)
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
char lstring[];
|
char lstring[];
|
||||||
|
|
||||||
|
|
|
@ -2973,11 +2973,11 @@ namespace AsmParserx8632
|
||||||
|
|
||||||
void doData()
|
void doData()
|
||||||
{
|
{
|
||||||
|
// FIXME: data instructions not implemented.
|
||||||
|
#if 0
|
||||||
static const char * directives[] = { ".byte", ".short", ".long", ".long",
|
static const char * directives[] = { ".byte", ".short", ".long", ".long",
|
||||||
"", "", ""
|
"", "", ""
|
||||||
};
|
};
|
||||||
// FIXME
|
|
||||||
/*
|
|
||||||
machine_mode mode;
|
machine_mode mode;
|
||||||
|
|
||||||
insnTemplate->writestring(static_cast<char*>(directives[op - Op_db]));
|
insnTemplate->writestring(static_cast<char*>(directives[op - Op_db]));
|
||||||
|
@ -3048,7 +3048,8 @@ namespace AsmParserx8632
|
||||||
}
|
}
|
||||||
} while (1);
|
} while (1);
|
||||||
|
|
||||||
setAsmCode();*/
|
setAsmCode();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -420,9 +420,9 @@ namespace AsmParserx8664
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
Opr operands[3];
|
Opr operands[3];
|
||||||
unsigned char
|
unsigned short
|
||||||
needsType : 3,
|
needsType : 3,
|
||||||
implicitClobbers : 8,
|
implicitClobbers : 9,
|
||||||
linkType : 2;
|
linkType : 2;
|
||||||
unsigned link;
|
unsigned link;
|
||||||
|
|
||||||
|
@ -3111,11 +3111,12 @@ namespace AsmParserx8664
|
||||||
|
|
||||||
void doData()
|
void doData()
|
||||||
{
|
{
|
||||||
|
// FIXME: data instructions not implemented.
|
||||||
|
#if 0
|
||||||
static const char * directives[] = { ".byte", ".short", ".long", ".long",
|
static const char * directives[] = { ".byte", ".short", ".long", ".long",
|
||||||
"", "", ""
|
"", "", ""
|
||||||
};
|
};
|
||||||
// FIXME
|
|
||||||
/*
|
|
||||||
machine_mode mode;
|
machine_mode mode;
|
||||||
|
|
||||||
insnTemplate->writestring(static_cast<char*>(directives[op - Op_db]));
|
insnTemplate->writestring(static_cast<char*>(directives[op - Op_db]));
|
||||||
|
@ -3186,7 +3187,8 @@ namespace AsmParserx8664
|
||||||
}
|
}
|
||||||
} while (1);
|
} while (1);
|
||||||
|
|
||||||
setAsmCode();*/
|
setAsmCode();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -178,10 +178,12 @@ Statement *AsmStatement::semantic(Scope *sc)
|
||||||
return this;
|
return this;
|
||||||
|
|
||||||
if (!asmparser)
|
if (!asmparser)
|
||||||
|
{
|
||||||
if (global.params.cpu == ARCHx86)
|
if (global.params.cpu == ARCHx86)
|
||||||
asmparser = new AsmParserx8632::AsmParser;
|
asmparser = new AsmParserx8632::AsmParser;
|
||||||
else if (global.params.cpu == ARCHx86_64)
|
else if (global.params.cpu == ARCHx86_64)
|
||||||
asmparser = new AsmParserx8664::AsmParser;
|
asmparser = new AsmParserx8664::AsmParser;
|
||||||
|
}
|
||||||
|
|
||||||
asmparser->run(sc, this);
|
asmparser->run(sc, this);
|
||||||
|
|
||||||
|
|
|
@ -1252,7 +1252,7 @@ DValue* DtoDeclarationExp(Dsymbol* declaration)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// template
|
// template
|
||||||
else if (TemplateDeclaration* t = declaration->isTemplateDeclaration())
|
else if (declaration->isTemplateDeclaration())
|
||||||
{
|
{
|
||||||
Logger::println("TemplateDeclaration");
|
Logger::println("TemplateDeclaration");
|
||||||
// do nothing
|
// do nothing
|
||||||
|
@ -1437,7 +1437,7 @@ DValue* DtoInitializer(LLValue* target, Initializer* init)
|
||||||
assert(ex->exp);
|
assert(ex->exp);
|
||||||
return ex->exp->toElem(gIR);
|
return ex->exp->toElem(gIR);
|
||||||
}
|
}
|
||||||
else if (ArrayInitializer* ai = init->isArrayInitializer())
|
else if (init->isArrayInitializer())
|
||||||
{
|
{
|
||||||
// TODO: do nothing ?
|
// TODO: do nothing ?
|
||||||
}
|
}
|
||||||
|
@ -1445,7 +1445,7 @@ DValue* DtoInitializer(LLValue* target, Initializer* init)
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
else if (StructInitializer *si = init->isStructInitializer()) {
|
else if (init->isStructInitializer()) {
|
||||||
// TODO: again nothing ?
|
// TODO: again nothing ?
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -197,7 +197,7 @@ static LLFunction* build_module_reference_and_ctor(LLConstant* moduleinfo)
|
||||||
IRBuilder<> builder(bb);
|
IRBuilder<> builder(bb);
|
||||||
|
|
||||||
// debug info
|
// debug info
|
||||||
llvm::DISubprogram subprog = DtoDwarfSubProgramInternal(fname.c_str(), fname.c_str());
|
DtoDwarfSubProgramInternal(fname.c_str(), fname.c_str());
|
||||||
|
|
||||||
// get current beginning
|
// get current beginning
|
||||||
LLValue* curbeg = builder.CreateLoad(mref, "current");
|
LLValue* curbeg = builder.CreateLoad(mref, "current");
|
||||||
|
|
|
@ -96,7 +96,6 @@ DValue* DtoNestedVariable(Loc loc, Type* astype, VarDeclaration* vd, bool byref)
|
||||||
|
|
||||||
LLValue *dwarfValue = 0;
|
LLValue *dwarfValue = 0;
|
||||||
std::vector<LLValue*> dwarfAddr;
|
std::vector<LLValue*> dwarfAddr;
|
||||||
LLType *int64Ty = LLType::getInt64Ty(gIR->context());
|
|
||||||
|
|
||||||
// get the nested context
|
// get the nested context
|
||||||
LLValue* ctx = 0;
|
LLValue* ctx = 0;
|
||||||
|
|
|
@ -170,14 +170,6 @@ static LLType* rt_dg2()
|
||||||
return LLStructType::get(gIR->context(), types);
|
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()
|
static void LLVM_D_BuildRuntimeModule()
|
||||||
{
|
{
|
||||||
Logger::println("building module");
|
Logger::println("building module");
|
||||||
|
@ -187,24 +179,17 @@ static void LLVM_D_BuildRuntimeModule()
|
||||||
LLType* voidTy = LLType::getVoidTy(gIR->context());
|
LLType* voidTy = LLType::getVoidTy(gIR->context());
|
||||||
LLType* boolTy = LLType::getInt1Ty(gIR->context());
|
LLType* boolTy = LLType::getInt1Ty(gIR->context());
|
||||||
LLType* byteTy = LLType::getInt8Ty(gIR->context());
|
LLType* byteTy = LLType::getInt8Ty(gIR->context());
|
||||||
LLType* shortTy = LLType::getInt16Ty(gIR->context());
|
|
||||||
LLType* intTy = LLType::getInt32Ty(gIR->context());
|
LLType* intTy = LLType::getInt32Ty(gIR->context());
|
||||||
LLType* longTy = LLType::getInt64Ty(gIR->context());
|
LLType* longTy = LLType::getInt64Ty(gIR->context());
|
||||||
LLType* sizeTy = DtoSize_t();
|
LLType* sizeTy = DtoSize_t();
|
||||||
|
|
||||||
Logger::println("building float types");
|
Logger::println("building float types");
|
||||||
LLType* floatTy = LLType::getFloatTy(gIR->context());
|
|
||||||
LLType* doubleTy = LLType::getDoubleTy(gIR->context());
|
|
||||||
LLType* realTy;
|
LLType* realTy;
|
||||||
if ((global.params.cpu == ARCHx86) || (global.params.cpu == ARCHx86_64))
|
if ((global.params.cpu == ARCHx86) || (global.params.cpu == ARCHx86_64))
|
||||||
realTy = LLType::getX86_FP80Ty(gIR->context());
|
realTy = LLType::getX86_FP80Ty(gIR->context());
|
||||||
else
|
else
|
||||||
realTy = LLType::getDoubleTy(gIR->context());
|
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");
|
Logger::println("building aggr types");
|
||||||
LLType* voidPtrTy = rt_ptr(byteTy);
|
LLType* voidPtrTy = rt_ptr(byteTy);
|
||||||
LLType* voidArrayTy = rt_array(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.addAttr(gIR->context(), 1, llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::NoCapture))),
|
||||||
Attr_ReadOnly_1_3_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_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_NoUnwind_1_NoCapture
|
||||||
= Attr_ReadOnly_1_NoCapture.addAttr(gIR->context(), ~0U, llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::NoUnwind))),
|
= Attr_ReadOnly_1_NoCapture.addAttr(gIR->context(), ~0U, llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::NoUnwind))),
|
||||||
Attr_ReadNone
|
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))),
|
= NoAttrs.addAttr(gIR->context(), 1, llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::NoCapture))),
|
||||||
Attr_NoAlias_1_NoCapture
|
Attr_NoAlias_1_NoCapture
|
||||||
= Attr_1_NoCapture.addAttr(gIR->context(), 0, llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::NoAlias))),
|
= 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_3_NoCapture
|
||||||
= Attr_NoAlias.addAttr(gIR->context(), 3, llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::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_2_NoCapture
|
||||||
= Attr_1_NoCapture.addAttr(gIR->context(), 2, llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::NoCapture))),
|
= Attr_1_NoCapture.addAttr(gIR->context(), 2, llvm::Attributes::get(gIR->context(), llvm::AttrBuilder().addAttribute(llvm::Attributes::NoCapture))),
|
||||||
Attr_1_3_NoCapture
|
Attr_1_3_NoCapture
|
||||||
|
@ -280,8 +265,6 @@ static void LLVM_D_BuildRuntimeModule()
|
||||||
= Attr_ReadOnly.addAttr(1, NoCapture),
|
= Attr_ReadOnly.addAttr(1, NoCapture),
|
||||||
Attr_ReadOnly_1_3_NoCapture
|
Attr_ReadOnly_1_3_NoCapture
|
||||||
= Attr_ReadOnly_1_NoCapture.addAttr(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_NoUnwind_1_NoCapture
|
||||||
= Attr_ReadOnly_1_NoCapture.addAttr(~0U, NoUnwind),
|
= Attr_ReadOnly_1_NoCapture.addAttr(~0U, NoUnwind),
|
||||||
Attr_ReadNone
|
Attr_ReadNone
|
||||||
|
@ -290,8 +273,10 @@ static void LLVM_D_BuildRuntimeModule()
|
||||||
= NoAttrs.addAttr(1, NoCapture),
|
= NoAttrs.addAttr(1, NoCapture),
|
||||||
Attr_NoAlias_1_NoCapture
|
Attr_NoAlias_1_NoCapture
|
||||||
= Attr_1_NoCapture.addAttr(0, NoAlias),
|
= Attr_1_NoCapture.addAttr(0, NoAlias),
|
||||||
|
#if DMDV1
|
||||||
Attr_NoAlias_3_NoCapture
|
Attr_NoAlias_3_NoCapture
|
||||||
= Attr_NoAlias.addAttr(3, NoCapture),
|
= Attr_NoAlias.addAttr(3, NoCapture),
|
||||||
|
#endif
|
||||||
Attr_1_2_NoCapture
|
Attr_1_2_NoCapture
|
||||||
= Attr_1_NoCapture.addAttr(2, NoCapture),
|
= Attr_1_NoCapture.addAttr(2, NoCapture),
|
||||||
Attr_1_3_NoCapture
|
Attr_1_3_NoCapture
|
||||||
|
|
|
@ -732,7 +732,7 @@ void DtoStore(LLValue* src, LLValue* dst)
|
||||||
{
|
{
|
||||||
// if (Logger::enabled())
|
// if (Logger::enabled())
|
||||||
// Logger::cout() << "storing " << *src << " into " << *dst << '\n';
|
// Logger::cout() << "storing " << *src << " into " << *dst << '\n';
|
||||||
LLValue* st = gIR->ir->CreateStore(src,dst);
|
gIR->ir->CreateStore(src,dst);
|
||||||
//st->setVolatile(gIR->func()->inVolatile);
|
//st->setVolatile(gIR->func()->inVolatile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -271,9 +271,9 @@ int TypeBasic::builtinTypeInfo()
|
||||||
int TypeDArray::builtinTypeInfo()
|
int TypeDArray::builtinTypeInfo()
|
||||||
{
|
{
|
||||||
#if DMDV2
|
#if DMDV2
|
||||||
return !mod && (next->isTypeBasic() != NULL && !next->mod ||
|
return !mod && ((next->isTypeBasic() != NULL && !next->mod) ||
|
||||||
// strings are so common, make them builtin
|
// strings are so common, make them builtin
|
||||||
next->ty == Tchar && next->mod == MODimmutable);
|
(next->ty == Tchar && next->mod == MODimmutable));
|
||||||
#else
|
#else
|
||||||
return next->isTypeBasic() != NULL;
|
return next->isTypeBasic() != NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -101,12 +101,12 @@ struct IrFuncTy : IrBase
|
||||||
|
|
||||||
IrFuncTy()
|
IrFuncTy()
|
||||||
: ret(NULL),
|
: ret(NULL),
|
||||||
args(),
|
|
||||||
arg_sret(NULL),
|
arg_sret(NULL),
|
||||||
arg_this(NULL),
|
arg_this(NULL),
|
||||||
arg_nest(NULL),
|
arg_nest(NULL),
|
||||||
arg_arguments(NULL),
|
arg_arguments(NULL),
|
||||||
arg_argptr(NULL),
|
arg_argptr(NULL),
|
||||||
|
args(),
|
||||||
c_vararg(false),
|
c_vararg(false),
|
||||||
reverseParams(false)
|
reverseParams(false)
|
||||||
{}
|
{}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue