summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorNeelesh Chandola <neelesh.chandola@outlook.com>2018-12-13 13:35:24 +0530
committerAndreas Rumpf <rumpf_a@web.de>2018-12-13 09:05:24 +0100
commitbb8586923794291ddabd122490fd2ab7ccc71ee0 (patch)
treead6085118b67b1491240b4d54c953735b1ab0e19 /compiler
parent8dfe7c09639f3b12c100894a1f1e2152839af3c3 (diff)
downloadNim-bb8586923794291ddabd122490fd2ab7ccc71ee0.tar.gz
Undefine some symbols and globalOptions when processing nimscript (#9945) [backport]
* Undefine some symbols when processing nimscript
* Undefine taintMode when processing nimscript
* Reload .cfg configuration
Diffstat (limited to 'compiler')
-rw-r--r--compiler/cmdlinehelper.nim12
1 files changed, 12 insertions, 0 deletions
diff --git a/compiler/cmdlinehelper.nim b/compiler/cmdlinehelper.nim
index 8bd073314..9fbf4a0b0 100644
--- a/compiler/cmdlinehelper.nim
+++ b/compiler/cmdlinehelper.nim
@@ -48,6 +48,15 @@ proc loadConfigsAndRunMainCommand*(self: NimProg, cache: IdentCache; conf: Confi
   if self.suggestMode:
     conf.command = "nimsuggest"
 
+  # These defines/options should not be enabled while processing nimscript
+  # bug #4446, #9420, #8991, #9589, #9153
+  undefSymbol(conf.symbols, "profiler")
+  undefSymbol(conf.symbols, "memProfiler")
+  undefSymbol(conf.symbols, "nodejs")
+
+  # bug #9120
+  conf.globalOptions.excl(optTaintMode)
+
   proc runNimScriptIfExists(path: AbsoluteFile)=
     if fileExists(path):
       runNimScript(cache, path, freshDefines = false, conf)
@@ -79,6 +88,9 @@ proc loadConfigsAndRunMainCommand*(self: NimProg, cache: IdentCache; conf: Confi
         # 'nimsuggest foo.nims' means to just auto-complete the NimScript file
         discard
 
+  # Reload configuration from .cfg file
+  loadConfigs(DefaultConfig, cache, conf)
+
   # now process command line arguments again, because some options in the
   # command line can overwite the config file's settings
   extccomp.initVars(conf)