'lock levels' are deprecated, now a noop (#20539)

* 'lock levels' are deprecated, now a noop

* fixes tests
This commit is contained in:
ringabout 2022-10-11 15:17:09 +08:00 • committed by GitHub
commit 5602183234
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
57 changed files with 121 additions and 372 deletions

View file

@ -215,12 +215,12 @@ template `or`*(x, y: NimNode): NimNode =
y
proc add*(father, child: NimNode): NimNode {.magic: "NAdd", discardable,
noSideEffect, locks: 0.}
noSideEffect.}
## Adds the `child` to the `father` node. Returns the
## father node so that calls can be nested.
proc add*(father: NimNode, children: varargs[NimNode]): NimNode {.
magic: "NAddMultiple", discardable, noSideEffect, locks: 0.}
magic: "NAddMultiple", discardable, noSideEffect.}
## Adds each child of `children` to the `father` node.
## Returns the `father` node so that calls can be nested.

View file

@ -1025,7 +1025,7 @@ proc bindAddr*(socket: Socket, port = Port(0), address = "") {.
proc acceptAddr*(server: Socket, client: var owned(Socket), address: var string,
flags = {SocketFlag.SafeDisconn},
inheritable = defined(nimInheritHandles)) {.
tags: [ReadIOEffect], gcsafe, locks: 0.} =
tags: [ReadIOEffect], gcsafe.} =
## Blocks until a connection is being made from a client. When a connection
## is made sets `client` to the client socket and `address` to the address
## of the connecting client.

View file

@ -122,13 +122,13 @@ when defined(memProfiler):
var
gTicker {.threadvar.}: int
proc requestedHook(): bool {.nimcall, locks: 0.} =
proc requestedHook(): bool {.nimcall.} =
if gTicker == 0:
gTicker = SamplingInterval
result = true
dec gTicker
proc hook(st: StackTrace, size: int) {.nimcall, locks: 0.} =
proc hook(st: StackTrace, size: int) {.nimcall.} =
when defined(ignoreAllocationSize):
hookAux(st, 1)
else:
@ -140,7 +140,7 @@ else:
gTicker: int # we use an additional counter to
# avoid calling 'getTicks' too frequently
proc requestedHook(): bool {.nimcall, locks: 0.} =
proc requestedHook(): bool {.nimcall.} =
if interval == 0: result = true
elif gTicker == 0:
gTicker = 500
@ -149,7 +149,7 @@ else:
else:
dec gTicker
proc hook(st: StackTrace) {.nimcall, locks: 0.} =
proc hook(st: StackTrace) {.nimcall.} =
#echo "profiling! ", interval
if interval == 0:
hookAux(st, 1)

View file

@ -34,7 +34,7 @@ template sbind(x: int; value) =
quit "could not bind value"
when defined(memTracker):
proc logEntries(log: TrackLog) {.nimcall, locks: 0, tags: [], gcsafe.} =
proc logEntries(log: TrackLog) {.nimcall, tags: [], gcsafe.} =
if insertStmt.isNil:
if prepare_v2(dbHandle, insertQuery,
insertQuery.len, insertStmt, nil) != SQLITE_OK:

View file

@ -148,7 +148,7 @@ proc thinout*[T](x: ref T) {.inline.} =
## and thus would keep the graph from being freed are `nil`'ed.
## This is a form of cycle collection that works well with Nim's ARC
## and its associated cost model.
proc getDynamicTypeInfo[T](x: T): PNimTypeV2 {.magic: "GetTypeInfoV2", noSideEffect, locks: 0.}
proc getDynamicTypeInfo[T](x: T): PNimTypeV2 {.magic: "GetTypeInfoV2", noSideEffect.}
breakCycles(head(cast[pointer](x)), getDynamicTypeInfo(x[]))

View file

@ -45,7 +45,7 @@ else:
{.pragma: inl, inline.}
{.pragma: compilerRtl, compilerproc.}
{.pragma: benign, gcsafe, locks: 0.}
{.pragma: benign, gcsafe.}
when defined(nimHasSinkInference):
{.push sinkInference: on.}

View file

@ -1,13 +1,13 @@
when notJSnotNims:
proc zeroMem*(p: pointer, size: Natural) {.inline, noSideEffect,
tags: [], locks: 0, raises: [].}
tags: [], raises: [].}
## Overwrites the contents of the memory at `p` with the value 0.
##
## Exactly `size` bytes will be overwritten. Like any procedure
## dealing with raw memory this is **unsafe**.
proc copyMem*(dest, source: pointer, size: Natural) {.inline, benign,
tags: [], locks: 0, raises: [].}
tags: [], raises: [].}
## Copies the contents from the memory at `source` to the memory
## at `dest`.
## Exactly `size` bytes will be copied. The memory
@ -15,7 +15,7 @@ when notJSnotNims:
## memory this is **unsafe**.
proc moveMem*(dest, source: pointer, size: Natural) {.inline, benign,
tags: [], locks: 0, raises: [].}
tags: [], raises: [].}
## Copies the contents from the memory at `source` to the memory
## at `dest`.
##
@ -25,7 +25,7 @@ when notJSnotNims:
## dealing with raw memory this is still **unsafe**, though.
proc equalMem*(a, b: pointer, size: Natural): bool {.inline, noSideEffect,
tags: [], locks: 0, raises: [].}
tags: [], raises: [].}
## Compares the memory blocks `a` and `b`. `size` bytes will
## be compared.
##
@ -34,7 +34,7 @@ when notJSnotNims:
## **unsafe**.
proc cmpMem*(a, b: pointer, size: Natural): int {.inline, noSideEffect,
tags: [], locks: 0, raises: [].}
tags: [], raises: [].}
## Compares the memory blocks `a` and `b`. `size` bytes will
## be compared.
##

View file

@ -35,7 +35,7 @@ type
count*: int
disabled: bool
data*: array[400, LogEntry]
TrackLogger* = proc (log: TrackLog) {.nimcall, tags: [], locks: 0, gcsafe.}
TrackLogger* = proc (log: TrackLog) {.nimcall, tags: [], gcsafe.}
var
gLog*: TrackLog
@ -70,7 +70,7 @@ proc addEntry(entry: LogEntry) =
if interesting:
gLog.disabled = true
cprintf("interesting %s:%ld %s\n", entry.file, entry.line, entry.op)
let x = cast[proc() {.nimcall, tags: [], gcsafe, locks: 0, raises: [].}](writeStackTrace)
let x = cast[proc() {.nimcall, tags: [], gcsafe, raises: [].}](writeStackTrace)
x()
quit 1
#if gLog.count > high(gLog.data):
@ -85,7 +85,7 @@ proc memTrackerWrite(address: pointer; size: int; file: cstring; line: int) {.co
size: size, file: file, line: line, thread: myThreadId())
proc memTrackerOp*(op: cstring; address: pointer; size: int) {.tags: [],
locks: 0, gcsafe.} =
gcsafe.} =
addEntry LogEntry(op: op, address: address, size: size,
file: "", line: 0, thread: myThreadId())

View file

@ -60,13 +60,13 @@ proc captureStackTrace(f: PFrame, st: var StackTrace) =
b = b.prev
var
profilingRequestedHook*: proc (): bool {.nimcall, locks: 0, gcsafe.}
profilingRequestedHook*: proc (): bool {.nimcall, gcsafe.}
## set this variable to provide a procedure that implements a profiler in
## user space. See the `nimprof` module for a reference implementation.
when defined(memProfiler):
type
MemProfilerHook* = proc (st: StackTrace, requestedSize: int) {.nimcall, locks: 0, gcsafe.}
MemProfilerHook* = proc (st: StackTrace, requestedSize: int) {.nimcall, gcsafe.}
var
profilerHook*: MemProfilerHook

View file

@ -22,26 +22,26 @@ when defined(nimStackTraceOverride):
## This is the same as the type `uintptr_t` in C.
StackTraceOverrideGetTracebackProc* = proc (): string {.
nimcall, gcsafe, locks: 0, raises: [], tags: [], noinline.}
nimcall, gcsafe, raises: [], tags: [], noinline.}
StackTraceOverrideGetProgramCountersProc* = proc (maxLength: cint): seq[cuintptr_t] {.
nimcall, gcsafe, locks: 0, raises: [], tags: [], noinline.}
nimcall, gcsafe, raises: [], tags: [], noinline.}
StackTraceOverrideGetDebuggingInfoProc* =
proc (programCounters: seq[cuintptr_t], maxLength: cint): seq[StackTraceEntry] {.
nimcall, gcsafe, locks: 0, raises: [], tags: [], noinline.}
nimcall, gcsafe, raises: [], tags: [], noinline.}
# Default procedures (not normally used, because people opting in on this
# override are supposed to register their own versions).
var
stackTraceOverrideGetTraceback: StackTraceOverrideGetTracebackProc =
proc (): string {.nimcall, gcsafe, locks: 0, raises: [], tags: [], noinline.} =
proc (): string {.nimcall, gcsafe, raises: [], tags: [], noinline.} =
discard
#result = "Stack trace override procedure not registered.\n"
stackTraceOverrideGetProgramCounters: StackTraceOverrideGetProgramCountersProc =
proc (maxLength: cint): seq[cuintptr_t] {.nimcall, gcsafe, locks: 0, raises: [], tags: [], noinline.} =
proc (maxLength: cint): seq[cuintptr_t] {.nimcall, gcsafe, raises: [], tags: [], noinline.} =
discard
stackTraceOverrideGetDebuggingInfo: StackTraceOverrideGetDebuggingInfoProc =
proc (programCounters: seq[cuintptr_t], maxLength: cint): seq[StackTraceEntry] {.
nimcall, gcsafe, locks: 0, raises: [], tags: [], noinline.} =
nimcall, gcsafe, raises: [], tags: [], noinline.} =
discard
# Custom procedure registration.

View file

@ -121,7 +121,7 @@ type
Callback* = proc (para1: pointer, para2: int32, para3,
para4: cstringArray): int32{.cdecl.}
Tbind_destructor_func* = proc (para1: pointer){.cdecl, locks: 0, tags: [], gcsafe.}
Tbind_destructor_func* = proc (para1: pointer){.cdecl, tags: [], gcsafe.}
Create_function_step_func* = proc (para1: Pcontext, para2: int32,
para3: PValueArg){.cdecl.}
Create_function_func_func* = proc (para1: Pcontext, para2: int32,