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:59:46 +0530
committerNeelesh Chandola <neelesh.chandola@outlook.com>2018-12-13 13:59:46 +0530
commitb2411db54119ea00296d12a47bd12a371bc0a4ba (patch)
tree79d537e3066eb5c9778df62faa3a53445a190892 /compiler
parentabcf4d8b5dd4988c952a232d4a610d0491ff79ff (diff)
parenta3c4791e9cde49f44e7261044cc84fa863bc717c (diff)
downloadNim-b2411db54119ea00296d12a47bd12a371bc0a4ba.tar.gz
Merge remote-tracking branch 'upstream/devel' into record-case
Diffstat (limited to 'compiler')
-rw-r--r--compiler/cmdlinehelper.nim12
-rw-r--r--compiler/extccomp.nim2
-rw-r--r--compiler/semstmts.nim4
3 files changed, 16 insertions, 2 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)
diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim
index 4b9e1c6fe..23f723e29 100644
--- a/compiler/extccomp.nim
+++ b/compiler/extccomp.nim
@@ -780,7 +780,7 @@ proc linkViaResponseFile(conf: ConfigRef; cmd: string) =
   let linkerArgs = conf.projectName & "_" & "linkerArgs.txt"
   let args = cmd.substr(i)
   # GCC's response files don't support backslashes. Junk.
-  if conf.cCompiler == ccGcc:
+  if conf.cCompiler == ccGcc or conf.cCompiler == ccCLang:
     writeFile(linkerArgs, args.replace('\\', '/'))
   else:
     writeFile(linkerArgs, args)
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim
index d81410891..65df29913 100644
--- a/compiler/semstmts.nim
+++ b/compiler/semstmts.nim
@@ -800,11 +800,13 @@ proc semCase(c: PContext, n: PNode; flags: TExprFlags): PNode =
       typ = commonType(typ, x.sons[1])
       closeScope(c)
     of nkElse:
-      chckCovered = false
       checkSonsLen(x, 1, c.config)
       x.sons[0] = semExprBranchScope(c, x.sons[0])
       typ = commonType(typ, x.sons[0])
       hasElse = true
+      if chckCovered and covered == toCover(c, n.sons[0].typ):
+        localError(c.config, x.info, "invalid else, all cases are already covered")
+      chckCovered = false
     else:
       illFormedAst(x, c.config)
   if chckCovered: