diff options
author | bptato <nincsnevem662@gmail.com> | 2023-10-21 10:35:14 +0200 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2023-10-21 10:35:14 +0200 |
commit | 4d7729c010359ef6372f96ea0d47a470c3cc2cda (patch) | |
tree | 9674eba4228eb01ae59205efb813b8089c444170 /src/utils | |
parent | f447a99aca3657df4d896fb30e435f7f627e94a7 (diff) | |
download | chawan-4d7729c010359ef6372f96ea0d47a470c3cc2cda.tar.gz |
warn on eprint in release mode
Maybe it's easier to avoid accidentally including like this
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/eprint.nim | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/utils/eprint.nim b/src/utils/eprint.nim index 02072bc6..b58bae77 100644 --- a/src/utils/eprint.nim +++ b/src/utils/eprint.nim @@ -1,6 +1,6 @@ {.used.} -func eprint*(s: varargs[string, `$`]) = +template eprint0(s: varargs[string]) = {.cast(noSideEffect), cast(tags: []), cast(raises: []).}: var o = "" for i in 0 ..< s.len: @@ -13,6 +13,14 @@ func eprint*(s: varargs[string, `$`]) = o &= '\n' stderr.write(o) +when defined(release): + func eprint*(s: varargs[string, `$`]) + {.deprecated: "eprint is for debugging only".} = + eprint0(s) +else: + func eprint*(s: varargs[string, `$`]) = + eprint0(s) + func elog*(s: varargs[string, `$`]) = {.cast(noSideEffect), cast(tags: []), cast(raises: []).}: var f: File |