fixes strictdefs warnings continue (#24520)

This commit is contained in:
ringabout
2024-12-13 22:04:49 +08:00
committed by GitHub
parent 80af252025
commit d2d810585c
49 changed files with 152 additions and 91 deletions

View File

@@ -2690,7 +2690,7 @@ proc locals*(): RootObj {.magic: "Plugin", noSideEffect.} =
when hasAlloc and notJSnotNims:
# XXX how to implement 'deepCopy' is an open problem.
proc deepCopy*[T](x: var T, y: T) {.noSideEffect, magic: "DeepCopy".} =
proc deepCopy*[T](x: out T, y: T) {.noSideEffect, magic: "DeepCopy".} =
## Performs a deep copy of `y` and copies it into `x`.
##
## This is also used by the code generator

View File

@@ -73,30 +73,35 @@ proc chckIndx(i, a, b: int): int =
if i >= a and i <= b:
return i
else:
result = 0
raiseIndexError3(i, a, b)
proc chckRange(i, a, b: int): int =
if i >= a and i <= b:
return i
else:
result = 0
raiseRangeError(i)
proc chckRange64(i, a, b: int64): int64 {.compilerproc.} =
if i >= a and i <= b:
return i
else:
result = 0
raiseRangeError(i)
proc chckRangeU(i, a, b: uint64): uint64 {.compilerproc.} =
if i >= a and i <= b:
return i
else:
result = 0
sysFatal(RangeDefect, "value out of range")
proc chckRangeF(x, a, b: float): float =
if x >= a and x <= b:
return x
else:
result = 0.0
when hostOS == "standalone":
sysFatal(RangeDefect, "value out of range")
else:

View File

@@ -203,7 +203,7 @@ proc staticExec*(command: string, input = "", cache = ""): string {.
## ```
proc gorgeEx*(command: string, input = "", cache = ""): tuple[output: string,
exitCode: int] =
exitCode: int] {.noinit.} =
## Similar to `gorge <#gorge,string,string,string>`_ but also returns the
## precious exit code.
discard

View File

@@ -140,6 +140,8 @@ proc repr*[T: tuple|object](x: T): string {.noSideEffect, raises: [].} =
## ```
when T is object:
result = $typeof(x)
else:
result = ""
reprObject(result, x)
proc repr*[T](x: ref T | ptr T): string {.noSideEffect, raises: [].} =