fixes --gc:none regression; made some tests green
This commit is contained in:
parent
1efb5174f2
commit
ee57bb3e3e
7 changed files with 49 additions and 41 deletions
|
|
@ -461,6 +461,9 @@ proc rawNewObj(typ: PNimType, size: int, gch: var TGcHeap): pointer =
|
|||
|
||||
{.pop.}
|
||||
|
||||
proc newObjNoInit(typ: PNimType, size: int): pointer {.compilerRtl.} =
|
||||
result = rawNewObj(typ, size, gch)
|
||||
|
||||
proc newObj(typ: PNimType, size: int): pointer {.compilerRtl.} =
|
||||
result = rawNewObj(typ, size, gch)
|
||||
zeroMem(result, size)
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
#
|
||||
# Nim's Runtime Library
|
||||
# (c) Copyright 2013 Andreas Rumpf
|
||||
# (c) Copyright 2015 Andreas Rumpf
|
||||
#
|
||||
# See the file "copying.txt", included in this
|
||||
# distribution, for details about the copyright.
|
||||
|
|
@ -240,6 +240,8 @@ elif defined(nogc) and defined(useMalloc):
|
|||
result = newObj(typ, addInt(mulInt(len, typ.base.size), GenericSeqSize))
|
||||
cast[PGenericSeq](result).len = len
|
||||
cast[PGenericSeq](result).reserved = len
|
||||
proc newObjNoInit(typ: PNimType, size: int): pointer =
|
||||
result = alloc(size)
|
||||
|
||||
proc growObj(old: pointer, newsize: int): pointer =
|
||||
result = realloc(old, newsize)
|
||||
|
|
@ -289,6 +291,10 @@ elif defined(nogc):
|
|||
|
||||
proc newObj(typ: PNimType, size: int): pointer {.compilerproc.} =
|
||||
result = alloc0(size)
|
||||
|
||||
proc newObjNoInit(typ: PNimType, size: int): pointer =
|
||||
result = alloc(size)
|
||||
|
||||
proc newSeq(typ: PNimType, len: int): pointer {.compilerproc.} =
|
||||
result = newObj(typ, addInt(mulInt(len, typ.base.size), GenericSeqSize))
|
||||
cast[PGenericSeq](result).len = len
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ else:
|
|||
cast[NimString](newObj(addr(strDesc), size))
|
||||
|
||||
template allocStrNoInit(size: expr): expr =
|
||||
cast[NimString](rawNewObj(addr(strDesc), size, gch))
|
||||
cast[NimString](newObjNoInit(addr(strDesc), size))
|
||||
|
||||
proc rawNewStringNoInit(space: int): NimString {.compilerProc.} =
|
||||
var s = space
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
discard """
|
||||
nimout: "'a' is deprecated [Deprecated]"
|
||||
nimout: "a is deprecated [Deprecated]"
|
||||
"""
|
||||
|
||||
var
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
discard """
|
||||
line: 7
|
||||
errormsg: "expression 'items' cannot be called"
|
||||
errormsg: "undeclared identifier: 'items'"
|
||||
"""
|
||||
|
||||
type a = enum b,c,d
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
discard """
|
||||
file: "tissue710.nim"
|
||||
line: 8
|
||||
errorMsg: "expression '||' cannot be called"
|
||||
errorMsg: "undeclared identifier: '||'"
|
||||
"""
|
||||
var sum = 0
|
||||
for x in 3..1000:
|
||||
|
|
|
|||
|
|
@ -1,12 +1,11 @@
|
|||
discard """
|
||||
file: "tnoop.nim"
|
||||
line: 11
|
||||
errormsg: "expression \'a()\' cannot be called"
|
||||
errormsg: "undeclared identifier: 'a'"
|
||||
"""
|
||||
# Tests the new check in the semantic pass
|
||||
|
||||
|
||||
var
|
||||
a: int
|
||||
|
||||
a() #ERROR_MSG expression 'a()' cannot be called
|
||||
|
||||
a()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue