summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--compiler/lineinfos.nim7
-rw-r--r--compiler/main.nim40
-rw-r--r--compiler/msgs.nim43
-rw-r--r--compiler/options.nim13
-rw-r--r--compiler/vmops.nim1
-rw-r--r--doc/nimc.rst1
-rw-r--r--drnim/drnim.nim19
-rw-r--r--lib/std/compilesettings.nim1
-rw-r--r--testament/testament.nim3
-rw-r--r--tests/misc/trunner.nim2
10 files changed, 64 insertions, 66 deletions
diff --git a/compiler/lineinfos.nim b/compiler/lineinfos.nim
index bf81aed02..da0a8d623 100644
--- a/compiler/lineinfos.nim
+++ b/compiler/lineinfos.nim
@@ -65,7 +65,7 @@ type
     warnFileChanged = "FileChanged",
     warnUser = "User",
 
-    hintSuccess = "Success", hintSuccessX = "SuccessX", hintBuildMode = "BuildMode",
+    hintSuccess = "Success", hintSuccessX = "SuccessX",
     hintCC = "CC",
     hintLineTooLong = "LineTooLong", hintXDeclaredButNotUsed = "XDeclaredButNotUsed",
     hintXCannotRaiseY = "XCannotRaiseY", hintConvToBaseNotNeeded = "ConvToBaseNotNeeded",
@@ -145,8 +145,7 @@ const
     warnUser: "$1",
     hintSuccess: "operation successful: $#",
     # keep in sync with `testament.isSuccess`
-    hintSuccessX: "$loc lines; ${sec}s; $mem; proj: $project; out: $output",
-    hintBuildMode: "$1",
+    hintSuccessX: "$build\n$loc lines; ${sec}s; $mem; proj: $project; out: $output",
     hintCC: "CC: $1",
     hintLineTooLong: "line too long",
     hintXDeclaredButNotUsed: "'$1' is declared but not used",
@@ -200,7 +199,7 @@ proc computeNotesVerbosity(): array[0..3, TNoteKinds] =
   result[1] = result[2] - {warnProveField, warnProveIndex,
     warnGcUnsafe, hintPath, hintDependency, hintCodeBegin, hintCodeEnd,
     hintSource, hintGlobalVar, hintGCStats, hintMsgOrigin, hintPerformance}
-  result[0] = result[1] - {hintSuccessX, hintBuildMode, hintSuccess, hintConf,
+  result[0] = result[1] - {hintSuccessX, hintSuccess, hintConf,
     hintProcessing, hintPattern, hintExecuting, hintLinking, hintCC}
 
 const
diff --git a/compiler/main.nim b/compiler/main.nim
index 71e549ab8..7824e8cb2 100644
--- a/compiler/main.nim
+++ b/compiler/main.nim
@@ -13,13 +13,14 @@ when not defined(nimcore):
   {.error: "nimcore MUST be defined for Nim's core tooling".}
 
 import
-  llstream, strutils, os, ast, lexer, syntaxes, options, msgs,
-  condsyms, times,
+  std/[strutils, os, times, tables, sha1, with, json],
+  llstream, ast, lexer, syntaxes, options, msgs,
+  condsyms,
   sem, idents, passes, extccomp,
-  cgen, json, nversion,
+  cgen, nversion,
   platform, nimconf, passaux, depends, vm,
   modules,
-  modulegraphs, tables, lineinfos, pathutils, vmprofiler, std/[sha1, with]
+  modulegraphs, lineinfos, pathutils, vmprofiler
 
 import ic / [cbackend, integrity, navigator]
 from ic / ic import rodViewer
@@ -387,38 +388,9 @@ proc mainCommand*(graph: ModuleGraph) =
     rawMessage(conf, errGenerated, "invalid command: " & conf.command)
 
   if conf.errorCounter == 0 and conf.cmd notin {cmdTcc, cmdDump, cmdNop}:
-    # D20210419T170230:here
-    let mem =
-      when declared(system.getMaxMem): formatSize(getMaxMem()) & " peakmem"
-      else: formatSize(getTotalMem()) & " totmem"
-    let loc = $conf.linesCompiled
-    let build = if isDefined(conf, "danger"): "Dangerous Release build"
-                elif isDefined(conf, "release"): "Release build"
-                else: "***SLOW, DEBUG BUILD***; -d:release makes code run faster."
-    let sec = formatFloat(epochTime() - conf.lastCmdTime, ffDecimal, 3)
-    let project = if conf.filenameOption == foAbs: $conf.projectFull else: $conf.projectName
-      # xxx honor conf.filenameOption more accurately
-    var output: string
-    if optCompileOnly in conf.globalOptions and conf.cmd != cmdJsonscript:
-      output = $conf.jsonBuildFile
-    elif conf.outFile.isEmpty and conf.cmd notin {cmdJsonscript} + cmdDocLike + cmdBackends:
-      # for some cmd we expect a valid absOutFile
-      output = "unknownOutput"
-    else:
-      output = $conf.absOutFile
-    if conf.filenameOption != foAbs: output = output.AbsoluteFile.extractFilename
-      # xxx honor filenameOption more accurately
     if optProfileVM in conf.globalOptions:
       echo conf.dump(conf.vmProfileData)
-    rawMessage(conf, hintSuccessX, [
-      "loc", loc,
-      "sec", sec,
-      "mem", mem,
-      "project", project,
-      "output", output,
-      ])
-    if conf.cmd in cmdBackends:
-      rawMessage(conf, hintBuildMode, build)
+    genSuccessX(conf)
 
   when PrintRopeCacheStats:
     echo "rope cache stats: "
diff --git a/compiler/msgs.nim b/compiler/msgs.nim
index 053b5c928..6b005be3d 100644
--- a/compiler/msgs.nim
+++ b/compiler/msgs.nim
@@ -8,10 +8,9 @@
 #
 
 import
-  options, strutils, os, tables, ropes, terminal, macros,
-  lineinfos, pathutils
-import std/private/miscdollars
-import strutils2
+  std/[strutils, os, tables, terminal, macros, times],
+  std/private/miscdollars,
+  options, ropes, lineinfos, pathutils, strutils2
 
 type InstantiationInfo* = typeof(instantiationInfo())
 template instLoc*(): InstantiationInfo = instantiationInfo(-2, fullPaths = true)
@@ -656,3 +655,39 @@ proc uniqueModuleName*(conf: ConfigRef; fid: FileIndex): string =
       # We mangle upper letters and digits too so that there cannot
       # be clashes with our special meanings of 'Z' and 'O'
       result.addInt ord(c)
+
+proc genSuccessX*(conf: ConfigRef) =
+  let mem =
+    when declared(system.getMaxMem): formatSize(getMaxMem()) & " peakmem"
+    else: formatSize(getTotalMem()) & " totmem"
+  let loc = $conf.linesCompiled
+  var build = ""
+  if conf.cmd in cmdBackends:
+    build.add "gc: $#; " % $conf.selectedGC
+    if optThreads in conf.globalOptions: build.add "threads: on; "
+    build.add "opt: "
+    if optOptimizeSpeed in conf.options: build.add "speed"
+    elif optOptimizeSize in conf.options: build.add "size"
+    else: build.add "none (DEBUG BUILD, `-d:release` generates faster code)"
+      # pending https://github.com/timotheecour/Nim/issues/752, point to optimization.html
+  let sec = formatFloat(epochTime() - conf.lastCmdTime, ffDecimal, 3)
+  let project = if conf.filenameOption == foAbs: $conf.projectFull else: $conf.projectName
+    # xxx honor conf.filenameOption more accurately
+  var output: string
+  if optCompileOnly in conf.globalOptions and conf.cmd != cmdJsonscript:
+    output = $conf.jsonBuildFile
+  elif conf.outFile.isEmpty and conf.cmd notin {cmdJsonscript} + cmdDocLike + cmdBackends:
+    # for some cmd we expect a valid absOutFile
+    output = "unknownOutput"
+  else:
+    output = $conf.absOutFile
+  if conf.filenameOption != foAbs: output = output.AbsoluteFile.extractFilename
+    # xxx honor filenameOption more accurately
+  rawMessage(conf, hintSuccessX, [
+    "build", build,
+    "loc", loc,
+    "sec", sec,
+    "mem", mem,
+    "project", project,
+    "output", output,
+    ])
diff --git a/compiler/options.nim b/compiler/options.nim
index afe8b0fc7..1851770d9 100644
--- a/compiler/options.nim
+++ b/compiler/options.nim
@@ -167,8 +167,17 @@ const
 type
   TStringSeq* = seq[string]
   TGCMode* = enum             # the selected GC
-    gcUnselected, gcNone, gcBoehm, gcRegions, gcArc, gcOrc,
-    gcMarkAndSweep, gcHooks, gcRefc, gcV2, gcGo
+    gcUnselected = "unselected"
+    gcNone = "none"
+    gcBoehm = "boehm"
+    gcRegions = "regions"
+    gcArc = "arc"
+    gcOrc = "orc"
+    gcMarkAndSweep = "markAndSweep"
+    gcHooks = "hooks"
+    gcRefc = "refc"
+    gcV2 = "v2"
+    gcGo = "go"
     # gcRefc and the GCs that follow it use a write barrier,
     # as far as usesWriteBarrier() is concerned
 
diff --git a/compiler/vmops.nim b/compiler/vmops.nim
index 04356fc76..85729fd59 100644
--- a/compiler/vmops.nim
+++ b/compiler/vmops.nim
@@ -136,6 +136,7 @@ when defined(nimHasInvariant):
     of ccompilerPath: result = conf.cCompilerPath
     of backend: result = $conf.backend
     of libPath: result = conf.libpath.string
+    of gc: result = $conf.selectedGC
 
   proc querySettingSeqImpl(conf: ConfigRef, switch: BiggestInt): seq[string] =
     template copySeq(field: untyped): untyped =
diff --git a/doc/nimc.rst b/doc/nimc.rst
index e467a33af..2b9f33cb5 100644
--- a/doc/nimc.rst
+++ b/doc/nimc.rst
@@ -108,7 +108,6 @@ Source                           The source line that triggered a diagnostic
                                  message.
 StackTrace
 Success, SuccessX                Successful compilation of a library or a binary.
-BuildMode                        Kind of build: debug, release, danger
 User
 UserRaw
 XDeclaredButNotUsed              Unused symbols in the code.
diff --git a/drnim/drnim.nim b/drnim/drnim.nim
index 1eded533d..eb0d89aa2 100644
--- a/drnim/drnim.nim
+++ b/drnim/drnim.nim
@@ -1205,24 +1205,7 @@ proc mainCommand(graph: ModuleGraph) =
   registerPass graph, semPass
   compileProject(graph)
   if conf.errorCounter == 0:
-    # xxx deduplicate with D20210419T170230
-    let mem =
-      when declared(system.getMaxMem): formatSize(getMaxMem()) & " peakmem"
-      else: formatSize(getTotalMem()) & " totmem"
-    let loc = $conf.linesCompiled
-    let build = if isDefined(conf, "danger"): "Dangerous Release build"
-                elif isDefined(conf, "release"): "Release build"
-                else: "***SLOW, DEBUG BUILD***; -d:release makes code run faster."
-    let sec = formatFloat(epochTime() - conf.lastCmdTime, ffDecimal, 3)
-    let project = if conf.filenameOption == foAbs: $conf.projectFull else: $conf.projectName
-    rawMessage(conf, hintSuccessX, [
-      "loc", loc,
-      "sec", sec,
-      "mem", mem,
-      "project", project,
-      "output", ""
-      ])
-    rawMessage(conf, hintBuildMode, build)
+    genSuccessX(graph.config)
 
 proc processCmdLine(pass: TCmdLinePass, cmd: string; config: ConfigRef) =
   var p = parseopt.initOptParser(cmd)
diff --git a/lib/std/compilesettings.nim b/lib/std/compilesettings.nim
index 273cfdb57..e1ffc954a 100644
--- a/lib/std/compilesettings.nim
+++ b/lib/std/compilesettings.nim
@@ -32,6 +32,7 @@ type
     backend           ## the backend (eg: c|cpp|objc|js); both `nim doc --backend:js`
                       ## and `nim js` would imply backend=js
     libPath           ## the absolute path to the stdlib library, i.e. nim's `--lib`, since 1.5.1
+    gc                ## gc selected
 
   MultipleValueSetting* {.pure.} = enum ## \
                       ## settings resulting in a seq of string values
diff --git a/testament/testament.nim b/testament/testament.nim
index 789c987c0..ab6620c84 100644
--- a/testament/testament.nim
+++ b/testament/testament.nim
@@ -108,8 +108,7 @@ proc isSuccess(input: string): bool =
   # that may appear in user config (eg: `--filenames`).
   # Passing `XDG_CONFIG_HOME= testament args...` can be used to ignore user config
   # stored in XDG_CONFIG_HOME, refs https://wiki.archlinux.org/index.php/XDG_Base_Directory
-  input.startsWith("Hint: ") and
-    (input.endsWith("[SuccessX]") or input.endsWith("[BuildMode]"))
+  input.startsWith("Hint: ") and input.endsWith("[SuccessX]")
 
 proc getFileDir(filename: string): string =
   result = filename.splitFile().dir
diff --git a/tests/misc/trunner.nim b/tests/misc/trunner.nim
index b6b302836..f2ea1d040 100644
--- a/tests/misc/trunner.nim
+++ b/tests/misc/trunner.nim
@@ -23,7 +23,7 @@ proc isDots(a: string): bool =
   a.startsWith(".") and a.strip(chars = {'.'}) == ""
 
 const
-  defaultHintsOff = "--hint:successx:off --hint:buildmode:off --hint:exec:off --hint:link:off --hint:cc:off --hint:conf:off --hint:processing:off --hint:QuitCalled:off"
+  defaultHintsOff = "--hint:successx:off --hint:exec:off --hint:link:off --hint:cc:off --hint:conf:off --hint:processing:off --hint:QuitCalled:off"
     # useful when you want to turn only some hints on, and some common ones off.
     # pending https://github.com/timotheecour/Nim/issues/453, simplify to: `--hints:off`
   nim = getCurrentCompilerExe()