remove redundant void return in stdlib (#17464)

This commit is contained in:
Timothee Cour
2021-03-23 00:28:53 -07:00
committed by GitHub
parent a75c4b70e8
commit 4f9aaee1d9
7 changed files with 11 additions and 12 deletions

View File

@@ -31,7 +31,7 @@ const
CLONE_IO* = 0x80000000'i32
CLONE_STOPPED* {.deprecated.} = 0x02000000'i32
# fn should be of type proc (a2: pointer): void {.cdecl.}
# fn should be of type proc (a2: pointer) {.cdecl.}
proc clone*(fn: pointer; child_stack: pointer; flags: cint;
arg: pointer; ptid: ptr Pid; tls: pointer;
ctid: ptr Pid): cint {.importc, header: "<sched.h>".}

View File

@@ -447,7 +447,7 @@ proc pthread_spin_unlock*(a1: ptr Pthread_spinlock): cint {.
proc pthread_testcancel*() {.importc, header: "<pthread.h>".}
proc exitnow*(code: int): void {.importc: "_exit", header: "<unistd.h>".}
proc exitnow*(code: int) {.importc: "_exit", header: "<unistd.h>".}
proc access*(a1: cstring, a2: cint): cint {.importc, header: "<unistd.h>".}
proc alarm*(a1: cint): cint {.importc, header: "<unistd.h>".}
proc chdir*(a1: cstring): cint {.importc, header: "<unistd.h>".}

View File

@@ -451,14 +451,14 @@ proc preferSpawn*(): bool =
## <#spawnX.t>`_ instead.
result = gSomeReady.counter > 0
proc spawn*(call: sink typed): void {.magic: "Spawn".}
proc spawn*(call: sink typed) {.magic: "Spawn".}
## Always spawns a new task, so that the `call` is never executed on
## the calling thread.
##
## `call` has to be a proc call `p(...)` where `p` is gcsafe and has a
## return type that is either `void` or compatible with `FlowVar[T]`.
proc pinnedSpawn*(id: ThreadId; call: sink typed): void {.magic: "Spawn".}
proc pinnedSpawn*(id: ThreadId; call: sink typed) {.magic: "Spawn".}
## Always spawns a new task on the worker thread with `id`, so that
## the `call` is **always** executed on the thread.
##

View File

@@ -273,8 +273,7 @@ proc start*(c: proc(), stacksize: int = defaultStackSize): CoroutineRef {.discar
coro = cast[CoroutinePtr](alloc0(sizeof(Coroutine)))
coro.execContext = CreateFiberEx(stacksize, stacksize,
FIBER_FLAG_FLOAT_SWITCH,
(proc(p: pointer): void {.stdcall.} = runCurrentTask()),
nil)
(proc(p: pointer) {.stdcall.} = runCurrentTask()), nil)
coro.stack.size = stacksize
else:
coro = cast[CoroutinePtr](alloc0(sizeof(Coroutine) + stacksize))

View File

@@ -1165,7 +1165,7 @@ when defined(nimFixedForwardGeneric):
proc initFromJson[T: distinct](dst: var T; jsonNode: JsonNode; jsonPath: var string) =
assignDistinctImpl(dst, jsonNode, jsonPath)
proc detectIncompatibleType(typeExpr, lineinfoNode: NimNode): void =
proc detectIncompatibleType(typeExpr, lineinfoNode: NimNode) =
if typeExpr.kind == nnkTupleConstr:
error("Use a named tuple instead of: " & typeExpr.repr, lineinfoNode)

View File

@@ -200,7 +200,7 @@ when defined(nimHasStyleChecks):
proc socketError*(socket: Socket, err: int = -1, async = false,
lastError = (-1).OSErrorCode,
flags: set[SocketFlag] = {}): void {.gcsafe.}
flags: set[SocketFlag] = {}) {.gcsafe.}
proc isDisconnectionError*(flags: set[SocketFlag],
lastError: OSErrorCode): bool =

View File

@@ -1030,7 +1030,7 @@ const
PROCESS_QUERY_LIMITED_INFORMATION* = 0x00001000'i32
PROCESS_SET_LIMITED_INFORMATION* = 0x00002000'i32
type
WAITORTIMERCALLBACK* = proc(para1: pointer, para2: int32): void {.stdcall.}
WAITORTIMERCALLBACK* = proc(para1: pointer, para2: int32) {.stdcall.}
proc postQueuedCompletionStatus*(CompletionPort: Handle,
dwNumberOfBytesTransferred: DWORD,
@@ -1112,7 +1112,7 @@ else:
{.stdcall, dynlib: "kernel32", importc: "ReadConsoleInputW".}
type
LPFIBER_START_ROUTINE* = proc (param: pointer): void {.stdcall.}
LPFIBER_START_ROUTINE* = proc (param: pointer) {.stdcall.}
const
FIBER_FLAG_FLOAT_SWITCH* = 0x01
@@ -1121,8 +1121,8 @@ proc CreateFiber*(stackSize: int, fn: LPFIBER_START_ROUTINE, param: pointer): po
proc CreateFiberEx*(stkCommit: int, stkReserve: int, flags: int32, fn: LPFIBER_START_ROUTINE, param: pointer): pointer {.stdcall, discardable, dynlib: "kernel32", importc.}
proc ConvertThreadToFiber*(param: pointer): pointer {.stdcall, discardable, dynlib: "kernel32", importc.}
proc ConvertThreadToFiberEx*(param: pointer, flags: int32): pointer {.stdcall, discardable, dynlib: "kernel32", importc.}
proc DeleteFiber*(fiber: pointer): void {.stdcall, discardable, dynlib: "kernel32", importc.}
proc SwitchToFiber*(fiber: pointer): void {.stdcall, discardable, dynlib: "kernel32", importc.}
proc DeleteFiber*(fiber: pointer) {.stdcall, discardable, dynlib: "kernel32", importc.}
proc SwitchToFiber*(fiber: pointer) {.stdcall, discardable, dynlib: "kernel32", importc.}
proc GetCurrentFiber*(): pointer {.stdcall, importc, header: "windows.h".}
proc toFILETIME*(t: int64): FILETIME =