Mercurial > projects > ldc
diff gen/linker.cpp @ 1586:7f728c52e63c
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.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Fri, 06 Nov 2009 21:51:41 +0100 |
parents | 2292878925f4 |
children | a60e7d1ce3ee |
line wrap: on
line diff
--- a/gen/linker.cpp Thu Oct 22 13:30:30 2009 +0200 +++ b/gen/linker.cpp Fri Nov 06 21:51:41 2009 +0100 @@ -100,13 +100,13 @@ 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 @@ error("linking failed:\nstatus: %d", status); if (!errstr.empty()) error("message: %s", errstr.c_str()); - fatal(); + return status; } + + return 0; } ////////////////////////////////////////////////////////////////////////////// @@ -266,13 +268,13 @@ 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 @@ // 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; } //////////////////////////////////////////////////////////////////////////////