From 8db27d30e6153fc943ef54e837ed9a3df7d56004 Mon Sep 17 00:00:00 2001 From: Andreas Rumpf Date: Sun, 10 Jun 2018 18:05:43 +0200 Subject: [PATCH] record cppdefine for incremental compilation --- compiler/options.nim | 3 --- compiler/pragmas.nim | 3 +++ compiler/rodimpl.nim | 2 ++ 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/compiler/options.nim b/compiler/options.nim index d3f2f9d1cd..74a217fbc0 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -245,9 +245,6 @@ template depConfigFields*(fn) {.dirty.} = fn(globalOptions) fn(selectedGC) -template serializeConfigFields(fn) {.dirty.} = - fn(cppDefines) # XXX TODO: Replay this. - const oldExperimentalFeatures* = {implicitDeref, dotOperators, callOperator, parallel} const diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index a51d250a24..bfb06e00ae 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -748,10 +748,12 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int, of wImportc: let name = getOptionalStr(c, it, "$1") cppDefine(c.config, name) + recordPragma(c, it, "cppdefine", name) makeExternImport(c, sym, name, it.info) of wImportCompilerProc: let name = getOptionalStr(c, it, "$1") cppDefine(c.config, name) + recordPragma(c, it, "cppdefine", name) processImportCompilerProc(c, sym, name, it.info) of wExtern: setExternName(c, sym, expectStrLit(c, it), it.info) of wImmediate: @@ -844,6 +846,7 @@ proc singlePragma(c: PContext, sym: PSym, n: PNode, i: var int, of wCompilerProc, wCore: noVal(c, it) # compilerproc may not get a string! cppDefine(c.graph.config, sym.name.s) + recordPragma(c, it, "cppdefine", sym.name.s) if sfFromGeneric notin sym.flags: markCompilerProc(c, sym) of wProcVar: noVal(c, it) diff --git a/compiler/rodimpl.nim b/compiler/rodimpl.nim index 8cac5d0305..955e881e22 100644 --- a/compiler/rodimpl.nim +++ b/compiler/rodimpl.nim @@ -793,6 +793,8 @@ proc replay(g: ModuleGraph; module: PSym; n: PNode) = extccomp.addLinkOption(g.config, n[1].strVal) of "passc": extccomp.addCompileOption(g.config, n[1].strVal) + of "cppdefine": + options.cppDefine(g.config, n[1].strVal) of "inc": let destKey = n[1].strVal let by = n[2].intVal