diff options
author | Araq <rumpf_a@web.de> | 2013-06-06 23:15:05 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2013-06-06 23:15:05 +0200 |
commit | 9604df84316af83fe80a77ad1aeb2eacdd0466cb (patch) | |
tree | 95ec5263ebecd6fe948fcb7d090fc0b6fd4299e0 | |
parent | 2aaa8f7909e51eb3d971e197f152e247c64362e9 (diff) | |
download | Nim-9604df84316af83fe80a77ad1aeb2eacdd0466cb.tar.gz |
fixes #466
-rw-r--r-- | compiler/ccgtypes.nim | 18 | ||||
-rw-r--r-- | compiler/cgen.nim | 2 | ||||
-rw-r--r-- | config/nimrod.cfg | 4 | ||||
-rw-r--r-- | lib/nimbase.h | 4 | ||||
-rw-r--r-- | todo.txt | 1 |
5 files changed, 14 insertions, 15 deletions
diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim index 427b0ec86..88e7e264d 100644 --- a/compiler/ccgtypes.nim +++ b/compiler/ccgtypes.nim @@ -674,7 +674,7 @@ proc genProcHeader(m: BModule, prc: PSym): PRope = # ------------------ type info generation ------------------------------------- -proc genTypeInfo(m: BModule, typ: PType): PRope +proc genTypeInfo(m: BModule, t: PType): PRope proc getNimNode(m: BModule): PRope = result = ropef("$1[$2]", [m.typeNodesName, toRope(m.typeNodes)]) inc(m.typeNodes) @@ -692,7 +692,7 @@ proc isObjLackingTypeField(typ: PType): bool {.inline.} = result = (typ.kind == tyObject) and ((tfFinal in typ.flags) and (typ.sons[0] == nil) or isPureObject(typ)) -proc genTypeInfoAuxBase(m: BModule, typ: PType, name, base: PRope) = +proc genTypeInfoAuxBase(m: BModule, typ: PType, name, base: PRope) = var nimtypeKind: int #allocMemTI(m, typ, name) if isObjLackingTypeField(typ): @@ -901,21 +901,21 @@ type include ccgtrav -proc genTypeInfo(m: BModule, typ: PType): PRope = - var t = getUniqueType(typ) +proc genTypeInfo(m: BModule, t: PType): PRope = + var t = getUniqueType(t) result = ropef("NTI$1", [toRope(t.id)]) - let owner = typ.skipTypes(typedescPtrs).owner.getModule + if ContainsOrIncl(m.typeInfoMarker, t.id): + return con("(&".toRope, result, ")".toRope) + let owner = t.skipTypes(typedescPtrs).owner.getModule if owner != m.module: # make sure the type info is created in the owner module - discard genTypeInfo(owner.bmod, typ) - # refenrece the type info as extern here + discard genTypeInfo(owner.bmod, t) + # reference the type info as extern here discard cgsym(m, "TNimType") discard cgsym(m, "TNimNode") appf(m.s[cfsVars], "extern TNimType $1; /* $2 */$n", [result, toRope(typeToString(t))]) return con("(&".toRope, result, ")".toRope) - if ContainsOrIncl(m.typeInfoMarker, t.id): - return con("(&".toRope, result, ")".toRope) case t.kind of tyEmpty: result = toRope"0" of tyPointer, tyBool, tyChar, tyCString, tyString, tyInt..tyUInt64, tyVar: diff --git a/compiler/cgen.nim b/compiler/cgen.nim index 7e782fc12..45fb9f878 100644 --- a/compiler/cgen.nim +++ b/compiler/cgen.nim @@ -1031,7 +1031,7 @@ proc genInitCode(m: BModule) = var procname = CStringLit(m.initProc, prc, m.module.name.s) app(prc, initFrame(m.initProc, procname, m.module.info.quotedFilename)) else: - app(prc, ~"\tvolatile TFrame F; F.len = 0;$N") + app(prc, ~"\tTFrame F; F.len = 0;$N") app(prc, genSectionStart(cpsInit)) app(prc, m.preInitProc.s(cpsInit)) diff --git a/config/nimrod.cfg b/config/nimrod.cfg index d9075a20f..18c746213 100644 --- a/config/nimrod.cfg +++ b/config/nimrod.cfg @@ -93,10 +93,10 @@ hint[LineTooLong]=off cc = clang tlsEmulation:on gcc.options.always = "-w -fasm-blocks" - gpp.options.always = "-w -fasm-blocks" + gpp.options.always = "-w -fasm-blocks -fpermissive" @else: gcc.options.always = "-w" - gpp.options.always = "-w" + gpp.options.always = "-w -fpermissive" @end gcc.options.speed = "-O3 -fno-strict-aliasing" diff --git a/lib/nimbase.h b/lib/nimbase.h index f47ab4d29..af06e447d 100644 --- a/lib/nimbase.h +++ b/lib/nimbase.h @@ -437,11 +437,11 @@ struct TFrame { }; #define nimfr(proc, file) \ - volatile TFrame F; \ + TFrame F; \ F.procname = proc; F.filename = file; F.line = 0; F.len = 0; nimFrame(&F); #define nimfrs(proc, file, slots, length) \ - volatile struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; TVarSlot s[slots];} F; \ + struct {TFrame* prev;NCSTRING procname;NI line;NCSTRING filename; NI len; TVarSlot s[slots];} F; \ F.procname = proc; F.filename = file; F.line = 0; F.len = length; nimFrame((TFrame*)&F); #define nimln(n, file) \ diff --git a/todo.txt b/todo.txt index 2aea8660f..ad0a4afa2 100644 --- a/todo.txt +++ b/todo.txt @@ -24,7 +24,6 @@ Bugs - blocks can "export" an identifier but the CCG generates {} for them ... - osproc execProcesses can deadlock if all processes fail (as experienced in c++ mode) -- bootstrapping does not work in C++ mode - result = result shr 8 for the "system()" wrapper |