This commit is contained in:
Araq 2016-10-22 13:41:46 +02:00
commit cdd69e951f

View file

@ -204,17 +204,22 @@ proc listGcUnsafety(s: PSym; onlyWarning: bool; cycleCheck: var IntSet) =
let u = s.gcUnsafetyReason let u = s.gcUnsafetyReason
if u != nil and not cycleCheck.containsOrIncl(u.id): if u != nil and not cycleCheck.containsOrIncl(u.id):
let msgKind = if onlyWarning: warnGcUnsafe2 else: errGenerated let msgKind = if onlyWarning: warnGcUnsafe2 else: errGenerated
if u.kind in {skLet, skVar}: case u.kind
of skLet, skVar:
message(s.info, msgKind, message(s.info, msgKind,
("'$#' is not GC-safe as it accesses '$#'" & ("'$#' is not GC-safe as it accesses '$#'" &
" which is a global using GC'ed memory") % [s.name.s, u.name.s]) " which is a global using GC'ed memory") % [s.name.s, u.name.s])
elif u.kind in routineKinds: of routineKinds:
# recursive call *always* produces only a warning so the full error # recursive call *always* produces only a warning so the full error
# message is printed: # message is printed:
listGcUnsafety(u, true, cycleCheck) listGcUnsafety(u, true, cycleCheck)
message(s.info, msgKind, message(s.info, msgKind,
"'$#' is not GC-safe as it calls '$#'" % "'$#' is not GC-safe as it calls '$#'" %
[s.name.s, u.name.s]) [s.name.s, u.name.s])
of skParam:
message(s.info, msgKind,
"'$#' is not GC-safe as it performs an indirect call via '$#'" %
[s.name.s, u.name.s])
else: else:
internalAssert u.kind == skUnknown internalAssert u.kind == skUnknown
message(u.info, msgKind, message(u.info, msgKind,