From b0271794cded1b1a6b51a954a15ce294e81f64b8 Mon Sep 17 00:00:00 2001 From: Matti Niemenmaa Date: Fri, 5 Mar 2010 21:40:51 +0200 Subject: [PATCH] Make -nodefaultlib override -de{fault,bug}lib=foo instead of vice versa. --- gen/main.cpp | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/gen/main.cpp b/gen/main.cpp index 35ba5e10..7a0ad186 100644 --- a/gen/main.cpp +++ b/gen/main.cpp @@ -301,29 +301,32 @@ int main(int argc, char** argv) else libs = global.params.defaultlibnames; - if (libs) + if (!noDefaultLib) { - for (int i = 0; i < libs->dim; i++) + if (libs) { - char* lib = (char *)libs->data[i]; - char *arg = (char *)mem.malloc(strlen(lib) + 3); - strcpy(arg, "-l"); - strcpy(arg+2, lib); - global.params.linkswitches->push(arg); + for (int i = 0; i < libs->dim; i++) + { + char* lib = (char *)libs->data[i]; + char *arg = (char *)mem.malloc(strlen(lib) + 3); + strcpy(arg, "-l"); + strcpy(arg+2, lib); + global.params.linkswitches->push(arg); + } } - } - else if (!noDefaultLib) - { + else + { #if DMDV2 - global.params.linkswitches->push(mem.strdup("-ldruntime-ldc")); + global.params.linkswitches->push(mem.strdup("-ldruntime-ldc")); #else - global.params.linkswitches->push(mem.strdup("-lldc-runtime")); - global.params.linkswitches->push(mem.strdup("-ltango-cc-tango")); - global.params.linkswitches->push(mem.strdup("-ltango-gc-basic")); - // pass the runtime again to resolve issues - // with linking order - global.params.linkswitches->push(mem.strdup("-lldc-runtime")); + global.params.linkswitches->push(mem.strdup("-lldc-runtime")); + global.params.linkswitches->push(mem.strdup("-ltango-cc-tango")); + global.params.linkswitches->push(mem.strdup("-ltango-gc-basic")); + // pass the runtime again to resolve issues + // with linking order + global.params.linkswitches->push(mem.strdup("-lldc-runtime")); #endif + } } if (global.params.run)