Skip to content

Commit

Permalink
undefine C symbols in JS backend [backport:1.6] (#19437)
Browse files Browse the repository at this point in the history
fix #19330; fix #19059

(cherry picked from commit 7b09fd7)
  • Loading branch information
ringabout authored and narimiran committed Feb 23, 2022
1 parent b6024fe commit 5e13d57
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion compiler/cmdlinehelper.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
5 changes: 3 additions & 2 deletions compiler/commands.nim
Original file line number Diff line number Diff line change
Expand Up @@ -885,8 +885,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)
Expand Down
6 changes: 6 additions & 0 deletions tests/js/tcsymbol.nim
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
discard """
matrix: "--cc:gcc; --cc:tcc"
"""

doAssert not defined(gcc)
doAssert not defined(tcc)

0 comments on commit 5e13d57

Please sign in to comment.