aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGanesh Viswanathan <dev@genotrance.com>2019-04-05 16:20:15 -0500
committerGanesh Viswanathan <dev@genotrance.com>2019-04-05 16:20:15 -0500
commit7bee0392e7a1a2453f0a2ea428087a8f4f369963 (patch)
tree8e163254146fe4e8ae32117a8bc45893757e2091
parent9a90495a1e4350ba9f3153fee9d18ebfca597fa1 (diff)
downloadnimterop-7bee0392e7a1a2453f0a2ea428087a8f4f369963.tar.gz
nimterop-7bee0392e7a1a2453f0a2ea428087a8f4f369963.zip
Show stackTrace on asserts
-rw-r--r--config.nims12
-rw-r--r--nimterop/git.nim4
-rw-r--r--nimterop/treesitter/cpp.nim12
3 files changed, 6 insertions, 22 deletions
diff --git a/config.nims b/config.nims
index d43b04f..54a9a06 100644
--- a/config.nims
+++ b/config.nims
@@ -1,9 +1,4 @@
-#[
-see D20190127T231316 workaround for fact that toast needs to build
-scanner.cc, which would otherwise result in link errors such as:
-"std::terminate()", referenced from:
- ___clang_call_terminate in scanner.cc.o
-]#
+# Workaround for C++ scanner.cc causing link error with other C obj files
when defined(MacOSX):
switch("clang.linkerexe", "g++")
else:
@@ -11,4 +6,7 @@ else:
# Workaround for NilAccessError crash on Windows #98
when defined(Windows):
- switch("gc", "markAndSweep") \ No newline at end of file
+ switch("gc", "markAndSweep")
+
+# Retain stackTrace for clear errors
+switch("stackTrace", "on") \ No newline at end of file
diff --git a/nimterop/git.nim b/nimterop/git.nim
index 9998a44..740eef2 100644
--- a/nimterop/git.nim
+++ b/nimterop/git.nim
@@ -18,9 +18,7 @@ proc execAction*(cmd: string, nostderr=false): string =
else:
let opt = if nostderr: {poUsePath} else: {poStdErrToStdOut, poUsePath}
(result, ret) = execCmdEx(ccmd, opt)
- if ret != 0:
- let msg = "Command failed: " & $(ret, nostderr) & "\nccmd: " & ccmd & "\nresult:\n" & result
- doAssert false, msg
+ doAssert ret == 0, "Command failed: " & $(ret, nostderr) & "\nccmd: " & ccmd & "\nresult:\n" & result
proc mkDir*(dir: string) =
if not dirExists(dir):
diff --git a/nimterop/treesitter/cpp.nim b/nimterop/treesitter/cpp.nim
index 90db000..1b47206 100644
--- a/nimterop/treesitter/cpp.nim
+++ b/nimterop/treesitter/cpp.nim
@@ -19,18 +19,6 @@ else:
# pending https://github.com/nim-lang/Nim/issues/9370 we need srcDirRel instead
# of srcDir
{.compile: (srcDirRel / "parser.c", "nimtero_cpp_parser.c.o").}
-
-#[
-D20190127T231316:here note: this will be compiled as a C++ file even with
-`nim c`, thanks to the extension (which clang/gcc understands);
-however, in `nim c` mode this will fail in link phase
-(which by default would use `clang/gcc`)
-unless linker is overridden, see D20190127T231316.
-
-cleaner alternative: compile `scanner.cc` into a shared library
-that we link against, which avoids the linker hack.
-]#
-
{.compile: srcDir / "scanner.cc".}
proc treeSitterCpp*(): ptr TSLanguage {.importc: "tree_sitter_cpp", header: srcDir / "api.h".}