summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2013-04-08 23:23:12 +0300
committerZahary Karadjov <zahary@gmail.com>2013-04-08 23:23:12 +0300
commit95b28700cc38bb2d2cee2a93745c75545c2f3d89 (patch)
tree533d01e4de1fef9513d54f92d0fc76795caa0209
parenta3073cf078bdc7828faed560e2292fc05e50fcc8 (diff)
downloadNim-95b28700cc38bb2d2cee2a93745c75545c2f3d89.tar.gz
bugfix: fix linking when symbol files are used
-rw-r--r--compiler/ccgmerge.nim11
-rw-r--r--compiler/cgen.nim5
-rw-r--r--compiler/extccomp.nim2
-rw-r--r--compiler/main.nim4
-rw-r--r--compiler/options.nim3
5 files changed, 12 insertions, 13 deletions
diff --git a/compiler/ccgmerge.nim b/compiler/ccgmerge.nim
index baf4f5586..751e507e9 100644
--- a/compiler/ccgmerge.nim
+++ b/compiler/ccgmerge.nim
@@ -45,11 +45,8 @@ const
   ]
   NimMergeEndMark = "/*\tNIM_merge_END:*/"
 
-template mergeSectionsEnabled: expr =
-  {optCaasEnabled, optSymbolFiles} * gGlobalOptions != {}
-
 proc genSectionStart*(fs: TCFileSection): PRope =
-  if mergeSectionsEnabled:
+  if compilationCachePresent:
     result = toRope(tnl)
     app(result, "/*\t")
     app(result, CFileSectionNames[fs])
@@ -57,11 +54,11 @@ proc genSectionStart*(fs: TCFileSection): PRope =
     app(result, tnl)
 
 proc genSectionEnd*(fs: TCFileSection): PRope =
-  if mergeSectionsEnabled:
+  if compilationCachePresent:
     result = toRope(NimMergeEndMark & tnl)
 
 proc genSectionStart*(ps: TCProcSection): PRope =
-  if mergeSectionsEnabled:
+  if compilationCachePresent:
     result = toRope(tnl)
     app(result, "/*\t")
     app(result, CProcSectionNames[ps])
@@ -69,7 +66,7 @@ proc genSectionStart*(ps: TCProcSection): PRope =
     app(result, tnl)
 
 proc genSectionEnd*(ps: TCProcSection): PRope =
-  if mergeSectionsEnabled:
+  if compilationCachePresent:
     result = toRope(NimMergeEndMark & tnl)
 
 proc writeTypeCache(a: TIdTable, s: var string) =
diff --git a/compiler/cgen.nim b/compiler/cgen.nim
index b7849f074..d7f8c4e22 100644
--- a/compiler/cgen.nim
+++ b/compiler/cgen.nim
@@ -1254,7 +1254,7 @@ proc updateCachedModule(m: BModule) =
   let cfile = getCFile(m)
   let cfilenoext = changeFileExt(cfile, "")
   
-  if mergeRequired(m):
+  if mergeRequired(m) and sfMainModule notin m.module.flags:
     mergeFiles(cfile, m)
     genInitCode(m)
     finishTypeDescriptions(m)
@@ -1264,8 +1264,7 @@ proc updateCachedModule(m: BModule) =
 
   addFileToLink(cfilenoext)
 
-proc cgenCaasUpdate* =
-  # XXX(zah): clean-up the fromCache mess
+proc updateCachedModules* =
   for m in cgenModules():
     if m.fromCache: m.updateCachedModule
 
diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim
index c1a8e9bce..bb2f09151 100644
--- a/compiler/extccomp.nim
+++ b/compiler/extccomp.nim
@@ -392,7 +392,7 @@ proc resetCompilationLists* =
   initLinkedList(toLink)
 
 proc addFileToLink*(filename: string) =
-  prependStr(toLink, filename) 
+  prependStr(toLink, filename)
   # BUGFIX: was ``appendStr``
 
 proc execExternalProgram*(cmd: string) = 
diff --git a/compiler/main.nim b/compiler/main.nim
index 3bb4ad399..b5186ba6c 100644
--- a/compiler/main.nim
+++ b/compiler/main.nim
@@ -252,8 +252,8 @@ proc CommandCompileToC =
 
   compileProject()
 
-  if optCaasEnabled in gGlobalOptions:
-    cgenCaasUpdate()
+  if compilationCachePresent:
+    updateCachedModules()
 
   if gCmd != cmdRun:
     extccomp.CallCCompiler(changeFileExt(gProjectFull, ""))
diff --git a/compiler/options.nim b/compiler/options.nim
index b38263ec5..899332b6e 100644
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -110,6 +110,9 @@ var
 proc importantComments*(): bool {.inline.} = gCmd in {cmdDoc, cmdIdeTools}
 proc usesNativeGC*(): bool {.inline.} = gSelectedGC >= gcRefc
 
+template compilationCachePresent*: expr =
+  {optCaasEnabled, optSymbolFiles} * gGlobalOptions != {}
+
 const 
   genSubDir* = "nimcache"
   NimExt* = "nim"