Mercurial > projects > ldc
comparison 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 |
comparison
equal
deleted
inserted
replaced
1585:29b0f2d11c92 | 1586:7f728c52e63c |
---|---|
98 // create path to exe | 98 // create path to exe |
99 llvm::sys::Path exedir(gExePath); | 99 llvm::sys::Path exedir(gExePath); |
100 exedir.set(gExePath.getDirname()); | 100 exedir.set(gExePath.getDirname()); |
101 if (!exedir.exists()) | 101 if (!exedir.exists()) |
102 { | 102 { |
103 exedir.createDirectoryOnDisk(true, &errstr); | 103 exedir.createDirectoryOnDisk(true, &errstr); |
104 if (!errstr.empty()) | 104 if (!errstr.empty()) |
105 { | 105 { |
106 error("failed to create path to linking output: %s\n%s", exedir.c_str(), errstr.c_str()); | 106 error("failed to create path to linking output: %s\n%s", exedir.c_str(), errstr.c_str()); |
107 fatal(); | 107 fatal(); |
108 } | 108 } |
109 } | 109 } |
110 | 110 |
111 // strip debug info | 111 // strip debug info |
112 if (!global.params.symdebug) | 112 if (!global.params.symdebug) |
113 args.push_back("-strip-debug"); | 113 args.push_back("-strip-debug"); |
114 | 114 |
202 if (int status = llvm::sys::Program::ExecuteAndWait(ldpath, &args[0], NULL, NULL, 0,0, &errstr)) | 202 if (int status = llvm::sys::Program::ExecuteAndWait(ldpath, &args[0], NULL, NULL, 0,0, &errstr)) |
203 { | 203 { |
204 error("linking failed:\nstatus: %d", status); | 204 error("linking failed:\nstatus: %d", status); |
205 if (!errstr.empty()) | 205 if (!errstr.empty()) |
206 error("message: %s", errstr.c_str()); | 206 error("message: %s", errstr.c_str()); |
207 fatal(); | 207 return status; |
208 } | 208 } |
209 | |
210 return 0; | |
209 } | 211 } |
210 | 212 |
211 ////////////////////////////////////////////////////////////////////////////// | 213 ////////////////////////////////////////////////////////////////////////////// |
212 | 214 |
213 int linkObjToExecutable(const char* argv0) | 215 int linkObjToExecutable(const char* argv0) |
264 // create path to exe | 266 // create path to exe |
265 llvm::sys::Path exedir(gExePath); | 267 llvm::sys::Path exedir(gExePath); |
266 exedir.set(gExePath.getDirname()); | 268 exedir.set(gExePath.getDirname()); |
267 if (!exedir.exists()) | 269 if (!exedir.exists()) |
268 { | 270 { |
269 exedir.createDirectoryOnDisk(true, &errstr); | 271 exedir.createDirectoryOnDisk(true, &errstr); |
270 if (!errstr.empty()) | 272 if (!errstr.empty()) |
271 { | 273 { |
272 error("failed to create path to linking output: %s\n%s", exedir.c_str(), errstr.c_str()); | 274 error("failed to create path to linking output: %s\n%s", exedir.c_str(), errstr.c_str()); |
273 fatal(); | 275 fatal(); |
274 } | 276 } |
275 } | 277 } |
276 | 278 |
277 // additional linker switches | 279 // additional linker switches |
278 for (int i = 0; i < global.params.linkswitches->dim; i++) | 280 for (int i = 0; i < global.params.linkswitches->dim; i++) |
279 { | 281 { |
280 char *p = (char *)global.params.linkswitches->data[i]; | 282 char *p = (char *)global.params.linkswitches->data[i]; |
337 | 339 |
338 | 340 |
339 // terminate args list | 341 // terminate args list |
340 args.push_back(NULL); | 342 args.push_back(NULL); |
341 | 343 |
342 // try to call linker!!! | 344 // try to call linker |
343 if (int status = llvm::sys::Program::ExecuteAndWait(gcc, &args[0], NULL, NULL, 0,0, &errstr)) | 345 if (int status = llvm::sys::Program::ExecuteAndWait(gcc, &args[0], NULL, NULL, 0,0, &errstr)) |
344 { | 346 { |
345 error("linking failed:\nstatus: %d", status); | 347 error("linking failed:\nstatus: %d", status); |
346 if (!errstr.empty()) | 348 if (!errstr.empty()) |
347 error("message: %s", errstr.c_str()); | 349 error("message: %s", errstr.c_str()); |
348 fatal(); | 350 return status; |
349 } | 351 } |
352 | |
353 return 0; | |
350 } | 354 } |
351 | 355 |
352 ////////////////////////////////////////////////////////////////////////////// | 356 ////////////////////////////////////////////////////////////////////////////// |
353 | 357 |
354 void deleteExecutable() | 358 void deleteExecutable() |