markAndSweep, removeStatic
This commit is contained in:
parent
da6a4e30ab
commit
f17b958f47
2 changed files with 3 additions and 17 deletions
|
|
@ -5,8 +5,8 @@ else:
|
||||||
switch("gcc.linkerexe", "g++")
|
switch("gcc.linkerexe", "g++")
|
||||||
|
|
||||||
# Workaround for NilAccessError crash on Windows #98
|
# Workaround for NilAccessError crash on Windows #98
|
||||||
when defined(Windows):
|
# Could also help for OSX/Linux crash
|
||||||
switch("gc", "markAndSweep")
|
switch("gc", "markAndSweep")
|
||||||
|
|
||||||
# Retain stackTrace for clear errors
|
# Retain stackTrace for clear errors
|
||||||
switch("stackTrace", "on")
|
switch("stackTrace", "on")
|
||||||
|
|
|
||||||
|
|
@ -510,20 +510,6 @@ proc getNameInfo*(gState: State, node: TSNode, kind: NimSymKind, parent = ""):
|
||||||
proc getCurrentHeader*(fullpath: string): string =
|
proc getCurrentHeader*(fullpath: string): string =
|
||||||
("header" & fullpath.splitFile().name.multiReplace([(".", ""), ("-", "")]))
|
("header" & fullpath.splitFile().name.multiReplace([(".", ""), ("-", "")]))
|
||||||
|
|
||||||
proc removeStatic(content: string): string =
|
|
||||||
## Replace static function bodies with a semicolon and commented
|
|
||||||
## out body
|
|
||||||
return content.replace(
|
|
||||||
re"(?msU)static inline ([^)]+\))([^}]+\})",
|
|
||||||
proc (m: RegexMatch, s: string): string =
|
|
||||||
let funcDecl = s[m.group(0)[0]]
|
|
||||||
let body = s[m.group(1)[0]].strip()
|
|
||||||
result = ""
|
|
||||||
|
|
||||||
result.add("$#;" % [funcDecl])
|
|
||||||
result.add(body.replace(re"(?m)^(.*\n?)", "//$1"))
|
|
||||||
)
|
|
||||||
|
|
||||||
proc getPreprocessor*(gState: State, fullpath: string): string =
|
proc getPreprocessor*(gState: State, fullpath: string): string =
|
||||||
var
|
var
|
||||||
cmts = if gState.nocomments: "" else: "-CC"
|
cmts = if gState.nocomments: "" else: "-CC"
|
||||||
|
|
@ -731,7 +717,7 @@ proc loadPlugin*(gState: State, sourcePath: string) =
|
||||||
pdll = sourcePath.dll
|
pdll = sourcePath.dll
|
||||||
if not fileExists(pdll) or
|
if not fileExists(pdll) or
|
||||||
sourcePath.getLastModificationTime() > pdll.getLastModificationTime():
|
sourcePath.getLastModificationTime() > pdll.getLastModificationTime():
|
||||||
discard execAction(&"{gState.nim.sanitizePath} c --app:lib {sourcePath.sanitizePath}")
|
discard execAction(&"{gState.nim.sanitizePath} c --app:lib --gc:markAndSweep {sourcePath.sanitizePath}")
|
||||||
doAssert fileExists(pdll), "No plugin binary generated for " & sourcePath
|
doAssert fileExists(pdll), "No plugin binary generated for " & sourcePath
|
||||||
|
|
||||||
let lib = loadLib(pdll)
|
let lib = loadLib(pdll)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue