Skip to content

Commit

Permalink
fix for bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed May 16, 2020
1 parent 6b1f5fa commit 97aeeda
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 16 deletions.
1 change: 0 additions & 1 deletion compiler/commands.nim
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,6 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
let backend = parseEnum(arg.normalize, TBackend.default)
if backend == TBackend.default: localError(conf, info, "invalid backend: '$1'" % arg)
conf.backend = backend
conf.backendSet = true # ideally TBackend.default would be enough, but right now it causes issues
of "doccmd": conf.docCmd = arg
of "mainmodule", "m":
discard "allow for backwards compatibility, but don't do anything"
Expand Down
4 changes: 1 addition & 3 deletions compiler/docgen.nim
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,8 @@ proc newDocumentor*(filename: AbsoluteFile; cache: IdentCache; conf: ConfigRef,
writeFile(outp, importStmt & content)

proc interpSnippetCmd(cmd: string): string =
result = cmd
# backward compatibility hacks; interpolation commands should explicitly use `$`
result = result.replace("nim ", "$nim")
result = result.replace("$1", "$options")
result = cmd.replace("nim ", "$nim").replace("$1", "$options")
result = result % [
"nim", os.getAppFilename().quoteShell,
"backend", $d.conf.backend,
Expand Down
16 changes: 8 additions & 8 deletions compiler/extccomp.nim
Original file line number Diff line number Diff line change
Expand Up @@ -306,14 +306,14 @@ proc isVSCompatible*(conf: ConfigRef): bool =
proc getConfigVar(conf: ConfigRef; c: TSystemCC, suffix: string): string =
# use ``cpu.os.cc`` for cross compilation, unless ``--compileOnly`` is given
# for niminst support
let fullSuffix =
case conf.backend
of backendCpp, backendJs, backendObjc: "." & $conf.backend & suffix
of backendC: suffix
of backendInvalid:
# during parsing of cfg files; we don't know the backend yet, no point in
# guessing wrong thing
return ""
var fullSuffix = suffix
case conf.backend
of backendCpp, backendJs, backendObjc: fullSuffix = "." & $conf.backend & suffix
of backendC: discard
of backendInvalid:
# during parsing of cfg files; we don't know the backend yet, no point in
# guessing wrong thing
return ""

if (conf.target.hostOS != conf.target.targetOS or conf.target.hostCPU != conf.target.targetCPU) and
optCompileOnly notin conf.globalOptions:
Expand Down
3 changes: 1 addition & 2 deletions compiler/main.nim
Original file line number Diff line number Diff line change
Expand Up @@ -201,8 +201,7 @@ proc mainCommand*(graph: ModuleGraph) =
## case command doesn't require it
## This must be called by all commands.
if conf.backend == backendInvalid:
# if not conf.backendSet:
# only set backend if wasn't already set, to allow override via `nim c -b:cpp`
# only set if wasn't already set, to allow override via `nim c -b:cpp`
conf.backend = backend

defineSymbol(graph.config.symbols, $conf.backend)
Expand Down
3 changes: 1 addition & 2 deletions compiler/options.nim
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,7 @@ type
## fields marked with '*' are subject to
## the incremental compilation mechanisms
## (+) means "part of the dependency"
backend*: TBackend
backendSet*: bool # eg via explicit `nim c` or `nim --backend`
backend*: TBackend # set via `nim x` or `nim --backend:x`
target*: Target # (+)
linesCompiled*: int # all lines that have been compiled
options*: TOptions # (+)
Expand Down

0 comments on commit 97aeeda

Please sign in to comment.