styleCheck: make the compiler and large parts of the stdlib compatible with --styleCheck:error
This commit is contained in:
parent
96523cdd3e
commit
c94647aeca
90 changed files with 680 additions and 652 deletions
|
|
@ -32,6 +32,9 @@
|
|||
# error only if they actualy try to use the missing declaration
|
||||
{.deadCodeElim: on.} # dce option deprecated
|
||||
|
||||
when defined(nimHasStyleChecks):
|
||||
{.push styleChecks: off.}
|
||||
|
||||
# TODO these constants don't seem to be fetched from a header file for unknown
|
||||
# platforms - where do they come from and why are they here?
|
||||
when false:
|
||||
|
|
@ -114,13 +117,13 @@ when StatHasNanoseconds:
|
|||
## Second-granularity time of last status change.
|
||||
result = s.st_ctim.tv_sec
|
||||
else:
|
||||
proc st_atim*(s: Stat): TimeSpec {.inline.} =
|
||||
proc st_atim*(s: Stat): Timespec {.inline.} =
|
||||
## Nanosecond-granularity time of last access.
|
||||
result.tv_sec = s.st_atime
|
||||
proc st_mtim*(s: Stat): TimeSpec {.inline.} =
|
||||
proc st_mtim*(s: Stat): Timespec {.inline.} =
|
||||
## Nanosecond-granularity time of last data modification.
|
||||
result.tv_sec = s.st_mtime
|
||||
proc st_ctim*(s: Stat): TimeSpec {.inline.} =
|
||||
proc st_ctim*(s: Stat): Timespec {.inline.} =
|
||||
## Nanosecond-granularity time of last data modification.
|
||||
result.tv_sec = s.st_ctime
|
||||
|
||||
|
|
@ -269,45 +272,45 @@ proc strerror*(errnum: cint): cstring {.importc, header: "<string.h>".}
|
|||
|
||||
proc pthread_atfork*(a1, a2, a3: proc () {.noconv.}): cint {.
|
||||
importc, header: "<pthread.h>".}
|
||||
proc pthread_attr_destroy*(a1: ptr PthreadAttr): cint {.
|
||||
proc pthread_attr_destroy*(a1: ptr Pthread_attr): cint {.
|
||||
importc, header: "<pthread.h>".}
|
||||
proc pthread_attr_getdetachstate*(a1: ptr PthreadAttr, a2: cint): cint {.
|
||||
proc pthread_attr_getdetachstate*(a1: ptr Pthread_attr, a2: cint): cint {.
|
||||
importc, header: "<pthread.h>".}
|
||||
proc pthread_attr_getguardsize*(a1: ptr PthreadAttr, a2: var cint): cint {.
|
||||
proc pthread_attr_getguardsize*(a1: ptr Pthread_attr, a2: var cint): cint {.
|
||||
importc, header: "<pthread.h>".}
|
||||
proc pthread_attr_getinheritsched*(a1: ptr PthreadAttr,
|
||||
proc pthread_attr_getinheritsched*(a1: ptr Pthread_attr,
|
||||
a2: var cint): cint {.importc, header: "<pthread.h>".}
|
||||
proc pthread_attr_getschedparam*(a1: ptr PthreadAttr,
|
||||
proc pthread_attr_getschedparam*(a1: ptr Pthread_attr,
|
||||
a2: ptr Sched_param): cint {.importc, header: "<pthread.h>".}
|
||||
proc pthread_attr_getschedpolicy*(a1: ptr PthreadAttr,
|
||||
proc pthread_attr_getschedpolicy*(a1: ptr Pthread_attr,
|
||||
a2: var cint): cint {.importc, header: "<pthread.h>".}
|
||||
proc pthread_attr_getscope*(a1: ptr PthreadAttr,
|
||||
proc pthread_attr_getscope*(a1: ptr Pthread_attr,
|
||||
a2: var cint): cint {.importc, header: "<pthread.h>".}
|
||||
proc pthread_attr_getstack*(a1: ptr PthreadAttr,
|
||||
proc pthread_attr_getstack*(a1: ptr Pthread_attr,
|
||||
a2: var pointer, a3: var int): cint {.importc, header: "<pthread.h>".}
|
||||
proc pthread_attr_getstackaddr*(a1: ptr PthreadAttr,
|
||||
proc pthread_attr_getstackaddr*(a1: ptr Pthread_attr,
|
||||
a2: var pointer): cint {.importc, header: "<pthread.h>".}
|
||||
proc pthread_attr_getstacksize*(a1: ptr PthreadAttr,
|
||||
proc pthread_attr_getstacksize*(a1: ptr Pthread_attr,
|
||||
a2: var int): cint {.importc, header: "<pthread.h>".}
|
||||
proc pthread_attr_init*(a1: ptr PthreadAttr): cint {.
|
||||
proc pthread_attr_init*(a1: ptr Pthread_attr): cint {.
|
||||
importc, header: "<pthread.h>".}
|
||||
proc pthread_attr_setdetachstate*(a1: ptr PthreadAttr, a2: cint): cint {.
|
||||
proc pthread_attr_setdetachstate*(a1: ptr Pthread_attr, a2: cint): cint {.
|
||||
importc, header: "<pthread.h>".}
|
||||
proc pthread_attr_setguardsize*(a1: ptr PthreadAttr, a2: int): cint {.
|
||||
proc pthread_attr_setguardsize*(a1: ptr Pthread_attr, a2: int): cint {.
|
||||
importc, header: "<pthread.h>".}
|
||||
proc pthread_attr_setinheritsched*(a1: ptr PthreadAttr, a2: cint): cint {.
|
||||
proc pthread_attr_setinheritsched*(a1: ptr Pthread_attr, a2: cint): cint {.
|
||||
importc, header: "<pthread.h>".}
|
||||
proc pthread_attr_setschedparam*(a1: ptr PthreadAttr,
|
||||
proc pthread_attr_setschedparam*(a1: ptr Pthread_attr,
|
||||
a2: ptr Sched_param): cint {.importc, header: "<pthread.h>".}
|
||||
proc pthread_attr_setschedpolicy*(a1: ptr PthreadAttr, a2: cint): cint {.
|
||||
proc pthread_attr_setschedpolicy*(a1: ptr Pthread_attr, a2: cint): cint {.
|
||||
importc, header: "<pthread.h>".}
|
||||
proc pthread_attr_setscope*(a1: ptr PthreadAttr, a2: cint): cint {.importc,
|
||||
proc pthread_attr_setscope*(a1: ptr Pthread_attr, a2: cint): cint {.importc,
|
||||
header: "<pthread.h>".}
|
||||
proc pthread_attr_setstack*(a1: ptr PthreadAttr, a2: pointer, a3: int): cint {.
|
||||
proc pthread_attr_setstack*(a1: ptr Pthread_attr, a2: pointer, a3: int): cint {.
|
||||
importc, header: "<pthread.h>".}
|
||||
proc pthread_attr_setstackaddr*(a1: ptr PthreadAttr, a2: pointer): cint {.
|
||||
proc pthread_attr_setstackaddr*(a1: ptr Pthread_attr, a2: pointer): cint {.
|
||||
importc, header: "<pthread.h>".}
|
||||
proc pthread_attr_setstacksize*(a1: ptr PthreadAttr, a2: int): cint {.
|
||||
proc pthread_attr_setstacksize*(a1: ptr Pthread_attr, a2: int): cint {.
|
||||
importc, header: "<pthread.h>".}
|
||||
proc pthread_barrier_destroy*(a1: ptr Pthread_barrier): cint {.
|
||||
importc, header: "<pthread.h>".}
|
||||
|
|
@ -350,7 +353,7 @@ proc pthread_condattr_init*(a1: ptr Pthread_condattr): cint {.importc, header: "
|
|||
proc pthread_condattr_setclock*(a1: ptr Pthread_condattr,a2: ClockId): cint {.importc, header: "<pthread.h>".}
|
||||
proc pthread_condattr_setpshared*(a1: ptr Pthread_condattr, a2: cint): cint {.importc, header: "<pthread.h>".}
|
||||
|
||||
proc pthread_create*(a1: ptr Pthread, a2: ptr PthreadAttr,
|
||||
proc pthread_create*(a1: ptr Pthread, a2: ptr Pthread_attr,
|
||||
a3: proc (x: pointer): pointer {.noconv.}, a4: pointer): cint {.importc, header: "<pthread.h>".}
|
||||
proc pthread_detach*(a1: Pthread): cint {.importc, header: "<pthread.h>".}
|
||||
proc pthread_equal*(a1, a2: Pthread): cint {.importc, header: "<pthread.h>".}
|
||||
|
|
@ -1068,3 +1071,6 @@ proc setrlimit*(resource: cint, rlp: var RLimit): cint
|
|||
proc getrlimit*(resource: cint, rlp: var RLimit): cint
|
||||
{.importc: "getrlimit",header: "<sys/resource.h>".}
|
||||
## The getrlimit() system call gets resource limits.
|
||||
|
||||
when defined(nimHasStyleChecks):
|
||||
{.pop.} # {.push styleChecks: off.}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,10 @@ const
|
|||
# On Linux:
|
||||
# timer_{create,delete,settime,gettime},
|
||||
# clock_{getcpuclockid, getres, gettime, nanosleep, settime} lives in librt
|
||||
{.passL: "-lrt".}
|
||||
{.passl: "-lrt".}
|
||||
|
||||
when defined(nimHasStyleChecks):
|
||||
{.push styleChecks: off.}
|
||||
|
||||
# Types
|
||||
|
||||
|
|
@ -32,7 +35,7 @@ type
|
|||
SocketHandle* = distinct cint # The type used to represent socket descriptors
|
||||
|
||||
# not detected by detect.nim, guarded by #ifdef __USE_UNIX98 in glibc
|
||||
const SIG_HOLD* = cast[SigHandler](2)
|
||||
const SIG_HOLD* = cast[Sighandler](2)
|
||||
|
||||
type
|
||||
Time* {.importc: "time_t", header: "<time.h>".} = distinct clong
|
||||
|
|
@ -296,7 +299,7 @@ type
|
|||
sigev_signo*: cint ## Signal number.
|
||||
sigev_notify*: cint ## Notification type.
|
||||
sigev_notify_function*: proc (x: SigVal) {.noconv.} ## Notification func.
|
||||
sigev_notify_attributes*: ptr PthreadAttr ## Notification attributes.
|
||||
sigev_notify_attributes*: ptr Pthread_attr ## Notification attributes.
|
||||
abi: array[12, int]
|
||||
|
||||
SigVal* {.importc: "union sigval",
|
||||
|
|
@ -579,4 +582,7 @@ proc WSTOPSIG*(s:cint): cint = WEXITSTATUS(s)
|
|||
proc WIFEXITED*(s:cint) : bool = WTERMSIG(s) == 0
|
||||
proc WIFSIGNALED*(s:cint) : bool = (cast[int8]((s and 0x7f) + 1) shr 1) > 0
|
||||
proc WIFSTOPPED*(s:cint) : bool = (s and 0xff) == 0x7f
|
||||
proc WIFCONTINUED*(s:cint) : bool = s == W_CONTINUED
|
||||
proc WIFCONTINUED*(s:cint) : bool = s == WCONTINUED
|
||||
|
||||
when defined(nimHasStyleChecks):
|
||||
{.pop.} # {.push styleChecks: off.}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@
|
|||
|
||||
{.deadCodeElim: on.} # dce option deprecated
|
||||
|
||||
when defined(nimHasStyleChecks):
|
||||
{.push styleChecks: off.}
|
||||
|
||||
const
|
||||
hasSpawnH = true # should exist for every Posix system nowadays
|
||||
hasAioH = false
|
||||
|
|
@ -272,7 +275,7 @@ type
|
|||
sigev_signo*: cint ## Signal number.
|
||||
sigev_value*: SigVal ## Signal value.
|
||||
sigev_notify_function*: proc (x: SigVal) {.noconv.} ## Notification func.
|
||||
sigev_notify_attributes*: ptr PthreadAttr ## Notification attributes.
|
||||
sigev_notify_attributes*: ptr Pthread_attr ## Notification attributes.
|
||||
|
||||
SigVal* {.importc: "union sigval",
|
||||
header: "<signal.h>", final, pure.} = object ## struct sigval
|
||||
|
|
@ -594,3 +597,6 @@ proc WIFSTOPPED*(s: cint): bool {.importc, header: "<sys/wait.h>".}
|
|||
## True if child is currently stopped.
|
||||
proc WIFCONTINUED*(s: cint): bool {.importc, header: "<sys/wait.h>".}
|
||||
## True if child has been continued.
|
||||
|
||||
when defined(nimHasStyleChecks):
|
||||
{.pop.}
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@
|
|||
|
||||
{.deadCodeElim: on.} # dce option deprecated
|
||||
|
||||
when defined(nimHasStyleChecks):
|
||||
{.push styleChecks: off.}
|
||||
|
||||
const
|
||||
hasSpawnH = true # should exist for every Posix system nowadays
|
||||
hasAioH = defined(linux)
|
||||
|
|
@ -281,7 +284,7 @@ type
|
|||
sigev_signo*: cint ## Signal number.
|
||||
sigev_value*: SigVal ## Signal value.
|
||||
sigev_notify_function*: proc (x: SigVal) {.noconv.} ## Notification func.
|
||||
sigev_notify_attributes*: ptr PthreadAttr ## Notification attributes.
|
||||
sigev_notify_attributes*: ptr Pthread_attr ## Notification attributes.
|
||||
|
||||
SigVal* {.importc: "union sigval",
|
||||
header: "<signal.h>", final, pure.} = object ## struct sigval
|
||||
|
|
@ -603,3 +606,6 @@ proc WIFSTOPPED*(s: cint): bool {.importc, header: "<sys/wait.h>".}
|
|||
## True if child is currently stopped.
|
||||
proc WIFCONTINUED*(s: cint): bool {.importc, header: "<sys/wait.h>".}
|
||||
## True if child has been continued.
|
||||
|
||||
when defined(nimHasStyleChecks):
|
||||
{.pop.}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue