remove dead code under Nim 1.6+ (#206)
This commit is contained in:
parent
02f0929fc4
commit
326ef09a46
|
@ -1,12 +1,9 @@
|
|||
# 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: [].}
|
||||
|
||||
## Operations on array and openArray
|
||||
|
|
|
@ -2,9 +2,6 @@ import
|
|||
std/typetraits,
|
||||
./shims/macros
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
|
||||
func assign*[T](tgt: var seq[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,9 +13,6 @@
|
|||
import results
|
||||
export results
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
|
||||
type
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
|
||||
import
|
||||
|
|
|
@ -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,10 +16,6 @@ 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].}
|
||||
|
||||
|
|
|
@ -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,9 +19,6 @@ 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: [].}
|
||||
|
||||
proc isEqual*[A: AnyItem, B: AnyItem](c: typedesc[CT], a: openArray[A],
|
||||
|
|
|
@ -33,9 +33,6 @@ 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)
|
||||
of nnkSym:
|
||||
style.setMode(EnumStyle.Numeric, typ)
|
||||
|
|
|
@ -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,9 +111,6 @@
|
|||
import
|
||||
"."/[results, sorted_set]
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect, CatchableError].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
|
||||
export
|
||||
|
|
|
@ -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,9 +10,6 @@
|
|||
## not use exceptions and using Result[T] for error handling.
|
||||
##
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
|
||||
import algorithm
|
||||
|
|
|
@ -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,9 +29,6 @@ import
|
|||
export
|
||||
results
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
|
||||
type
|
||||
|
|
|
@ -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,9 +31,6 @@ type
|
|||
kQVfyPrvNxtExpected
|
||||
kQVfyFirstExpected
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
|
@ -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,9 +87,6 @@ type
|
|||
## returned from functions.
|
||||
RbResult[SortedSetItemRef[K,V]]
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect,CatchableError].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
|
@ -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,9 +13,6 @@ import
|
|||
./rbtree_rotate,
|
||||
../results
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
|
@ -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,9 +170,6 @@ type
|
|||
start*: bool ## `true` after a rewind operation
|
||||
stop*: bool ## End of traversal
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
|
|
|
@ -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,9 +12,6 @@ import
|
|||
./rbtree_desc,
|
||||
../results
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
|
||||
# ----------------------------------------------------------------------- ------
|
||||
|
|
|
@ -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,9 +14,6 @@ import
|
|||
type
|
||||
RbTreeFlushDel*[C] = proc(c: var C) {.gcsafe.}
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
|
||||
# ----------------------------------------------------------------------- ------
|
||||
|
|
|
@ -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,9 +13,6 @@ import
|
|||
./rbtree_rotate,
|
||||
../results
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
|
||||
# ----------------------------------------------------------------------- ------
|
||||
|
|
|
@ -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,9 +13,6 @@ import
|
|||
./rbtree_flush,
|
||||
./rbtree_walk
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
|
||||
# ----------------------------------------------------------------------- ------
|
||||
|
|
|
@ -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,9 +11,6 @@
|
|||
import
|
||||
./rbtree_desc
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
|
||||
proc rbTreeRotateSingle*[C](node: RbNodeRef[C]; dir: RbDir): RbNodeRef[C] =
|
||||
|
|
|
@ -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,14 +18,6 @@ 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)
|
||||
|
@ -42,9 +34,6 @@ type
|
|||
pr: RbPrnFn
|
||||
msg: string ## collect data
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect, CatchableError].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
|
||||
# ----------------------------------------------------------------------- ------
|
||||
|
|
|
@ -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,9 +13,6 @@ import
|
|||
./rbtree_desc,
|
||||
../results
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 4):
|
||||
{.push raises: [Defect].}
|
||||
else:
|
||||
{.push raises: [].}
|
||||
|
||||
# ----------------------------------------------------------------------- ------
|
||||
|
|
|
@ -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,9 +9,6 @@
|
|||
import unittest2
|
||||
import ../stew/ctops
|
||||
|
||||
when (NimMajor, NimMinor) < (1, 6):
|
||||
type DefectEx = AssertionError
|
||||
else:
|
||||
type DefectEx = AssertionDefect
|
||||
|
||||
suite "Constant-time operations test suite":
|
||||
|
|
|
@ -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
|
||||
|
||||
noisy.say &"sq: {s0} <off sq[5]({key})> {sq}"
|
||||
|
||||
|
|
Loading…
Reference in New Issue