Use modern enums in compiler (#15775)
This commit is contained in:
parent
5298366f86
commit
00b495de95
18 changed files with 212 additions and 330 deletions
|
|
@ -330,10 +330,10 @@ proc processDynLib(c: PContext, n: PNode, sym: PSym) =
|
|||
sym.typ.callConv = ccCDecl
|
||||
|
||||
proc processNote(c: PContext, n: PNode) =
|
||||
template handleNote(toStrArray, msgMin, notes) =
|
||||
let x = findStr(toStrArray, n[0][1].ident.s)
|
||||
if x >= 0:
|
||||
nk = TNoteKind(x + ord(msgMin))
|
||||
template handleNote(enumVals, notes) =
|
||||
let x = findStr(enumVals, n[0][1].ident.s, errUnknown)
|
||||
if x != errUnknown:
|
||||
nk = TNoteKind(x)
|
||||
let x = c.semConstBoolExpr(c, n[1])
|
||||
n[1] = x
|
||||
if x.kind == nkIntLit and x.intVal != 0: incl(notes, nk)
|
||||
|
|
@ -347,9 +347,9 @@ proc processNote(c: PContext, n: PNode) =
|
|||
n[0][1].kind == nkIdent and n[0][0].kind == nkIdent:
|
||||
var nk: TNoteKind
|
||||
case whichKeyword(n[0][0].ident)
|
||||
of wHint: handleNote(HintsToStr, hintMin, c.config.notes)
|
||||
of wWarning: handleNote(WarningsToStr, warnMin, c.config.notes)
|
||||
of wWarningAsError: handleNote(WarningsToStr, warnMin, c.config.warningAsErrors)
|
||||
of wHint: handleNote(hintMin .. hintMax, c.config.notes)
|
||||
of wWarning: handleNote(warnMin .. warnMax, c.config.notes)
|
||||
of wWarningAsError: handleNote(warnMin .. warnMax, c.config.warningAsErrors)
|
||||
else: invalidPragma(c, n)
|
||||
else: invalidPragma(c, n)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue