summary refs log tree commit diff stats
path: root/compiler/sempass2.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2014-04-20 20:01:24 +0200
committerAraq <rumpf_a@web.de>2014-04-20 20:01:24 +0200
commite6d17e62731a05110e464854eda79e891aaf2ff5 (patch)
treea689b6063eedb4e586fe205f7dfc59456c6df2e4 /compiler/sempass2.nim
parentbe6474af638b72aabeb70cfc5f477cc5fb7af0ce (diff)
downloadNim-e6d17e62731a05110e464854eda79e891aaf2ff5.tar.gz
made large parts of the stdlib gcsafe
Diffstat (limited to 'compiler/sempass2.nim')
-rw-r--r--compiler/sempass2.nim7
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim
index 295321f4b..f8685a5c8 100644
--- a/compiler/sempass2.nim
+++ b/compiler/sempass2.nim
@@ -113,7 +113,8 @@ proc useVar(a: PEffects, n: PNode) =
   if {sfGlobal, sfThread} * s.flags == {sfGlobal} and s.kind == skVar:
     when trackGlobals:
       a.addUse(copyNode(n))
-    if tfHasGCedMem in s.typ.flags or s.typ.isGCedMem:
+    if (tfHasGCedMem in s.typ.flags or s.typ.isGCedMem) and 
+        tfGcSafe notin s.typ.flags:
       message(n.info, warnGcUnsafe, renderTree(n))
       a.gcUnsafe = true
 
@@ -517,6 +518,7 @@ proc track(tracked: PEffects, n: PNode) =
           addEffect(tracked, createRaise(n))
           addTag(tracked, createTag(n))
           when trackGlobals: addUse(tracked, createAnyGlobal(n))
+          # XXX handle 'gcsafe' properly for callbacks!
       else:
         mergeEffects(tracked, effectList.sons[exceptionEffects], n)
         mergeTags(tracked, effectList.sons[tagEffects], n)
@@ -704,7 +706,8 @@ proc trackProc*(s: PSym, body: PNode) =
         "uses an unlisted global variable: ", hints=on, symbolPredicate)
       effects.sons[usesEffects] = usesSpec
   if sfThread in s.flags and t.gcUnsafe:
-    localError(s.info, "'$1' is not GC-safe" % s.name.s)
+    localError(s.info, warnGcUnsafe2, s.name.s)
+    #localError(s.info, "'$1' is not GC-safe" % s.name.s)
   if not t.gcUnsafe: s.typ.flags.incl tfGcSafe
   
 proc trackTopLevelStmt*(module: PSym; n: PNode) =