changeset 1635:601d3eea4a68

Make -nodefaultlib override -de{fault,bug}lib=foo instead of vice versa.
author Matti Niemenmaa <matti.niemenmaa+hg@iki.fi>
date Fri, 05 Mar 2010 21:40:51 +0200
parents 9cc791423e20
children 332925de1881
files gen/main.cpp
diffstat 1 files changed, 20 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/gen/main.cpp	Thu Feb 25 17:12:54 2010 -0700
+++ b/gen/main.cpp	Fri Mar 05 21:40:51 2010 +0200
@@ -301,29 +301,32 @@
     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)