C codegen: generate nimKeepAlive calls at strategic places to keep the C compiler from optimizing away all stack roots

This commit is contained in:
Araq 2011-11-24 23:28:28 +01:00
commit 703430787d
6 changed files with 256 additions and 174 deletions

View file

@ -564,18 +564,18 @@ var
lastError = UnknownLineInfo()
proc liMessage(info: TLineInfo, msg: TMsgKind, arg: string,
eh: TErrorHandling) =
eh: TErrorHandling) =
var frmt: string
var ignoreMsg = false
case msg
of errMin..errMax:
of errMin..errMax:
writeContext(info)
frmt = posErrorFormat
# we try to filter error messages so that not two error message
# in the same file and line are produced:
ignoreMsg = lastError == info and eh != doAbort
lastError = info
of warnMin..warnMax:
of warnMin..warnMax:
ignoreMsg = optWarns notin gOptions or msg notin gNotes
if not ignoreMsg: writeContext(info)
frmt = posWarningFormat