Change to add a new BuildMode hint category and keep testament in sync

as per comment.
This commit is contained in:
Charles Blake
2021-04-27 09:01:54 -04:00
parent 6dafc5a0ae
commit 8c8512d61c
8 changed files with 17 additions and 10 deletions

View File

@@ -480,7 +480,7 @@ proc setCommandEarly*(conf: ConfigRef, command: string) =
# must be handled here to honor subsequent `--hint:x:on|off`
case conf.cmd
of cmdRst2html, cmdRst2tex: # xxx see whether to add others: cmdGendepend, etc.
conf.foreignPackageNotes = {hintSuccessX}
conf.foreignPackageNotes = {hintSuccessX, hintBuildMode}
else:
conf.foreignPackageNotes = foreignPackageNotesDefault

View File

@@ -64,7 +64,8 @@ type
warnFileChanged = "FileChanged",
warnUser = "User",
hintSuccess = "Success", hintSuccessX = "SuccessX", hintCC = "CC",
hintSuccess = "Success", hintSuccessX = "SuccessX", hintBuildMode = "BuildMode",
hintCC = "CC",
hintLineTooLong = "LineTooLong", hintXDeclaredButNotUsed = "XDeclaredButNotUsed",
hintXCannotRaiseY = "XCannotRaiseY", hintConvToBaseNotNeeded = "ConvToBaseNotNeeded",
hintConvFromXtoItselfNotNeeded = "ConvFromXtoItselfNotNeeded", hintExprAlwaysX = "ExprAlwaysX",
@@ -142,8 +143,8 @@ const
warnUser: "$1",
hintSuccess: "operation successful: $#",
# keep in sync with `testament.isSuccess`
hintSuccessX: """$loc lines; ${sec}s; $mem; proj: $project; out: $output
$build""",
hintSuccessX: "$loc lines; ${sec}s; $mem; proj: $project; out: $output",
hintBuildMode: "$build",
hintCC: "CC: $1",
hintLineTooLong: "line too long",
hintXDeclaredButNotUsed: "'$1' is declared but not used",
@@ -197,7 +198,7 @@ proc computeNotesVerbosity(): array[0..3, TNoteKinds] =
result[1] = result[2] - {warnProveField, warnProveIndex,
warnGcUnsafe, hintPath, hintDependency, hintCodeBegin, hintCodeEnd,
hintSource, hintGlobalVar, hintGCStats, hintMsgOrigin}
result[0] = result[1] - {hintSuccessX, hintSuccess, hintConf,
result[0] = result[1] - {hintSuccessX, hintBuildMode, hintSuccess, hintConf,
hintProcessing, hintPattern, hintExecuting, hintLinking, hintCC}
const

View File

@@ -406,10 +406,12 @@ proc mainCommand*(graph: ModuleGraph) =
"loc", loc,
"sec", sec,
"mem", mem,
"build", build,
"project", project,
"output", output,
])
rawMessage(conf, hintBuildMode, [
"build", build,
])
when PrintRopeCacheStats:
echo "rope cache stats: "

View File

@@ -102,6 +102,7 @@ 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.

View File

@@ -1219,10 +1219,12 @@ proc mainCommand(graph: ModuleGraph) =
"loc", loc,
"sec", sec,
"mem", mem,
"build", build,
"project", project,
"output", ""
])
rawMessage(conf, hintBuildMode, [
"build", build,
])
proc processCmdLine(pass: TCmdLinePass, cmd: string; config: ConfigRef) =
var p = parseopt.initOptParser(cmd)

View File

@@ -107,7 +107,8 @@ 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]")
input.startsWith("Hint: ") and
(input.endsWith("[SuccessX]") or input.endsWith("[BuildMode]"))
proc getFileDir(filename: string): string =
result = filename.splitFile().dir

View File

@@ -113,7 +113,7 @@ type
warnProveInit, warnProveField, warnProveIndex, warnGcUnsafe, warnGcUnsafe2,
warnUninit, warnGcMem, warnDestructor, warnLockLevel, warnResultShadowed,
warnUser,
hintSuccess, hintSuccessX,
hintSuccess, hintSuccessX, hintBuildMode,
hintLineTooLong, hintXDeclaredButNotUsed, hintConvToBaseNotNeeded,
hintConvFromXtoItselfNotNeeded, hintExprAlwaysX, hintQuitCalled,
hintProcessing, hintCodeBegin, hintCodeEnd, hintConf, hintPath,

View File

@@ -173,7 +173,7 @@ type
warnProveInit, warnProveField, warnProveIndex, warnGcUnsafe, warnGcUnsafe2,
warnUninit, warnGcMem, warnDestructor, warnLockLevel, warnResultShadowed,
warnUser,
hintSuccess, hintSuccessX,
hintSuccess, hintSuccessX, hintBuildMode,
hintLineTooLong, hintXDeclaredButNotUsed, hintConvToBaseNotNeeded,
hintConvFromXtoItselfNotNeeded, hintExprAlwaysX, hintQuitCalled,
hintProcessing, hintCodeBegin, hintCodeEnd, hintConf, hintPath,