about summary refs log tree commit diff stats
path: root/src/utils
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-10-21 10:35:14 +0200
committerbptato <nincsnevem662@gmail.com>2023-10-21 10:35:14 +0200
commit4d7729c010359ef6372f96ea0d47a470c3cc2cda (patch)
tree9674eba4228eb01ae59205efb813b8089c444170 /src/utils
parentf447a99aca3657df4d896fb30e435f7f627e94a7 (diff)
downloadchawan-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.nim10
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