new feature: .used pragma to suppress declared-but-not-used warning
This commit is contained in:
parent
dd8cbf5fca
commit
8f426b974a
5 changed files with 51 additions and 10 deletions
13
tests/pragmas/tused.nim
Normal file
13
tests/pragmas/tused.nim
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue