Use constant nimCoroutines instead of defined(nimCoroutines)

Variable
This commit is contained in:
Rokas Kupstys 2017-02-18 17:17:44 +02:00
commit f80ddbbcc6
4 changed files with 32 additions and 12 deletions

View file

@ -2462,6 +2462,23 @@ template accumulateResult*(iter: untyped) =
# we have to compute this here before turning it off in except.nim anyway ...
const NimStackTrace = compileOption("stacktrace")
template coroutinesSupportedPlatform(): bool =
when defined(sparc) or defined(ELATE) or compileOption("gc", "v2") or
defined(boehmgc) or defined(gogc) or defined(nogc) or defined(gcStack) or
defined(gcMarkAndSweep):
false
else:
true
when defined(nimCoroutines):
when not coroutinesSupportedPlatform():
{.error: "Coroutines are not supported on this architecture and/or garbage collector.".}
const nimCoroutines* = true
elif defined(noNimCoroutines):
const nimCoroutines* = false
else:
const nimCoroutines* = false
{.push checks: off.}
# obviously we cannot generate checking operations here :-)
# because it would yield into an endless recursion