Fix several 'reaches end of function' warnings by making fatal noreturn.

The warnings also pointed out a few genuine bugs. Replace some tabs with
spaces.
This commit is contained in:
Christian Kamm 2009-11-06 21:51:41 +01:00
parent 0db459fad0
commit 64a8e47ad6
5 changed files with 31 additions and 20 deletions

View file

@ -412,7 +412,12 @@ void warning(Loc loc, const char *format, ...) IS_PRINTF(2);
void vwarning(Loc loc, const char *format, va_list); void vwarning(Loc loc, const char *format, va_list);
void error(Loc loc, const char *format, ...) IS_PRINTF(2); void error(Loc loc, const char *format, ...) IS_PRINTF(2);
void verror(Loc loc, const char *format, va_list); void verror(Loc loc, const char *format, va_list);
#ifdef __GNUC__
__attribute__((noreturn))
#endif
void fatal(); void fatal();
void err_nomem(); void err_nomem();
void inifile(char *argv0, const char *inifile); void inifile(char *argv0, const char *inifile);
void halt(); void halt();

View file

@ -456,7 +456,9 @@ DValue* DtoCastComplex(Loc& loc, DValue* val, Type* _to)
DImValue* re = new DImValue(extractty, repart); DImValue* re = new DImValue(extractty, repart);
return DtoCastFloat(loc, re, to); return DtoCastFloat(loc, re, to);
} }
else else {
error(loc, "Don't know how to cast %s to %s", vty->toChars(), to->toChars()); error(loc, "Don't know how to cast %s to %s", vty->toChars(), to->toChars());
fatal();
}
} }

View file

@ -39,6 +39,7 @@ const IRScope& IRScope::operator=(const IRScope& rhs)
begin = rhs.begin; begin = rhs.begin;
end = rhs.end; end = rhs.end;
builder.SetInsertPoint(begin); builder.SetInsertPoint(begin);
return *this;
} }
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////

View file

@ -204,8 +204,10 @@ int linkExecutable(const char* argv0)
error("linking failed:\nstatus: %d", status); error("linking failed:\nstatus: %d", status);
if (!errstr.empty()) if (!errstr.empty())
error("message: %s", errstr.c_str()); error("message: %s", errstr.c_str());
fatal(); return status;
} }
return 0;
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
@ -339,14 +341,16 @@ int linkObjToExecutable(const char* argv0)
// terminate args list // terminate args list
args.push_back(NULL); args.push_back(NULL);
// try to call linker!!! // try to call linker
if (int status = llvm::sys::Program::ExecuteAndWait(gcc, &args[0], NULL, NULL, 0,0, &errstr)) if (int status = llvm::sys::Program::ExecuteAndWait(gcc, &args[0], NULL, NULL, 0,0, &errstr))
{ {
error("linking failed:\nstatus: %d", status); error("linking failed:\nstatus: %d", status);
if (!errstr.empty()) if (!errstr.empty())
error("message: %s", errstr.c_str()); error("message: %s", errstr.c_str());
fatal(); return status;
} }
return 0;
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////

View file

@ -960,8 +960,7 @@ LDC_TARGETS
else else
{ {
if (global.params.link) if (global.params.link)
//status = runLINK(); status = linkObjToExecutable(global.params.argv0);
linkObjToExecutable(global.params.argv0);
if (global.params.run) if (global.params.run)
{ {