summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xcompiler/semgnrc.nim9
-rw-r--r--lib/pure/actors.nim2
-rw-r--r--lib/pure/nimprof.nim10
-rwxr-xr-xlib/system/ansi_c.nim2
4 files changed, 15 insertions, 8 deletions
diff --git a/compiler/semgnrc.nim b/compiler/semgnrc.nim
index a330e17e7..434dd7155 100755
--- a/compiler/semgnrc.nim
+++ b/compiler/semgnrc.nim
@@ -138,9 +138,12 @@ proc semGenericStmt(c: PContext, n: PNode,
       else:
         result.sons[0] = newSymNode(s, n.sons[0].info)
         first = 1
-    if not isDefinedMagic:
-      for i in countup(first, sonsLen(result) - 1): 
-        result.sons[i] = semGenericStmt(c, result.sons[i], flags, toBind)
+    # Consider 'when defined(globalsSlot): ThreadVarSetValue(globalsSlot, ...)'
+    # in threads.nim: the subtle preprocessing here binds 'globalsSlot' which 
+    # is not exported and yet the generic 'threadProcWrapper' works correctly.
+    let flags = if isDefinedMagic: flags+{withinMixin} else: flags
+    for i in countup(first, sonsLen(result) - 1):
+      result.sons[i] = semGenericStmt(c, result.sons[i], flags, toBind)
   of nkMacroStmt: 
     checkMinSonsLen(n, 2)
     var a: PNode
diff --git a/lib/pure/actors.nim b/lib/pure/actors.nim
index c6f277745..2d902debe 100644
--- a/lib/pure/actors.nim
+++ b/lib/pure/actors.nim
@@ -51,7 +51,7 @@ proc inbox*[TIn, TOut](self: PActor[TIn, TOut]): ptr TChannel[TIn] =
   ## gets a pointer to the associated inbox of the actor `self`.
   result = addr(self.i)
 
-proc running*[TIn, TOut](a: PActor[TIn, TOut]) =
+proc running*[TIn, TOut](a: PActor[TIn, TOut]): bool =
   ## returns true if the actor `a` is running.
   result = running(a.t)
 
diff --git a/lib/pure/nimprof.nim b/lib/pure/nimprof.nim
index 7a907d2ca..725a9d0f6 100644
--- a/lib/pure/nimprof.nim
+++ b/lib/pure/nimprof.nim
@@ -169,12 +169,14 @@ var
   disabled: int
 
 proc disableProfiling*() =
-  atomicDec disabled
-  system.profilerHook = nil
+  when defined(system.TStackTrace):
+    atomicDec disabled
+    system.profilerHook = nil
 
 proc enableProfiling*() =
-  if atomicInc(disabled) >= 0:
-    system.profilerHook = hook
+  when defined(system.TStackTrace):
+    if atomicInc(disabled) >= 0:
+      system.profilerHook = hook
 
 when defined(system.TStackTrace):
   system.profilerHook = hook
diff --git a/lib/system/ansi_c.nim b/lib/system/ansi_c.nim
index 7c2c234c2..486f5dd26 100755
--- a/lib/system/ansi_c.nim
+++ b/lib/system/ansi_c.nim
@@ -66,6 +66,8 @@ proc c_ungetc(c: int, f: C_TextFileStar) {.importc: "ungetc", nodecl.}
 proc c_putc(c: Char, stream: C_TextFileStar) {.importc: "putc", nodecl.}
 proc c_fprintf(f: C_TextFileStar, frmt: CString) {.
   importc: "fprintf", nodecl, varargs.}
+proc c_printf(frmt: CString) {.
+  importc: "printf", nodecl, varargs.}
 
 proc c_fopen(filename, mode: cstring): C_TextFileStar {.
   importc: "fopen", nodecl.}