mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 06:18:51 +00:00
fix #15617(fix compilation failure on -d:useMalloc --gc:none) (#17555)
Co-authored-by: Andreas Rumpf <rumpf_a@web.de> Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
This commit is contained in:
@@ -57,6 +57,16 @@ elif defined(gogc):
|
||||
elif (defined(nogc) or defined(gcDestructors)) and defined(useMalloc):
|
||||
include system / mm / malloc
|
||||
|
||||
when defined(nogc):
|
||||
proc GC_getStatistics(): string = ""
|
||||
proc newObj(typ: PNimType, size: int): pointer {.compilerproc.} =
|
||||
result = alloc0(size)
|
||||
|
||||
proc newSeq(typ: PNimType, len: int): pointer {.compilerproc.} =
|
||||
result = newObj(typ, align(GenericSeqSize, typ.align) + len * typ.base.size)
|
||||
cast[PGenericSeq](result).len = len
|
||||
cast[PGenericSeq](result).reserved = len
|
||||
|
||||
elif defined(nogc):
|
||||
include system / mm / none
|
||||
|
||||
|
||||
6
tests/system/tgcnone.nim
Normal file
6
tests/system/tgcnone.nim
Normal file
@@ -0,0 +1,6 @@
|
||||
discard """
|
||||
matrix: "--gc:none -d:useMalloc"
|
||||
"""
|
||||
# bug #15617
|
||||
let x = 4
|
||||
doAssert x == 4
|
||||
Reference in New Issue
Block a user