summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAdam Strzelecki <ono@java.pl>2015-06-06 11:17:50 +0200
committerAdam Strzelecki <ono@java.pl>2015-07-03 14:05:00 +0200
commit18b3d0429186eead448d320612d33387c3e10085 (patch)
treef430b36f1d4d5802f48502a5505afe655ca1980f
parent592f867aa54b0a666532d550218428ea4a414342 (diff)
downloadNim-18b3d0429186eead448d320612d33387c3e10085.tar.gz
Turn execExternalProgram msgs into hintExecuting
Or hintLinking that is used on verbosity:1. This lets you treat this message as
regular hint, and control it via command line.
-rw-r--r--compiler/extccomp.nim18
-rw-r--r--compiler/msgs.nim9
2 files changed, 13 insertions, 14 deletions
diff --git a/compiler/extccomp.nim b/compiler/extccomp.nim
index 8d3260275..40d25ab2e 100644
--- a/compiler/extccomp.nim
+++ b/compiler/extccomp.nim
@@ -438,16 +438,12 @@ proc addFileToLink*(filename: string) =
   prependStr(toLink, filename)
   # BUGFIX: was ``appendStr``
 
-proc execWithEcho(cmd: string, prettyCmd = ""): int =
-  if optListCmd in gGlobalOptions or gVerbosity > 0:
-    if prettyCmd != "":
-      msgWriteln(prettyCmd)
-    else:
-      msgWriteln(cmd)
+proc execWithEcho(cmd: string, msg = hintExecuting): int =
+  rawMessage(msg, cmd)
   result = execCmd(cmd)
 
-proc execExternalProgram*(cmd: string, prettyCmd = "") =
-  if execWithEcho(cmd, prettyCmd) != 0:
+proc execExternalProgram*(cmd: string, msg = hintExecuting) =
+  if execWithEcho(cmd, msg) != 0:
     rawMessage(errExecutionOfProgramFailed, "")
 
 proc generateScript(projectFile: string, script: Rope) =
@@ -703,10 +699,8 @@ proc callCCompiler*(projectfile: string) =
           "nim", quoteShell(getPrefixDir()),
           "lib", quoteShell(libpath)])
     if optCompileOnly notin gGlobalOptions:
-      if gVerbosity == 1:
-        execExternalProgram(linkCmd, "[Linking]")
-      else:
-        execExternalProgram(linkCmd)
+      execExternalProgram(linkCmd,
+                          if gVerbosity > 1: hintExecuting else: hintLinking)
   else:
     linkCmd = ""
   if optGenScript in gGlobalOptions:
diff --git a/compiler/msgs.nim b/compiler/msgs.nim
index fbc73ef15..20a59a132 100644
--- a/compiler/msgs.nim
+++ b/compiler/msgs.nim
@@ -126,6 +126,7 @@ type
     hintConvFromXtoItselfNotNeeded, hintExprAlwaysX, hintQuitCalled,
     hintProcessing, hintCodeBegin, hintCodeEnd, hintConf, hintPath,
     hintConditionAlwaysTrue, hintName, hintPattern,
+    hintExecuting, hintLinking,
     hintUser
 
 const
@@ -416,6 +417,8 @@ const
     hintConditionAlwaysTrue: "condition is always true: '$1'",
     hintName: "name should be: '$1'",
     hintPattern: "$1",
+    hintExecuting: "$1",
+    hintLinking: "",
     hintUser: "$1"]
 
 const
@@ -431,10 +434,10 @@ const
     "ProveInit", "ProveField", "ProveIndex", "GcUnsafe", "GcUnsafe2", "Uninit",
     "GcMem", "Destructor", "LockLevel", "ResultShadowed", "User"]
 
-  HintsToStr*: array[0..16, string] = ["Success", "SuccessX", "LineTooLong",
+  HintsToStr*: array[0..18, string] = ["Success", "SuccessX", "LineTooLong",
     "XDeclaredButNotUsed", "ConvToBaseNotNeeded", "ConvFromXtoItselfNotNeeded",
     "ExprAlwaysX", "QuitCalled", "Processing", "CodeBegin", "CodeEnd", "Conf",
-    "Path", "CondTrue", "Name", "Pattern",
+    "Path", "CondTrue", "Name", "Pattern", "Exec", "Link",
     "User"]
 
 const
@@ -492,10 +495,12 @@ const
                                          warnGcUnsafe,
                                          hintSuccessX, hintPath, hintConf,
                                          hintProcessing,
+                                         hintExecuting, hintLinking,
                                          hintCodeBegin, hintCodeEnd},
     {low(TNoteKind)..high(TNoteKind)} - {warnShadowIdent, warnUninit,
                                          warnProveField, warnProveIndex,
                                          warnGcUnsafe,
+                                         hintExecuting,
                                          hintCodeBegin, hintCodeEnd},
     {low(TNoteKind)..high(TNoteKind)},
     {low(TNoteKind)..high(TNoteKind)}]