From d568ac335751d9caa6dd6118a13b1ee856d402e3 Mon Sep 17 00:00:00 2001 From: Adam Strzelecki Date: Sat, 6 Jun 2015 11:34:27 +0200 Subject: [PATCH] Turn optPrintSurroundingSrc into hintSource So surrounding source printing can be enabled for lower verbosity levels explicitly. --- compiler/msgs.nim | 13 +++++++++---- compiler/options.nim | 3 --- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/compiler/msgs.nim b/compiler/msgs.nim index 3a23d4671..175434c83 100644 --- a/compiler/msgs.nim +++ b/compiler/msgs.nim @@ -127,6 +127,7 @@ type hintProcessing, hintCodeBegin, hintCodeEnd, hintConf, hintPath, hintConditionAlwaysTrue, hintName, hintPattern, hintExecuting, hintLinking, hintDependency, + hintSource, hintUser const @@ -420,6 +421,7 @@ const hintExecuting: "$1", hintLinking: "", hintDependency: "$1", + hintSource: "$1", hintUser: "$1"] const @@ -435,10 +437,11 @@ const "ProveInit", "ProveField", "ProveIndex", "GcUnsafe", "GcUnsafe2", "Uninit", "GcMem", "Destructor", "LockLevel", "ResultShadowed", "User"] - HintsToStr*: array[0..19, string] = ["Success", "SuccessX", "LineTooLong", + HintsToStr*: array[0..20, string] = ["Success", "SuccessX", "LineTooLong", "XDeclaredButNotUsed", "ConvToBaseNotNeeded", "ConvFromXtoItselfNotNeeded", "ExprAlwaysX", "QuitCalled", "Processing", "CodeBegin", "CodeEnd", "Conf", "Path", "CondTrue", "Name", "Pattern", "Exec", "Link", "Dependency", + "Source", "User"] const @@ -498,13 +501,15 @@ const hintProcessing, hintDependency, hintExecuting, hintLinking, - hintCodeBegin, hintCodeEnd}, + hintCodeBegin, hintCodeEnd, + hintSource}, {low(TNoteKind)..high(TNoteKind)} - {warnShadowIdent, warnUninit, warnProveField, warnProveIndex, warnGcUnsafe, hintDependency, hintExecuting, - hintCodeBegin, hintCodeEnd}, + hintCodeBegin, hintCodeEnd, + hintSource}, {low(TNoteKind)..high(TNoteKind)}, {low(TNoteKind)..high(TNoteKind)}] @@ -912,7 +917,7 @@ proc liMessage(info: TLineInfo, msg: TMsgKind, arg: string, KindColor, `%`(KindFormat, kind)) else: styledMsgWriteln(styleBright, x, resetStyle, color, title, resetStyle, s) - if optPrintSurroundingSrc and msg in errMin..errMax: + if msg in errMin..errMax and hintSource in gNotes: info.writeSurroundingSrc handleError(msg, eh, s) diff --git a/compiler/options.nim b/compiler/options.nim index bc70cd657..f312c877c 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -127,9 +127,6 @@ template compilationCachePresent*: expr = template optPreserveOrigSource*: expr = optEmbedOrigSrc in gGlobalOptions -template optPrintSurroundingSrc*: expr = - gVerbosity >= 2 - const genSubDir* = "nimcache" NimExt* = "nim"