diff options
author | Araq <rumpf_a@web.de> | 2011-07-10 15:48:13 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-07-10 15:48:13 +0200 |
commit | 5b96eaa9533e877b5b7f2c6bf1e291ccdfdfecef (patch) | |
tree | f58b139b00b6af984f716164c7a3d72761df514d /compiler | |
parent | 2565ff8ddec9fcf43fbda2fae6f04806c1bc6e8a (diff) | |
download | Nim-5b96eaa9533e877b5b7f2c6bf1e291ccdfdfecef.tar.gz |
preparations for 0.8.12
Diffstat (limited to 'compiler')
-rwxr-xr-x[-rw-r--r--] | compiler/ccgthreadvars.nim | 0 | ||||
-rwxr-xr-x | compiler/lookups.nim | 8 | ||||
-rwxr-xr-x | compiler/msgs.nim | 2 | ||||
-rwxr-xr-x | compiler/nversion.nim | 4 | ||||
-rwxr-xr-x | compiler/seminst.nim | 2 | ||||
-rwxr-xr-x | compiler/semstmts.nim | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | compiler/semthreads.nim | 36 |
7 files changed, 38 insertions, 16 deletions
diff --git a/compiler/ccgthreadvars.nim b/compiler/ccgthreadvars.nim index 7ef084ba8..7ef084ba8 100644..100755 --- a/compiler/ccgthreadvars.nim +++ b/compiler/ccgthreadvars.nim diff --git a/compiler/lookups.nim b/compiler/lookups.nim index d72ec1555..a2cb434a0 100755 --- a/compiler/lookups.nim +++ b/compiler/lookups.nim @@ -52,12 +52,12 @@ proc CloseScope*(tab: var TSymTab) = if (tab.tos > len(tab.stack)): InternalError("CloseScope") var it: TTabIter var s = InitTabIter(it, tab.stack[tab.tos-1]) - while s != nil: + while s != nil: if sfForward in s.flags: LocalError(s.info, errImplOfXexpected, getSymRepr(s)) - elif ({sfUsed, sfInInterface} * s.flags == {}) and - (optHints in s.options): # BUGFIX: check options in s! - if not (s.kind in {skForVar, skParam, skMethod, skUnknown}): + elif {sfUsed, sfInInterface} * s.flags == {} and optHints in s.options: + # BUGFIX: check options in s! + if s.kind notin {skForVar, skParam, skMethod, skUnknown, skGenericParam}: Message(s.info, hintXDeclaredButNotUsed, getSymRepr(s)) s = NextIter(it, tab.stack[tab.tos-1]) astalgo.rawCloseScope(tab) diff --git a/compiler/msgs.nim b/compiler/msgs.nim index f6ec4729a..b2ead1d9e 100755 --- a/compiler/msgs.nim +++ b/compiler/msgs.nim @@ -522,6 +522,7 @@ proc rawMessage*(msg: TMsgKind, args: openarray[string]) = of warnMin..warnMax: if not (optWarns in gOptions): return if not (msg in gNotes): return + writeContext(unknownLineInfo()) frmt = rawWarningFormat inc(gWarnCounter) of hintMin..hintMax: @@ -552,6 +553,7 @@ proc liMessage(info: TLineInfo, msg: TMsgKind, arg: string, lastError = info of warnMin..warnMax: ignoreMsg = optWarns notin gOptions or msg notin gNotes + if not ignoreMsg: writeContext(info) frmt = posWarningFormat inc(gWarnCounter) of hintMin..hintMax: diff --git a/compiler/nversion.nim b/compiler/nversion.nim index 8fb436f11..45b804d40 100755 --- a/compiler/nversion.nim +++ b/compiler/nversion.nim @@ -1,7 +1,7 @@ # # # The Nimrod Compiler -# (c) Copyright 2010 Andreas Rumpf +# (c) Copyright 2011 Andreas Rumpf # # See the file "copying.txt", included in this # distribution, for details about the copyright. @@ -15,6 +15,6 @@ const defaultAsmMarkerSymbol* = '!' VersionMajor* = 0 VersionMinor* = 8 - VersionPatch* = 11 + VersionPatch* = 12 VersionAsString* = $VersionMajor & "." & $VersionMinor & "." & $VersionPatch diff --git a/compiler/seminst.nim b/compiler/seminst.nim index c398f1ca2..2db8289f2 100755 --- a/compiler/seminst.nim +++ b/compiler/seminst.nim @@ -19,6 +19,8 @@ proc instantiateGenericParamList(c: PContext, n: PNode, pt: TIdTable) = var q = a.sym if not (q.typ.kind in {tyTypeDesc, tyGenericParam}): continue var s = newSym(skType, q.name, getCurrOwner()) + s.info = q.info + incl(s.flags, sfUsed) var t = PType(IdTableGet(pt, q.typ)) if t == nil: LocalError(a.info, errCannotInstantiateX, s.name.s) diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 4a80bb783..61709ad48 100755 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -205,7 +205,7 @@ proc semIdentDef(c: PContext, n: PNode, kind: TSymKind): PSym = incl(result.flags, sfGlobal) else: result = semIdentWithPragma(c, kind, n, {}) - + proc semVar(c: PContext, n: PNode): PNode = var b: PNode result = copyNode(n) diff --git a/compiler/semthreads.nim b/compiler/semthreads.nim index bff8823b2..b6bdc9e60 100644..100755 --- a/compiler/semthreads.nim +++ b/compiler/semthreads.nim @@ -112,7 +112,7 @@ proc analyseSym(c: PProcCtx, n: PNode): TThreadOwner = if sfGlobal in v.flags: if sfThreadVar in v.flags: result = toMine - elif containsTyRef(v.typ): + elif containsGarbageCollectedRef(v.typ): result = toTheirs of skTemp, skForVar: result = toNil of skConst: result = toMine @@ -126,7 +126,8 @@ proc analyseSym(c: PProcCtx, n: PNode): TThreadOwner = proc lvalueSym(n: PNode): PNode = result = n - while result.kind in {nkDotExpr, nkBracketExpr, nkDerefExpr, nkHiddenDeref}: + while result.kind in {nkDotExpr, nkCheckedFieldExpr, + nkBracketExpr, nkDerefExpr, nkHiddenDeref}: result = result.sons[0] proc writeAccess(c: PProcCtx, n: PNode, owner: TThreadOwner) = @@ -138,7 +139,18 @@ proc writeAccess(c: PProcCtx, n: PNode, owner: TThreadOwner) = var lastOwner = analyseSym(c, a) case lastOwner of toNil: - c.mapping[v.id] = owner # fine, toNil can be overwritten + # fine, toNil can be overwritten + var newOwner: TThreadOwner + if sfGlobal in v.flags: + newOwner = owner + elif containsTyRef(v.typ): + # ``var local = gNode`` --> ok, but ``local`` is theirs! + newOwner = owner + else: + # ``var local = gString`` --> string copy: ``local`` is mine! + newOwner = toMine + # XXX BUG what if the tuple contains both ``tyRef`` and ``tyString``? + c.mapping[v.id] = newOwner of toVoid, toUndefined: InternalError(n.info, "writeAccess") of toTheirs: Message(n.info, warnWriteToForeignHeap) of toMine: @@ -146,7 +158,7 @@ proc writeAccess(c: PProcCtx, n: PNode, owner: TThreadOwner) = Message(n.info, warnDifferentHeaps) else: # we could not backtrack to a concrete symbol, but that's fine: - var lastOwner = analyseSym(c, n) + var lastOwner = analyse(c, n) case lastOwner of toNil: nil # fine, toNil can be overwritten of toVoid, toUndefined: InternalError(n.info, "writeAccess") @@ -178,7 +190,7 @@ proc analyseCall(c: PProcCtx, n: PNode): TThreadOwner = pushInfoContext(n.info) result = analyse(newCtx, prc.ast.sons[codePos]) if prc.ast.sons[codePos].kind == nkEmpty and - {sfNoSideEffect, sfThread} * prc.flags == {}: + {sfNoSideEffect, sfThread, sfImportc} * prc.flags == {}: Message(n.info, warnAnalysisLoophole, renderTree(n)) if prc.typ.sons[0] != nil: if prc.ast.len > resultPos: @@ -228,7 +240,7 @@ template aggregateOwner(result, ana: expr) = var a = ana # eval once if result != a: if result == toNil: result = a - else: Message(n.info, warnDifferentHeaps) + elif a != toNil: Message(n.info, warnDifferentHeaps) proc analyseArgs(c: PProcCtx, n: PNode, start = 1) = for i in start..n.len-1: discard analyse(c, n[i]) @@ -241,7 +253,14 @@ proc analyseOp(c: PProcCtx, n: PNode): TThreadOwner = else: var prc = n[0].sym case prc.magic - of mNone: result = analyseCall(c, n) + of mNone: + if sfSystemModule in prc.owner.flags: + # System module proc does no harm :-) + analyseArgs(c, n) + if prc.typ.sons[0] == nil: result = toVoid + else: result = toNil + else: + result = analyseCall(c, n) of mNew, mNewFinalize, mNewSeq, mSetLengthStr, mSetLengthSeq, mAppendSeqElem, mReset, mAppendStrCh, mAppendStrStr: writeAccess(c, n[1], toMine) @@ -260,8 +279,7 @@ proc analyseOp(c: PProcCtx, n: PNode): TThreadOwner = analyseArgs(c, n) result = toMine else: - # don't recurse, but check args; NOTE: This is essential that - # ``mCreateThread`` is handled here to avoid the recursion + # don't recurse, but check args: analyseArgs(c, n) if prc.typ.sons[0] == nil: result = toVoid else: result = toNil |