move system/atomics out of system; std/atomics should be preferred (#20875)

* move `system/atomics` out of system; `std/atomics` should be preferred

* add deprecation message

* fixes

* fixes

* fixes

* fixes more tests
This commit is contained in:
ringabout 2022-11-23 03:39:30 +08:00 • committed by GitHub
commit 09b7f90475
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 23 additions and 17 deletions

View file

@ -1394,13 +1394,15 @@ when not defined(js) and not defined(booting) and defined(nimTrMacros):
swap(cast[ptr pointer](addr arr[a])[], cast[ptr pointer](addr arr[b])[])
when not defined(nimscript):
proc atomicInc*(memLoc: var int, x: int = 1): int {.inline,
discardable, raises: [], tags: [], benign.}
## Atomic increment of `memLoc`. Returns the value after the operation.
{.push stackTrace: off, profiler: off.}
proc atomicDec*(memLoc: var int, x: int = 1): int {.inline,
discardable, raises: [], tags: [], benign.}
## Atomic decrement of `memLoc`. Returns the value after the operation.
when not defined(nimPreviewSlimSystem):
import std/sysatomics
export sysatomics
else:
import std/sysatomics
{.pop.}
include "system/memalloc"
@ -1617,13 +1619,6 @@ when not defined(nimscript):
when not declared(sysFatal):
include "system/fatal"
when not defined(nimscript):
{.push stackTrace: off, profiler: off.}
include "system/atomics"
{.pop.}
when defined(nimV2):
include system/arc