fixes #5549
This commit is contained in:
parent
e844e536bf
commit
432a4d1787
2 changed files with 26 additions and 15 deletions
|
|
@ -444,20 +444,21 @@ proc assignGlobalVar(p: BProc, n: PNode) =
|
||||||
return
|
return
|
||||||
useHeader(p.module, s)
|
useHeader(p.module, s)
|
||||||
if lfNoDecl in s.loc.flags: return
|
if lfNoDecl in s.loc.flags: return
|
||||||
if sfThread in s.flags:
|
if not containsOrIncl(p.module.declaredThings, s.id):
|
||||||
declareThreadVar(p.module, s, sfImportc in s.flags)
|
if sfThread in s.flags:
|
||||||
else:
|
declareThreadVar(p.module, s, sfImportc in s.flags)
|
||||||
var decl: Rope = nil
|
|
||||||
var td = getTypeDesc(p.module, s.loc.t)
|
|
||||||
if s.constraint.isNil:
|
|
||||||
if sfImportc in s.flags: add(decl, "extern ")
|
|
||||||
add(decl, td)
|
|
||||||
if sfRegister in s.flags: add(decl, " register")
|
|
||||||
if sfVolatile in s.flags: add(decl, " volatile")
|
|
||||||
addf(decl, " $1;$n", [s.loc.r])
|
|
||||||
else:
|
else:
|
||||||
decl = (s.cgDeclFrmt & ";$n") % [td, s.loc.r]
|
var decl: Rope = nil
|
||||||
add(p.module.s[cfsVars], decl)
|
var td = getTypeDesc(p.module, s.loc.t)
|
||||||
|
if s.constraint.isNil:
|
||||||
|
if sfImportc in s.flags: add(decl, "extern ")
|
||||||
|
add(decl, td)
|
||||||
|
if sfRegister in s.flags: add(decl, " register")
|
||||||
|
if sfVolatile in s.flags: add(decl, " volatile")
|
||||||
|
addf(decl, " $1;$n", [s.loc.r])
|
||||||
|
else:
|
||||||
|
decl = (s.cgDeclFrmt & ";$n") % [td, s.loc.r]
|
||||||
|
add(p.module.s[cfsVars], decl)
|
||||||
if p.withinLoop > 0:
|
if p.withinLoop > 0:
|
||||||
# fixes tests/run/tzeroarray:
|
# fixes tests/run/tzeroarray:
|
||||||
resetLoc(p, s.loc)
|
resetLoc(p, s.loc)
|
||||||
|
|
@ -1036,7 +1037,7 @@ proc genVarPrototype(m: BModule, n: PNode) =
|
||||||
let sym = n.sym
|
let sym = n.sym
|
||||||
useHeader(m, sym)
|
useHeader(m, sym)
|
||||||
fillLoc(sym.loc, locGlobalVar, n, mangleName(m, sym), OnHeap)
|
fillLoc(sym.loc, locGlobalVar, n, mangleName(m, sym), OnHeap)
|
||||||
if (lfNoDecl in sym.loc.flags) or containsOrIncl(m.declaredThings, sym.id):
|
if (lfNoDecl in sym.loc.flags) or contains(m.declaredThings, sym.id):
|
||||||
return
|
return
|
||||||
if sym.owner.id != m.module.id:
|
if sym.owner.id != m.module.id:
|
||||||
# else we already have the symbol generated!
|
# else we already have the symbol generated!
|
||||||
|
|
@ -1055,7 +1056,7 @@ proc addIntTypes(result: var Rope; conf: ConfigRef) {.inline.} =
|
||||||
addf(result, "#define NIM_NEW_MANGLING_RULES\L" &
|
addf(result, "#define NIM_NEW_MANGLING_RULES\L" &
|
||||||
"#define NIM_INTBITS $1\L", [
|
"#define NIM_INTBITS $1\L", [
|
||||||
platform.CPU[conf.target.targetCPU].intSize.rope])
|
platform.CPU[conf.target.targetCPU].intSize.rope])
|
||||||
if conf.cppCustomNamespace.len > 0:
|
if conf.cppCustomNamespace.len > 0:
|
||||||
result.add("#define USE_NIM_NAMESPACE ")
|
result.add("#define USE_NIM_NAMESPACE ")
|
||||||
result.add(conf.cppCustomNamespace)
|
result.add(conf.cppCustomNamespace)
|
||||||
result.add("\L")
|
result.add("\L")
|
||||||
|
|
|
||||||
|
|
@ -35,3 +35,13 @@ try:
|
||||||
except:
|
except:
|
||||||
echo "caught"
|
echo "caught"
|
||||||
|
|
||||||
|
|
||||||
|
# issue 5549
|
||||||
|
|
||||||
|
var strs: seq[string] = @[]
|
||||||
|
|
||||||
|
try:
|
||||||
|
discard
|
||||||
|
finally:
|
||||||
|
for foobar in strs:
|
||||||
|
discard
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue