parent
21b03257ef
commit
1268ca79e5
6 changed files with 26 additions and 9 deletions
|
|
@ -13,10 +13,6 @@
|
|||
##
|
||||
## Tested on these OSes: Linux, Windows, OSX
|
||||
|
||||
type
|
||||
NilAccessError* = object of SystemError ## \
|
||||
## Raised on dereferences of ``nil`` pointers.
|
||||
|
||||
# do allocate memory upfront:
|
||||
var se: ref NilAccessError
|
||||
new(se)
|
||||
|
|
|
|||
|
|
@ -558,6 +558,10 @@ type
|
|||
## Raised if it is attempted to send a message to a dead thread.
|
||||
##
|
||||
## See the full `exception hierarchy <manual.html#exception-handling-exception-hierarchy>`_.
|
||||
NilAccessError* = object of SystemError ## \
|
||||
## Raised on dereferences of ``nil`` pointers.
|
||||
##
|
||||
## This is only raised if the ``segfaults.nim`` module was imported!
|
||||
|
||||
{.deprecated: [TObject: RootObj, PObject: RootRef, TEffect: RootEffect,
|
||||
FTime: TimeEffect, FIO: IOEffect, FReadIO: ReadIOEffect,
|
||||
|
|
@ -2467,8 +2471,8 @@ template accumulateResult*(iter: untyped) =
|
|||
const NimStackTrace = compileOption("stacktrace")
|
||||
|
||||
template coroutinesSupportedPlatform(): bool =
|
||||
when defined(sparc) or defined(ELATE) or compileOption("gc", "v2") or
|
||||
defined(boehmgc) or defined(gogc) or defined(nogc) or defined(gcStack) or
|
||||
when defined(sparc) or defined(ELATE) or compileOption("gc", "v2") or
|
||||
defined(boehmgc) or defined(gogc) or defined(nogc) or defined(gcStack) or
|
||||
defined(gcMarkAndSweep):
|
||||
false
|
||||
else:
|
||||
|
|
|
|||
|
|
@ -50,7 +50,11 @@ proc chckRangeF(x, a, b: float): float =
|
|||
|
||||
proc chckNil(p: pointer) =
|
||||
if p == nil:
|
||||
sysFatal(ValueError, "attempt to write to a nil address")
|
||||
sysFatal(NilAccessError, "attempt to write to a nil address")
|
||||
|
||||
proc chckNilDisp(p: pointer) {.compilerproc.} =
|
||||
if p == nil:
|
||||
sysFatal(NilAccessError, "cannot dispatch; dispatcher is nil")
|
||||
|
||||
proc chckObj(obj, subclass: PNimType) {.compilerproc.} =
|
||||
# checks if obj is of type subclass:
|
||||
|
|
|
|||
|
|
@ -642,6 +642,10 @@ proc toU32*(a: int64): int32 {.asmNoStackFrame, compilerproc.} =
|
|||
proc nimMin(a, b: int): int {.compilerproc.} = return if a <= b: a else: b
|
||||
proc nimMax(a, b: int): int {.compilerproc.} = return if a >= b: a else: b
|
||||
|
||||
proc chckNilDisp(p: pointer) {.compilerproc.} =
|
||||
if p == nil:
|
||||
sysFatal(NilAccessError, "cannot dispatch; dispatcher is nil")
|
||||
|
||||
type NimString = string # hack for hti.nim
|
||||
include "system/hti"
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue