summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--.gitignore4
-rw-r--r--compiler/ccgtypes.nim9
-rw-r--r--compiler/vmgen.nim7
-rw-r--r--config/nim.cfg39
-rw-r--r--lib/pure/ospaths.nim8
5 files changed, 44 insertions, 23 deletions
diff --git a/.gitignore b/.gitignore
index 50fa9a431..5476e173f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,10 @@ dnimcache/
 
 *.o
 !/icons/*.o
+*.obj
+*.ilk
+*.pdb
+*.dll
 *.exe
 *.so
 *.dylib
diff --git a/compiler/ccgtypes.nim b/compiler/ccgtypes.nim
index e63e97e0f..bd3e6d40d 100644
--- a/compiler/ccgtypes.nim
+++ b/compiler/ccgtypes.nim
@@ -123,10 +123,11 @@ const
 
 proc typeName(typ: PType): Rope =
   let typ = typ.skipTypes(irrelevantForBackend)
-  result = if typ.sym != nil and typ.kind in {tyObject, tyEnum}:
-             typ.sym.name.s.mangle.rope
-           else:
-             ~"TY"
+  result =
+    if typ.sym != nil and typ.kind in {tyObject, tyEnum}:
+      typ.sym.name.s.mangle.rope
+    else:
+      rope($typ.kind)
 
 proc getTypeName(m: BModule; typ: PType; sig: SigHash): Rope =
   var t = typ
diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim
index ab969a42f..dbb8c9dcd 100644
--- a/compiler/vmgen.nim
+++ b/compiler/vmgen.nim
@@ -656,16 +656,17 @@ proc genNarrow(c: PCtx; n: PNode; dest: TDest) =
   let t = skipTypes(n.typ, abstractVar-{tyTypeDesc})
   # uint is uint64 in the VM, we we only need to mask the result for
   # other unsigned types:
-  if t.kind in {tyUInt8..tyUInt32}:
+  if t.kind in {tyUInt8..tyUInt32} or (t.kind == tyUInt and t.size < 8):
     c.gABC(n, opcNarrowU, dest, TRegister(t.size*8))
-  elif t.kind in {tyInt8..tyInt32}:
+  elif t.kind in {tyInt8..tyInt32} or (t.kind == tyInt and t.size < 8):
     c.gABC(n, opcNarrowS, dest, TRegister(t.size*8))
 
 proc genNarrowU(c: PCtx; n: PNode; dest: TDest) =
   let t = skipTypes(n.typ, abstractVar-{tyTypeDesc})
   # uint is uint64 in the VM, we we only need to mask the result for
   # other unsigned types:
-  if t.kind in {tyUInt8..tyUInt32, tyInt8..tyInt32}:
+  if t.kind in {tyUInt8..tyUInt32, tyInt8..tyInt32} or
+    (t.kind in {tyUInt, tyInt} and t.size < 8):
     c.gABC(n, opcNarrowU, dest, TRegister(t.size*8))
 
 proc genBinaryABCnarrow(c: PCtx; n: PNode; dest: var TDest; opc: TOpcode) =
diff --git a/config/nim.cfg b/config/nim.cfg
index 042a94eaa..2271006c3 100644
--- a/config/nim.cfg
+++ b/config/nim.cfg
@@ -193,27 +193,40 @@ clang.options.speed = "-O3"
 clang.options.size = "-Os"
 
 # Configuration for the Visual C/C++ compiler:
-vcc.exe = "vccexe.exe"
-vcc.linkerexe = "vccexe.exe"
+vcc.exe =     "vccexe.exe"
+vcc.cpp.exe = "vccexe.exe"
+vcc.linkerexe =     "vccexe.exe"
+vcc.cpp.linkerexe = "vccexe.exe"
 
 # set the options for specific platforms:
 @if i386:
-vcc.options.always = "--platform:x86 /nologo"
-vcc.options.linker = "--platform:x86 /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
+vcc.options.always =      "--platform:x86 /nologo"
+vcc.cpp.options.always =  "--platform:x86 /nologo /EHsc"
+vcc.options.linker =      "--platform:x86 /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
+vcc.cpp.options.linker =  "--platform:x86 /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
 @elif amd64:
-vcc.options.always = "--platform:amd64 /nologo"
-vcc.options.linker = "--platform:amd64 /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
+vcc.options.always =      "--platform:amd64 /nologo"
+vcc.cpp.options.always =  "--platform:amd64 /nologo /EHsc"
+vcc.options.linker =      "--platform:amd64 /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
+vcc.cpp.options.linker =  "--platform:amd64 /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
 @elif arm:
-vcc.options.always = "--platform:arm /nologo"
-vcc.options.linker = "--platform:arm /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
+vcc.options.always =      "--platform:arm /nologo"
+vcc.cpp.options.always =  "--platform:arm /nologo /EHsc"
+vcc.options.linker =      "--platform:arm /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
+vcc.cpp.options.linker =  "--platform:arm /nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
 @else:
-vcc.options.always = "/nologo"
-vcc.options.linker = "/nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
+vcc.options.always =      "/nologo"
+vcc.cpp.options.always =  "/nologo /EHsc"
+vcc.options.linker =      "/nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
+vcc.cpp.options.linker =  "/nologo /DEBUG /Zi /F33554432" # set the stack size to 32 MiB
 @end
 
-vcc.options.debug = "/Zi /FS /Od"
-vcc.options.speed = "/O2"
-vcc.options.size = "/O1"
+vcc.options.debug =     "/Zi /FS /Od"
+vcc.cpp.options.debug = "/Zi /FS /Od /EHsc"
+vcc.options.speed =     "/O2"
+vcc.cpp.options.speed = "/O2 /EHsc"
+vcc.options.size =     "/O1"
+vcc.cpp.options.size = "/O1 /EHsc"
 
 # Configuration for the Tiny C Compiler:
 tcc.options.always = "-w"
diff --git a/lib/pure/ospaths.nim b/lib/pure/ospaths.nim
index 769fa9872..3cd90056a 100644
--- a/lib/pure/ospaths.nim
+++ b/lib/pure/ospaths.nim
@@ -529,7 +529,10 @@ when declared(getEnv) or defined(nimscript):
     else: return string(getEnv("HOME")) & "/.config/"
 
   when defined(android):
-    {.pragma: getTempDirEffects, tags: [ReadEnvEffect, ReadIOEffect, WriteDirEffect].}
+    when declared(os):
+      {.pragma: getTempDirEffects, tags: [ReadEnvEffect, ReadIOEffect, WriteDirEffect].}
+    else:
+      {.pragma: getTempDirEffects, tags: [ReadEnvEffect, ReadIOEffect].}
   elif defined(windows):
     {.pragma: getTempDirEffects, tags: [ReadEnvEffect, ReadIOEffect].}
   else:
@@ -545,8 +548,7 @@ when declared(getEnv) or defined(nimscript):
     elif defined(windows): return string(getEnv("TEMP")) & "\\"
     elif defined(android):
       let tempDir = getHomeDir() / "nimtempfs"
-      try: createDir(tempDir)
-      except OSError: discard
+      createDir(tempDir)
       return tempDir
     else: return "/tmp/"