Skip to content

Commit

Permalink
Fixed 'declared but not used' warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
zevv committed Feb 13, 2020
1 parent 3792ebf commit 6d39d11
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/npeg/codegen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,6 @@ proc genCode*(program: Program, sType, uType, uId: NimNode): NimNode =

proc fn(`ms`: var MatchState, `s`: openArray[`sType`], `uId`: var `uType`): MatchResult {.gensym.} =

{.push hint[XDeclaredButNotUsed]: off.}

# Create local instances of performance-critical MatchState vars, this saves a
# dereference on each access

Expand All @@ -410,13 +408,13 @@ proc genCode*(program: Program, sType, uType, uId: NimNode): NimNode =

# These templates are available for code blocks

template validate(o: bool) =
template validate(o: bool) {.used.} =
if not o: return false

template fail() =
template fail() {.used.} =
return false

template push(`s`: string) =
template push(`s`: string) {.used.} =
push(`ms`.capStack, CapFrame[`sType`](cft: cftOpen, ck: ckPushed))
push(`ms`.capStack, CapFrame[`sType`](cft: cftClose, ck: ckPushed, sPushed: `s`))

Expand All @@ -436,8 +434,6 @@ proc genCode*(program: Program, sType, uType, uId: NimNode): NimNode =
result.matchMax = `ms`.simax
if result.ok and `ms`.capStack.top > 0:
result.cs = fixCaptures(`s`, `ms`.capStack, FixAll)

{.pop.}

Parser[`sType`,`uType`](fn: fn)

Expand Down

0 comments on commit 6d39d11

Please sign in to comment.