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
commit 4f9aaee1d9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 11 additions and 12 deletions

View file

@ -31,7 +31,7 @@ const
CLONE_IO* = 0x80000000'i32 CLONE_IO* = 0x80000000'i32
CLONE_STOPPED* {.deprecated.} = 0x02000000'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; proc clone*(fn: pointer; child_stack: pointer; flags: cint;
arg: pointer; ptid: ptr Pid; tls: pointer; arg: pointer; ptid: ptr Pid; tls: pointer;
ctid: ptr Pid): cint {.importc, header: "<sched.h>".} 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 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 access*(a1: cstring, a2: cint): cint {.importc, header: "<unistd.h>".}
proc alarm*(a1: cint): cint {.importc, header: "<unistd.h>".} proc alarm*(a1: cint): cint {.importc, header: "<unistd.h>".}
proc chdir*(a1: cstring): 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. ## <#spawnX.t>`_ instead.
result = gSomeReady.counter > 0 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 ## Always spawns a new task, so that the `call` is never executed on
## the calling thread. ## the calling thread.
## ##
## `call` has to be a proc call `p(...)` where `p` is gcsafe and has a ## `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]`. ## 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 ## Always spawns a new task on the worker thread with `id`, so that
## the `call` is **always** executed on the thread. ## 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 = cast[CoroutinePtr](alloc0(sizeof(Coroutine)))
coro.execContext = CreateFiberEx(stacksize, stacksize, coro.execContext = CreateFiberEx(stacksize, stacksize,
FIBER_FLAG_FLOAT_SWITCH, FIBER_FLAG_FLOAT_SWITCH,
(proc(p: pointer): void {.stdcall.} = runCurrentTask()), (proc(p: pointer) {.stdcall.} = runCurrentTask()), nil)
nil)
coro.stack.size = stacksize coro.stack.size = stacksize
else: else:
coro = cast[CoroutinePtr](alloc0(sizeof(Coroutine) + stacksize)) 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) = proc initFromJson[T: distinct](dst: var T; jsonNode: JsonNode; jsonPath: var string) =
assignDistinctImpl(dst, jsonNode, jsonPath) assignDistinctImpl(dst, jsonNode, jsonPath)
proc detectIncompatibleType(typeExpr, lineinfoNode: NimNode): void = proc detectIncompatibleType(typeExpr, lineinfoNode: NimNode) =
if typeExpr.kind == nnkTupleConstr: if typeExpr.kind == nnkTupleConstr:
error("Use a named tuple instead of: " & typeExpr.repr, lineinfoNode) 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, proc socketError*(socket: Socket, err: int = -1, async = false,
lastError = (-1).OSErrorCode, lastError = (-1).OSErrorCode,
flags: set[SocketFlag] = {}): void {.gcsafe.} flags: set[SocketFlag] = {}) {.gcsafe.}
proc isDisconnectionError*(flags: set[SocketFlag], proc isDisconnectionError*(flags: set[SocketFlag],
lastError: OSErrorCode): bool = lastError: OSErrorCode): bool =

View file

@ -1030,7 +1030,7 @@ const
PROCESS_QUERY_LIMITED_INFORMATION* = 0x00001000'i32 PROCESS_QUERY_LIMITED_INFORMATION* = 0x00001000'i32
PROCESS_SET_LIMITED_INFORMATION* = 0x00002000'i32 PROCESS_SET_LIMITED_INFORMATION* = 0x00002000'i32
type type
WAITORTIMERCALLBACK* = proc(para1: pointer, para2: int32): void {.stdcall.} WAITORTIMERCALLBACK* = proc(para1: pointer, para2: int32) {.stdcall.}
proc postQueuedCompletionStatus*(CompletionPort: Handle, proc postQueuedCompletionStatus*(CompletionPort: Handle,
dwNumberOfBytesTransferred: DWORD, dwNumberOfBytesTransferred: DWORD,
@ -1112,7 +1112,7 @@ else:
{.stdcall, dynlib: "kernel32", importc: "ReadConsoleInputW".} {.stdcall, dynlib: "kernel32", importc: "ReadConsoleInputW".}
type type
LPFIBER_START_ROUTINE* = proc (param: pointer): void {.stdcall.} LPFIBER_START_ROUTINE* = proc (param: pointer) {.stdcall.}
const const
FIBER_FLAG_FLOAT_SWITCH* = 0x01 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 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 ConvertThreadToFiber*(param: pointer): pointer {.stdcall, discardable, dynlib: "kernel32", importc.}
proc ConvertThreadToFiberEx*(param: pointer, flags: int32): 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 DeleteFiber*(fiber: pointer) {.stdcall, discardable, dynlib: "kernel32", importc.}
proc SwitchToFiber*(fiber: pointer): void {.stdcall, discardable, dynlib: "kernel32", importc.} proc SwitchToFiber*(fiber: pointer) {.stdcall, discardable, dynlib: "kernel32", importc.}
proc GetCurrentFiber*(): pointer {.stdcall, importc, header: "windows.h".} proc GetCurrentFiber*(): pointer {.stdcall, importc, header: "windows.h".}
proc toFILETIME*(t: int64): FILETIME = proc toFILETIME*(t: int64): FILETIME =