summary refs log tree commit diff stats
path: root/tests/arc
diff options
context:
space:
mode:
authorringabout <43030857+ringabout@users.noreply.github.com>2023-09-20 18:50:23 +0800
committerGitHub <noreply@github.com>2023-09-20 12:50:23 +0200
commitd82bc0a29fea53a172260a3b3301b90a96974274 (patch)
tree153400133dbd85cbdba0d204a830564f23b0404f /tests/arc
parentaf617be67a4e038354617b272d373a6fbe583644 (diff)
downloadNim-d82bc0a29fea53a172260a3b3301b90a96974274.tar.gz
items, pairs and friends now use `unCheckedInc` (#22729)
`{.push overflowChecks: off.}` works in backends. Though it could be
implemented as a magic function.

By inspecting the generated C code, the overflow check is eliminated in
the debug or release mode.


![image](https://github.com/nim-lang/Nim/assets/43030857/49c3dbf4-675e-414a-b972-b91cf218c9f8)

Likewise, the index checking is probably not needed.
Diffstat (limited to 'tests/arc')
-rw-r--r--tests/arc/topt_no_cursor.nim4
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/arc/topt_no_cursor.nim b/tests/arc/topt_no_cursor.nim
index dfb0f0a38..b24e8e5a9 100644
--- a/tests/arc/topt_no_cursor.nim
+++ b/tests/arc/topt_no_cursor.nim
@@ -91,7 +91,9 @@ try:
             `=copy`(lan_ip, splitted[1])
           echo [lan_ip]
           echo [splitted[1]]
+          {.push, overflowChecks: false.}
           inc(i, 1)
+          {.pop.}
         finally:
           `=destroy`(splitted)
 finally:
@@ -113,7 +115,9 @@ block :tmp:
       addInterfaceDecl(c):
         :tmpD = `=dup`(sym)
         :tmpD
+      {.push, overflowChecks: false.}
       inc(i, 1)
+      {.pop.}
 `=destroy`(shadowScope)
 -- end of expandArc ------------------------
 --expandArc: check