Show stackTrace on asserts

This commit is contained in:
Ganesh Viswanathan 2019-04-05 16:20:15 -05:00
commit 7bee0392e7
3 changed files with 6 additions and 22 deletions

View file

@ -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")
switch("gc", "markAndSweep")
# Retain stackTrace for clear errors
switch("stackTrace", "on")

View file

@ -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):

View file

@ -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".}