summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-12-21 11:38:33 +0100
committerAndreas Rumpf <rumpf_a@web.de>2016-12-21 11:38:33 +0100
commitd2fe857f9476c6b640b55d99c55aefb0bb1dcca8 (patch)
tree613635e7c5368e163211011a243d5ab853805b7d /compiler
parent06a8d37f9a6e194351c58c6668df4a4e69c5f470 (diff)
downloadNim-d2fe857f9476c6b640b55d99c55aefb0bb1dcca8.tar.gz
fixes #5136
Diffstat (limited to 'compiler')
-rw-r--r--compiler/cgen.nim12
1 files changed, 6 insertions, 6 deletions
diff --git a/compiler/cgen.nim b/compiler/cgen.nim
index 0ca8e46fc..a4e426025 100644
--- a/compiler/cgen.nim
+++ b/compiler/cgen.nim
@@ -732,10 +732,12 @@ proc genProcNoForward(m: BModule, prc: PSym) =
     # dependency to a compilerproc:
     discard cgsym(m, prc.name.s)
     return
-  if lfNoDecl in prc.loc.flags:
+  if sfImportc in prc.flags:
     fillProcLoc(m, prc)
-    useHeader(m, prc)
-    genProcPrototype(m, prc)
+    if lfHeader in prc.loc.flags:
+      useHeader(m, prc)
+    elif lfNoDecl notin prc.loc.flags:
+      genProcPrototype(m, prc)
   elif prc.typ.callConv == ccInline:
     # We add inline procs to the calling module to enable C based inlining.
     # This also means that a check with ``q.declaredThings`` is wrong, we need
@@ -760,15 +762,13 @@ proc genProcNoForward(m: BModule, prc: PSym) =
       symInDynamicLib(q, prc)
     else:
       symInDynamicLibPartial(m, prc)
-  elif sfImportc notin prc.flags:
+  else:
     var q = findPendingModule(m, prc)
     fillProcLoc(q, prc)
     useHeader(m, prc)
     genProcPrototype(m, prc)
     if q != nil and not containsOrIncl(q.declaredThings, prc.id):
       genProcAux(q, prc)
-  else:
-    fillProcLoc(m, prc)
 
 proc requestConstImpl(p: BProc, sym: PSym) =
   var m = p.module