undefine C symbols in JS backend [backport:1.6] (#19437)

fix #19330; fix #19059
This commit is contained in:
flywind
2022-02-05 06:10:24 +08:00
committed by GitHub
parent 33bfe5b12c
commit 7b09fd70ab
3 changed files with 11 additions and 3 deletions

View File

@@ -64,7 +64,8 @@ proc loadConfigsAndProcessCmdLine*(self: NimProg, cache: IdentCache; conf: Confi
if conf.cmd == cmdNimscript: return false
# now process command line arguments again, because some options in the
# command line can overwrite the config file's settings
extccomp.initVars(conf)
if conf.backend != backendJs: # bug #19059
extccomp.initVars(conf)
self.processCmdLine(passCmd2, "", conf)
if conf.cmd == cmdNone:
rawMessage(conf, errGenerated, "command missing")

View File

@@ -899,8 +899,9 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
splitSwitch(conf, arg, key, val, pass, info)
os.putEnv(key, val)
of "cc":
expectArg(conf, switch, arg, pass, info)
setCC(conf, arg, info)
if conf.backend != backendJs: # bug #19330
expectArg(conf, switch, arg, pass, info)
setCC(conf, arg, info)
of "track":
expectArg(conf, switch, arg, pass, info)
track(conf, arg, info)

6
tests/js/tcsymbol.nim Normal file
View File

@@ -0,0 +1,6 @@
discard """
matrix: "--cc:gcc; --cc:tcc"
"""
doAssert not defined(gcc)
doAssert not defined(tcc)