summary refs log tree commit diff stats
path: root/koch.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2019-01-16 21:19:38 +0100
committerAraq <rumpf_a@web.de>2019-01-16 21:19:51 +0100
commit2039dad2736909a9d2091b137eeab4293b508e12 (patch)
treed9b12cf3d65bb4efd937542468c181b4e1df3187 /koch.nim
parent8947779dd033966202be58f105dd307c44f143c8 (diff)
downloadNim-2039dad2736909a9d2091b137eeab4293b508e12.tar.gz
koch.nim: Make bootstrapping in C++ mode robust
Diffstat (limited to 'koch.nim')
-rw-r--r--koch.nim10
1 files changed, 6 insertions, 4 deletions
diff --git a/koch.nim b/koch.nim
index 1d636914d..be8f75986 100644
--- a/koch.nim
+++ b/koch.nim
@@ -277,14 +277,16 @@ proc boot(args: string) =
   var output = "compiler" / "nim".exe
   var finalDest = "bin" / "nim".exe
   # default to use the 'c' command:
-  let defaultCommand = if getEnv("NIM_COMPILE_TO_CPP", "false") == "true": "cpp" else: "c"
-  let bootOptions = if args.len == 0 or args.startsWith("-"): defaultCommand else: ""
-  echo "boot: defaultCommand: ", defaultCommand, " bootOptions: ", bootOptions
+  let useCpp = getEnv("NIM_COMPILE_TO_CPP", "false") == "true"
   let smartNimcache = (if "release" in args: "nimcache/r_" else: "nimcache/d_") &
                       hostOs & "_" & hostCpu
 
   copyExe(findStartNim(), 0.thVersion)
-  for i in 0..2:
+  for i in 0..2+ord(useCpp):
+    # do the first iteration in C mode in order to avoid problem #10315:
+    let defaultCommand = if useCpp and i > 0: "cpp" else: "c"
+    let bootOptions = if args.len == 0 or args.startsWith("-"): defaultCommand else: ""
+
     echo "iteration: ", i+1
     let extraOption = if i == 0:
       "--skipUserCfg --skipParentCfg"