Merge branch 'devel' into araq-big-refactoring

This commit is contained in:
Andreas Rumpf 2018-05-21 17:31:23 +02:00
commit cb6a4ffa86
16 changed files with 796 additions and 552 deletions

View file

@ -1116,8 +1116,8 @@ proc registerModuleToMain(g: BModuleList; m: PSym) =
var
init = m.getInitName
datInit = m.getDatInitName
addf(g.mainModProcs, "NIM_EXTERNC N_NOINLINE(void, $1)(void);$N", [init])
addf(g.mainModProcs, "NIM_EXTERNC N_NOINLINE(void, $1)(void);$N", [datInit])
addf(g.mainModProcs, "N_LIB_PRIVATE N_NIMCALL(void, $1)(void);$N", [init])
addf(g.mainModProcs, "N_LIB_PRIVATE N_NIMCALL(void, $1)(void);$N", [datInit])
if sfSystemModule notin m.flags:
addf(g.mainDatInit, "\t$1();$N", [datInit])
let initCall = "\t$1();$N" % [init]
@ -1128,7 +1128,7 @@ proc registerModuleToMain(g: BModuleList; m: PSym) =
proc genInitCode(m: BModule) =
var initname = getInitName(m.module)
var prc = "NIM_EXTERNC N_NOINLINE(void, $1)(void) {$N" % [initname]
var prc = "N_LIB_PRIVATE N_NIMCALL(void, $1)(void) {$N" % [initname]
if m.typeNodes > 0:
appcg(m, m.s[cfsTypeInit1], "static #TNimNode $1[$2];$n",
[m.typeNodesName, rope(m.typeNodes)])
@ -1170,7 +1170,7 @@ proc genInitCode(m: BModule) =
add(prc, deinitGCFrame(m.initProc))
addf(prc, "}$N$N", [])
prc.addf("NIM_EXTERNC N_NOINLINE(void, $1)(void) {$N",
prc.addf("N_LIB_PRIVATE N_NIMCALL(void, $1)(void) {$N",
[getDatInitName(m.module)])
for i in cfsTypeInit1..cfsDynLibInit:

View file

@ -189,7 +189,7 @@ proc putComment(g: var TSrcGen, s: string) =
put(g, tkComment, com)
com = "## "
inc(i)
if s[i] == '\x0A': inc(i)
if i < s.len and s[i] == '\x0A': inc(i)
optNL(g, ind)
of '\x0A':
put(g, tkComment, com)

View file

@ -441,7 +441,7 @@ proc setLenSeq(c: PCtx; node: PNode; newLen: int; info: TLineInfo) =
node.sons[i] = newNodeI(typeKind, info)
const
errIndexOutOfBounds = "index ouf of bounds"
errIndexOutOfBounds = "index out of bounds"
errNilAccess = "attempt to access a nil address"
errOverOrUnderflow = "over- or underflow"
errConstantDivisionByZero = "division by zero"