Files
Nim/lib/system/coro_detection.nim
Andreas Rumpf fb86271556 system.nim cleanup some exported constants which should never have be… (#17909)
* system.nim cleanup some exported constants which should never have been exported
2021-05-01 11:10:40 +02:00

21 lines
623 B
Nim

## Coroutine detection logic
template coroutinesSupportedPlatform(): bool =
when defined(sparc) or defined(ELATE) or defined(boehmgc) or defined(gogc) or
defined(nogc) or defined(gcRegions) or defined(gcMarkAndSweep):
false
else:
true
when defined(nimCoroutines):
# Explicit opt-in.
when not coroutinesSupportedPlatform():
{.error: "Coroutines are not supported on this architecture and/or garbage collector.".}
const nimCoroutines* = true
elif defined(noNimCoroutines):
# Explicit opt-out.
const nimCoroutines* = false
else:
# Autodetect coroutine support.
const nimCoroutines* = false