diff --git a/dmd/mars.h b/dmd/mars.h index 21809470..f1d6a30e 100644 --- a/dmd/mars.h +++ b/dmd/mars.h @@ -412,7 +412,12 @@ void warning(Loc loc, const char *format, ...) IS_PRINTF(2); void vwarning(Loc loc, const char *format, va_list); void error(Loc loc, const char *format, ...) IS_PRINTF(2); void verror(Loc loc, const char *format, va_list); + +#ifdef __GNUC__ +__attribute__((noreturn)) +#endif void fatal(); + void err_nomem(); void inifile(char *argv0, const char *inifile); void halt(); diff --git a/gen/complex.cpp b/gen/complex.cpp index acb343d1..4fa98851 100644 --- a/gen/complex.cpp +++ b/gen/complex.cpp @@ -456,7 +456,9 @@ DValue* DtoCastComplex(Loc& loc, DValue* val, Type* _to) DImValue* re = new DImValue(extractty, repart); return DtoCastFloat(loc, re, to); } - else + else { error(loc, "Don't know how to cast %s to %s", vty->toChars(), to->toChars()); + fatal(); + } } diff --git a/gen/irstate.cpp b/gen/irstate.cpp index a34d9178..61ec1302 100644 --- a/gen/irstate.cpp +++ b/gen/irstate.cpp @@ -39,6 +39,7 @@ const IRScope& IRScope::operator=(const IRScope& rhs) begin = rhs.begin; end = rhs.end; builder.SetInsertPoint(begin); + return *this; } ////////////////////////////////////////////////////////////////////////////////////////// diff --git a/gen/linker.cpp b/gen/linker.cpp index b02c8029..3bbdd9bf 100644 --- a/gen/linker.cpp +++ b/gen/linker.cpp @@ -100,13 +100,13 @@ int linkExecutable(const char* argv0) exedir.set(gExePath.getDirname()); if (!exedir.exists()) { - exedir.createDirectoryOnDisk(true, &errstr); - if (!errstr.empty()) - { - error("failed to create path to linking output: %s\n%s", exedir.c_str(), errstr.c_str()); - fatal(); - } - } + exedir.createDirectoryOnDisk(true, &errstr); + if (!errstr.empty()) + { + error("failed to create path to linking output: %s\n%s", exedir.c_str(), errstr.c_str()); + fatal(); + } + } // strip debug info if (!global.params.symdebug) @@ -204,8 +204,10 @@ int linkExecutable(const char* argv0) error("linking failed:\nstatus: %d", status); if (!errstr.empty()) error("message: %s", errstr.c_str()); - fatal(); + return status; } + + return 0; } ////////////////////////////////////////////////////////////////////////////// @@ -266,13 +268,13 @@ int linkObjToExecutable(const char* argv0) exedir.set(gExePath.getDirname()); if (!exedir.exists()) { - exedir.createDirectoryOnDisk(true, &errstr); - if (!errstr.empty()) - { - error("failed to create path to linking output: %s\n%s", exedir.c_str(), errstr.c_str()); - fatal(); - } - } + exedir.createDirectoryOnDisk(true, &errstr); + if (!errstr.empty()) + { + error("failed to create path to linking output: %s\n%s", exedir.c_str(), errstr.c_str()); + fatal(); + } + } // additional linker switches for (int i = 0; i < global.params.linkswitches->dim; i++) @@ -339,14 +341,16 @@ int linkObjToExecutable(const char* argv0) // terminate args list 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)) { error("linking failed:\nstatus: %d", status); if (!errstr.empty()) error("message: %s", errstr.c_str()); - fatal(); + return status; } + + return 0; } ////////////////////////////////////////////////////////////////////////////// diff --git a/gen/main.cpp b/gen/main.cpp index 896bab54..9ec726a3 100644 --- a/gen/main.cpp +++ b/gen/main.cpp @@ -960,8 +960,7 @@ LDC_TARGETS else { if (global.params.link) - //status = runLINK(); - linkObjToExecutable(global.params.argv0); + status = linkObjToExecutable(global.params.argv0); if (global.params.run) {