record cppdefine for incremental compilation

This commit is contained in:
Andreas Rumpf 2018-06-10 18:05:43 +02:00
commit 8db27d30e6
3 changed files with 5 additions and 3 deletions

View file

@ -245,9 +245,6 @@ template depConfigFields*(fn) {.dirty.} =
fn(globalOptions) fn(globalOptions)
fn(selectedGC) fn(selectedGC)
template serializeConfigFields(fn) {.dirty.} =
fn(cppDefines) # XXX TODO: Replay this.
const oldExperimentalFeatures* = {implicitDeref, dotOperators, callOperator, parallel} const oldExperimentalFeatures* = {implicitDeref, dotOperators, callOperator, parallel}
const const

View file

@ -748,10 +748,12 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
of wImportc: of wImportc:
let name = getOptionalStr(c, it, "$1") let name = getOptionalStr(c, it, "$1")
cppDefine(c.config, name) cppDefine(c.config, name)
recordPragma(c, it, "cppdefine", name)
makeExternImport(c, sym, name, it.info) makeExternImport(c, sym, name, it.info)
of wImportCompilerProc: of wImportCompilerProc:
let name = getOptionalStr(c, it, "$1") let name = getOptionalStr(c, it, "$1")
cppDefine(c.config, name) cppDefine(c.config, name)
recordPragma(c, it, "cppdefine", name)
processImportCompilerProc(c, sym, name, it.info) processImportCompilerProc(c, sym, name, it.info)
of wExtern: setExternName(c, sym, expectStrLit(c, it), it.info) of wExtern: setExternName(c, sym, expectStrLit(c, it), it.info)
of wImmediate: of wImmediate:
@ -844,6 +846,7 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int,
of wCompilerProc, wCore: of wCompilerProc, wCore:
noVal(c, it) # compilerproc may not get a string! noVal(c, it) # compilerproc may not get a string!
cppDefine(c.graph.config, sym.name.s) cppDefine(c.graph.config, sym.name.s)
recordPragma(c, it, "cppdefine", sym.name.s)
if sfFromGeneric notin sym.flags: markCompilerProc(c, sym) if sfFromGeneric notin sym.flags: markCompilerProc(c, sym)
of wProcVar: of wProcVar:
noVal(c, it) noVal(c, it)

View file

@ -793,6 +793,8 @@ proc replay(g: ModuleGraph; module: PSym; n: PNode) =
extccomp.addLinkOption(g.config, n[1].strVal) extccomp.addLinkOption(g.config, n[1].strVal)
of "passc": of "passc":
extccomp.addCompileOption(g.config, n[1].strVal) extccomp.addCompileOption(g.config, n[1].strVal)
of "cppdefine":
options.cppDefine(g.config, n[1].strVal)
of "inc": of "inc":
let destKey = n[1].strVal let destKey = n[1].strVal
let by = n[2].intVal let by = n[2].intVal