diff options
author | Araq <rumpf_a@web.de> | 2019-03-01 14:50:41 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2019-03-01 14:50:51 +0100 |
commit | e1d17ece5b79cd142248162c964604cd0ba5ca3f (patch) | |
tree | d716ca9df4ef0fa18613ea346a986404e879b7b3 /lib/core | |
parent | ca7980f301104d2ac5cbf30b36f79f7b4a350f48 (diff) | |
download | Nim-e1d17ece5b79cd142248162c964604cd0ba5ca3f.tar.gz |
alloc et al don't have any effect; fixes #9746
Diffstat (limited to 'lib/core')
-rw-r--r-- | lib/core/allocators.nim | 14 | ||||
-rw-r--r-- | lib/core/seqs.nim | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/core/allocators.nim b/lib/core/allocators.nim index b8d575422..001caac05 100644 --- a/lib/core/allocators.nim +++ b/lib/core/allocators.nim @@ -13,10 +13,10 @@ type ZerosMem ## the allocator always zeros the memory on an allocation Allocator* = ptr AllocatorObj AllocatorObj* {.inheritable.} = object - alloc*: proc (a: Allocator; size: int; alignment: int = 8): pointer {.nimcall.} - dealloc*: proc (a: Allocator; p: pointer; size: int) {.nimcall.} - realloc*: proc (a: Allocator; p: pointer; oldSize, newSize: int): pointer {.nimcall.} - deallocAll*: proc (a: Allocator) {.nimcall.} + alloc*: proc (a: Allocator; size: int; alignment: int = 8): pointer {.nimcall, raises: [], tags: [].} + dealloc*: proc (a: Allocator; p: pointer; size: int) {.nimcall, raises: [], tags: [].} + realloc*: proc (a: Allocator; p: pointer; oldSize, newSize: int): pointer {.nimcall, raises: [], tags: [].} + deallocAll*: proc (a: Allocator) {.nimcall, raises: [], tags: [].} flags*: set[AllocatorFlag] name*: cstring allocCount: int @@ -31,13 +31,13 @@ proc getLocalAllocator*(): Allocator = result = localAllocator if result == nil: result = addr allocatorStorage - result.alloc = proc (a: Allocator; size: int; alignment: int = 8): pointer {.nimcall.} = + result.alloc = proc (a: Allocator; size: int; alignment: int = 8): pointer {.nimcall, raises: [].} = result = system.alloc(size) inc a.allocCount - result.dealloc = proc (a: Allocator; p: pointer; size: int) {.nimcall.} = + result.dealloc = proc (a: Allocator; p: pointer; size: int) {.nimcall, raises: [].} = system.dealloc(p) inc a.deallocCount - result.realloc = proc (a: Allocator; p: pointer; oldSize, newSize: int): pointer {.nimcall.} = + result.realloc = proc (a: Allocator; p: pointer; oldSize, newSize: int): pointer {.nimcall, raises: [].} = result = system.realloc(p, newSize) result.deallocAll = nil result.flags = {ThreadLocal} diff --git a/lib/core/seqs.nim b/lib/core/seqs.nim index 2b39c6b41..be2cdcf1a 100644 --- a/lib/core/seqs.nim +++ b/lib/core/seqs.nim @@ -80,7 +80,7 @@ type cap: int region: Allocator -proc newSeqPayload(cap, elemSize: int): pointer {.compilerRtl.} = +proc newSeqPayload(cap, elemSize: int): pointer {.compilerRtl, raises: [].} = # we have to use type erasure here as Nim does not support generic # compilerProcs. Oh well, this will all be inlined anyway. if cap > 0: @@ -93,7 +93,7 @@ proc newSeqPayload(cap, elemSize: int): pointer {.compilerRtl.} = result = nil proc prepareSeqAdd(len: int; p: pointer; addlen, elemSize: int): pointer {. - compilerRtl, noSideEffect.} = + compilerRtl, noSideEffect, raises: [].} = {.noSideEffect.}: if len+addlen <= len: result = p |