remove dead code under Nim 1.6+ (#206)
This commit is contained in:
parent
02f0929fc4
commit
326ef09a46
|
@ -1,13 +1,10 @@
|
|||
# Copyright (c) 2020-2022 Status Research & Development GmbH
|
||||
# Copyright (c) 2020-2023 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
|
||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
{.push raises: [].}
|
||||
|
||||
## Operations on array and openArray
|
||||
|
||||
|
|
|
@ -2,10 +2,7 @@ import
|
|||
std/typetraits,
|
||||
./shims/macros
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
{.push raises: [].}
|
||||
|
||||
func assign*[T](tgt: var seq[T], src: openArray[T]) {.gcsafe.}
|
||||
func assign*[T](tgt: var openArray[T], src: openArray[T]) {.gcsafe.}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
## Copyright (c) 2021-2022 Status Research & Development GmbH
|
||||
## Copyright (c) 2021-2023 Status Research & Development GmbH
|
||||
## Licensed under either of
|
||||
## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||
## * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||
|
@ -13,10 +13,7 @@
|
|||
import results
|
||||
export results
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
{.push raises: [].}
|
||||
|
||||
type
|
||||
Base10* = object
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
{.push raises: [].}
|
||||
|
||||
import
|
||||
bitops2, ptrops
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# byteutils
|
||||
# Copyright (c) 2018-2022 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2023 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT).
|
||||
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
|
||||
|
@ -16,12 +16,8 @@ import
|
|||
# backwards compat
|
||||
export arrayops.`&`, arrayops.initArrayWith, arrayops.`[]=`
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
{.pragma: hexRaises, raises: [Defect, ValueError].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
{.pragma: hexRaises, raises: [ValueError].}
|
||||
{.push raises: [].}
|
||||
{.pragma: hexRaises, raises: [ValueError].}
|
||||
|
||||
########################################################################################################
|
||||
##################################### Hex utilities ################################################
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
## Copyright (c) 2020 Status Research & Development GmbH
|
||||
## Copyright (c) 2020-2023 Status Research & Development GmbH
|
||||
## Licensed under either of
|
||||
## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||
## * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||
|
@ -19,10 +19,7 @@ elif sizeof(int) == 4:
|
|||
type
|
||||
AnyItem* = byte|char|int8|uint16|int16|uint32|int32|uint|int
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
{.push raises: [].}
|
||||
|
||||
proc isEqual*[A: AnyItem, B: AnyItem](c: typedesc[CT], a: openArray[A],
|
||||
b: openArray[B]): bool =
|
||||
|
|
|
@ -33,10 +33,7 @@ macro enumStyle*(t: typedesc[enum]): untyped =
|
|||
of nnkEmpty:
|
||||
continue
|
||||
of nnkIdent:
|
||||
when (NimMajor, NimMinor) < (1, 4): # `nnkSym` in Nim 1.2
|
||||
style.setMode(EnumStyle.Numeric, typ)
|
||||
else:
|
||||
error("Unexpected enum node for deserialization: " & $f.kind)
|
||||
error("Unexpected enum node for deserialization: " & $f.kind)
|
||||
of nnkSym:
|
||||
style.setMode(EnumStyle.Numeric, typ)
|
||||
of nnkEnumFieldDef:
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Nimbus - Types, data structures and shared utilities used in network sync
|
||||
#
|
||||
# Copyright (c) 2018-2022 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2023 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -111,10 +111,7 @@
|
|||
import
|
||||
"."/[results, sorted_set]
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect, CatchableError].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
{.push raises: [].}
|
||||
|
||||
export
|
||||
`isRed=`,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
## Copyright (c) 2020-2022 Status Research & Development GmbH
|
||||
## Copyright (c) 2020-2023 Status Research & Development GmbH
|
||||
## Licensed under either of
|
||||
## * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE))
|
||||
## * MIT license ([LICENSE-MIT](LICENSE-MIT))
|
||||
|
@ -10,10 +10,7 @@
|
|||
## not use exceptions and using Result[T] for error handling.
|
||||
##
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
{.push raises: [].}
|
||||
|
||||
import algorithm
|
||||
import results
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2018-2022 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2023 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -29,10 +29,7 @@ import
|
|||
export
|
||||
results
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
{.push raises: [].}
|
||||
|
||||
type
|
||||
KeyedQueueItem*[K,V] = object ##\
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2018 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2023 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -31,10 +31,7 @@ type
|
|||
kQVfyPrvNxtExpected
|
||||
kQVfyFirstExpected
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
{.push raises: [].}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Public functions, debugging
|
||||
|
|
|
@ -37,9 +37,6 @@
|
|||
## be reasonable for short-lived allocations.
|
||||
##
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
import ../shims/stddefects
|
||||
|
||||
type
|
||||
StackArray*[T] = object
|
||||
bufferLen: int32
|
||||
|
|
|
@ -1,25 +1 @@
|
|||
when (NimMajor, NimMinor) < (1, 4):
|
||||
type
|
||||
AccessViolationDefect* = AccessViolationError
|
||||
ArithmeticDefect* = ArithmeticError
|
||||
AssertionDefect* = AssertionError
|
||||
DeadThreadDefect* = DeadThreadError
|
||||
DivByZeroDefect* = DivByZeroError
|
||||
FieldDefect* = FieldError
|
||||
FloatDivByZeroDefect* = FloatDivByZeroError
|
||||
FloatInexactDefect* = FloatInexactError
|
||||
FloatInvalidOpDefect* = FloatInvalidOpError
|
||||
FloatOverflowDefect* = FloatOverflowError
|
||||
FloatUnderflowDefect* = FloatUnderflowError
|
||||
FloatingPointDefect* = FloatingPointError
|
||||
IndexDefect* = IndexError
|
||||
NilAccessDefect* = NilAccessError
|
||||
ObjectAssignmentDefect* = ObjectAssignmentError
|
||||
ObjectConversionDefect* = ObjectConversionError
|
||||
OutOfMemDefect* = OutOfMemError
|
||||
OverflowDefect* = OverflowError
|
||||
RangeDefect* = RangeError
|
||||
ReraiseDefect* = ReraiseError
|
||||
StackOverflowDefect* = StackOverflowError
|
||||
else:
|
||||
{.used.}
|
||||
{.deprecated: "Nim 1.4 and newer support FooDefect directly".}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2018-2022 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2023 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -87,10 +87,7 @@ type
|
|||
## returned from functions.
|
||||
RbResult[SortedSetItemRef[K,V]]
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect,CatchableError].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
{.push raises: [].}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Private helpers
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2018-2022 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2023 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -13,10 +13,7 @@ import
|
|||
./rbtree_rotate,
|
||||
../results
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
{.push raises: [].}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Public
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2018-2022 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2023 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -170,10 +170,7 @@ type
|
|||
start*: bool ## `true` after a rewind operation
|
||||
stop*: bool ## End of traversal
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
{.push raises: [].}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Public functions, constructor
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2018-2022 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2023 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -12,10 +12,7 @@ import
|
|||
./rbtree_desc,
|
||||
../results
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
{.push raises: [].}
|
||||
|
||||
# ----------------------------------------------------------------------- ------
|
||||
# Public
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2018-2022 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2023 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -14,10 +14,7 @@ import
|
|||
type
|
||||
RbTreeFlushDel*[C] = proc(c: var C) {.gcsafe.}
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
{.push raises: [].}
|
||||
|
||||
# ----------------------------------------------------------------------- ------
|
||||
# Private
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2018-2022 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2023 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -13,10 +13,7 @@ import
|
|||
./rbtree_rotate,
|
||||
../results
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
{.push raises: [].}
|
||||
|
||||
# ----------------------------------------------------------------------- ------
|
||||
# Private functions
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2018-2022 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2023 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -13,10 +13,7 @@ import
|
|||
./rbtree_flush,
|
||||
./rbtree_walk
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
{.push raises: [].}
|
||||
|
||||
# ----------------------------------------------------------------------- ------
|
||||
# Public
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2018-2022 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2023 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -11,10 +11,7 @@
|
|||
import
|
||||
./rbtree_desc
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
{.push raises: [].}
|
||||
|
||||
proc rbTreeRotateSingle*[C](node: RbNodeRef[C]; dir: RbDir): RbNodeRef[C] =
|
||||
## Perform a single red-black tree rotation in the specified direction.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2018-2022 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2023 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -18,18 +18,10 @@ type
|
|||
## for the equivalent of `a < b`
|
||||
proc(a, b: C): bool {.gcsafe.}
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
type
|
||||
RbPrnFn* = ##\
|
||||
## Handle error message
|
||||
proc(code: RbInfo; ctxInfo: string)
|
||||
{.gcsafe, raises: [Defect,CatchableError].}
|
||||
else:
|
||||
type
|
||||
RbPrnFn* = ##\
|
||||
## Handle error message
|
||||
proc(code: RbInfo; ctxInfo: string)
|
||||
{.gcsafe, raises: [].}
|
||||
RbPrnFn* = ##\
|
||||
## Handle error message
|
||||
proc(code: RbInfo; ctxInfo: string)
|
||||
{.gcsafe, raises: [].}
|
||||
|
||||
type
|
||||
RbDdebug[C,K] = object
|
||||
|
@ -42,10 +34,7 @@ type
|
|||
pr: RbPrnFn
|
||||
msg: string ## collect data
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect, CatchableError].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
{.push raises: [].}
|
||||
|
||||
# ----------------------------------------------------------------------- ------
|
||||
# Private
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# Nimbus
|
||||
# Copyright (c) 2018-2022 Status Research & Development GmbH
|
||||
# Copyright (c) 2018-2023 Status Research & Development GmbH
|
||||
# Licensed under either of
|
||||
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
||||
# http://www.apache.org/licenses/LICENSE-2.0)
|
||||
|
@ -13,10 +13,7 @@ import
|
|||
./rbtree_desc,
|
||||
../results
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
{.push raises: [].}
|
||||
|
||||
# ----------------------------------------------------------------------- ------
|
||||
# Priv
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2019-2022 Status Research & Development GmbH
|
||||
# Copyright (c) 2019-2023 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license: http://opensource.org/licenses/MIT
|
||||
# * Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
@ -11,9 +11,6 @@ import
|
|||
../../stew/ptrops,
|
||||
../../stew/ranges/[stackarrays]
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
import ../../stew/shims/stddefects
|
||||
|
||||
suite "Stack arrays":
|
||||
test "Basic operations work as expected":
|
||||
var arr = allocStackArray(int, 10)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2020-2022 Status Research & Development GmbH
|
||||
# Copyright (c) 2020-2023 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * MIT license: http://opensource.org/licenses/MIT
|
||||
# * Apache License, Version 2.0: http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
@ -9,10 +9,7 @@
|
|||
import unittest2
|
||||
import ../stew/ctops
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 6):
|
||||
type DefectEx = AssertionError
|
||||
else:
|
||||
type DefectEx = AssertionDefect
|
||||
type DefectEx = AssertionDefect
|
||||
|
||||
suite "Constant-time operations test suite":
|
||||
test "isEqual() test":
|
||||
|
|
|
@ -533,10 +533,7 @@ suite "KeyedQueue: Data queue as LRU cache":
|
|||
s0 = sq
|
||||
key = sq[5].toKey
|
||||
|
||||
when (NimMajor, NimMinor) >= (1, 6):
|
||||
sq.delete(5..5) # delete index 5 in sequence
|
||||
else:
|
||||
sq.delete(5, 5) # delete index 5 in sequence
|
||||
sq.delete(5..5) # delete index 5 in sequence
|
||||
|
||||
noisy.say &"sq: {s0} <off sq[5]({key})> {sq}"
|
||||
|
||||
|
|
Loading…
Reference in New Issue