Merge pull request #1649 from JohanEngelen/warningfix1

Fix a few clang warnings [NFC]
This commit is contained in:
kinke 2016-07-28 00:46:53 +02:00 committed by GitHub
commit dbc9733a05
5 changed files with 6 additions and 18 deletions

View file

@ -34,13 +34,6 @@
//////////////////////////////////////////////////////////////////////////////
static bool endsWith(const std::string &str, const std::string &end) {
return (str.length() >= end.length() &&
std::equal(end.rbegin(), end.rend(), str.rbegin()));
}
//////////////////////////////////////////////////////////////////////////////
static void CreateDirectoryOnDisk(llvm::StringRef fileName) {
auto dir = llvm::sys::path::parent_path(fileName);
if (!dir.empty() && !llvm::sys::fs::exists(dir)) {

View file

@ -291,7 +291,7 @@ llvm::FunctionType *DtoFunctionType(FuncDeclaration *fdecl) {
if (fdecl->linkage == LINKobjc && dthis) {
if (fdecl->objc.selector) {
hasSel = true;
} else if (ClassDeclaration *cd = fdecl->parent->isClassDeclaration()) {
} else if (fdecl->parent->isClassDeclaration()) {
fdecl->error("Objective-C @selector is missing");
}
}
@ -1235,8 +1235,8 @@ int isDruntimeArrayOp(FuncDeclaration *fd) {
}
#ifdef DEBUG // Make sure our array is alphabetized
for (i = 0; i < sizeof(libArrayopFuncs) / sizeof(char *); i++) {
if (strcmp(name, libArrayopFuncs[i]) == 0)
for (size_t j = 0; j < sizeof(libArrayopFuncs) / sizeof(char *); j++) {
if (strcmp(name, libArrayopFuncs[j]) == 0)
assert(0);
}
#endif

View file

@ -561,7 +561,6 @@ DValue *DtoCastVector(Loc &loc, DValue *val, Type *to) {
assert(val->type->toBasetype()->ty == Tvector);
Type *totype = to->toBasetype();
LLType *tolltype = DtoType(to);
TypeVector *type = static_cast<TypeVector *>(val->type->toBasetype());
if (totype->ty == Tsarray) {
// If possible, we need to cast only the address of the vector without

View file

@ -86,11 +86,6 @@ void checkStructElems(StructLiteralExp *sle, ArrayParam<Type *> elemTypes) {
}
}
bool getBoolElem(StructLiteralExp *sle, size_t idx) {
auto arg = (*sle->elements)[idx];
return arg->toInteger() != 0;
}
/// Returns a null-terminated string
const char *getStringElem(StructLiteralExp *sle, size_t idx) {
auto arg = (*sle->elements)[idx];

View file

@ -371,8 +371,9 @@ llvm::GlobalVariable *IrAggr::getInterfaceVtbl(BaseClass *b, bool new_instance,
// Create a dummy FuncDeclaration with enough information to satisfy the
// DIBuilder
FuncDeclaration *thunkFd = reinterpret_cast<FuncDeclaration *>(memcpy(
new char[sizeof(FuncDeclaration)], fd, sizeof(FuncDeclaration)));
FuncDeclaration *thunkFd = reinterpret_cast<FuncDeclaration *>(
memcpy(new char[sizeof(FuncDeclaration)], (void *)fd,
sizeof(FuncDeclaration)));
thunkFd->ir = new IrDsymbol();
auto thunkFunc = getIrFunc(thunkFd, true); // create the IrFunction
thunkFunc->func = thunk;