new feature: .used pragma to suppress declared-but-not-used warning

This commit is contained in:
Araq 2017-02-17 18:03:56 +01:00
commit 8f426b974a
5 changed files with 51 additions and 10 deletions

13
tests/pragmas/tused.nim Normal file
View file

@ -0,0 +1,13 @@
discard """
output: '''8'''
"""
template implementArithOps(T) =
proc echoAdd(a, b: T) {.used.} =
echo a + b
proc echoSub(a, b: T) {.used.} =
echo a - b
# no warning produced for the unused 'echoSub'
implementArithOps(int)
echoAdd 3, 5