List warnings & hints via --(hints|warnings):list
Hints and warnings can be now listed using --warnings:list and --hints:list printing names and checkboxes indicating which of these are enabled.
This commit is contained in:
parent
14e6ff6780
commit
592f867aa5
3 changed files with 38 additions and 5 deletions
|
|
@ -128,6 +128,18 @@ proc processOnOffSwitch(op: TOptions, arg: string, pass: TCmdLinePass,
|
||||||
of wOff: gOptions = gOptions - op
|
of wOff: gOptions = gOptions - op
|
||||||
else: localError(info, errOnOrOffExpectedButXFound, arg)
|
else: localError(info, errOnOrOffExpectedButXFound, arg)
|
||||||
|
|
||||||
|
proc processOnOffSwitchOrList(op: TOptions, arg: string, pass: TCmdLinePass,
|
||||||
|
info: TLineInfo): bool =
|
||||||
|
result = false
|
||||||
|
case whichKeyword(arg)
|
||||||
|
of wOn: gOptions = gOptions + op
|
||||||
|
of wOff: gOptions = gOptions - op
|
||||||
|
else:
|
||||||
|
if arg == "list":
|
||||||
|
result = true
|
||||||
|
else:
|
||||||
|
localError(info, errOnOffOrListExpectedButXFound, arg)
|
||||||
|
|
||||||
proc processOnOffSwitchG(op: TGlobalOptions, arg: string, pass: TCmdLinePass,
|
proc processOnOffSwitchG(op: TGlobalOptions, arg: string, pass: TCmdLinePass,
|
||||||
info: TLineInfo) =
|
info: TLineInfo) =
|
||||||
case whichKeyword(arg)
|
case whichKeyword(arg)
|
||||||
|
|
@ -382,10 +394,12 @@ proc processSwitch(switch, arg: string, pass: TCmdLinePass, info: TLineInfo) =
|
||||||
gSelectedGC = gcNone
|
gSelectedGC = gcNone
|
||||||
defineSymbol("nogc")
|
defineSymbol("nogc")
|
||||||
else: localError(info, errNoneBoehmRefcExpectedButXFound, arg)
|
else: localError(info, errNoneBoehmRefcExpectedButXFound, arg)
|
||||||
of "warnings", "w": processOnOffSwitch({optWarns}, arg, pass, info)
|
of "warnings", "w":
|
||||||
|
if processOnOffSwitchOrList({optWarns}, arg, pass, info): listWarnings()
|
||||||
of "warning": processSpecificNote(arg, wWarning, pass, info, switch)
|
of "warning": processSpecificNote(arg, wWarning, pass, info, switch)
|
||||||
of "hint": processSpecificNote(arg, wHint, pass, info, switch)
|
of "hint": processSpecificNote(arg, wHint, pass, info, switch)
|
||||||
of "hints": processOnOffSwitch({optHints}, arg, pass, info)
|
of "hints":
|
||||||
|
if processOnOffSwitchOrList({optHints}, arg, pass, info): listHints()
|
||||||
of "threadanalysis": processOnOffSwitchG({optThreadAnalysis}, arg, pass, info)
|
of "threadanalysis": processOnOffSwitchG({optThreadAnalysis}, arg, pass, info)
|
||||||
of "stacktrace": processOnOffSwitch({optStackTrace}, arg, pass, info)
|
of "stacktrace": processOnOffSwitch({optStackTrace}, arg, pass, info)
|
||||||
of "linetrace": processOnOffSwitch({optLineTrace}, arg, pass, info)
|
of "linetrace": processOnOffSwitch({optLineTrace}, arg, pass, info)
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,8 @@ type
|
||||||
errStmtInvalidAfterReturn, errStmtExpected, errInvalidLabel,
|
errStmtInvalidAfterReturn, errStmtExpected, errInvalidLabel,
|
||||||
errInvalidCmdLineOption, errCmdLineArgExpected, errCmdLineNoArgExpected,
|
errInvalidCmdLineOption, errCmdLineArgExpected, errCmdLineNoArgExpected,
|
||||||
errInvalidVarSubstitution, errUnknownVar, errUnknownCcompiler,
|
errInvalidVarSubstitution, errUnknownVar, errUnknownCcompiler,
|
||||||
errOnOrOffExpectedButXFound, errNoneBoehmRefcExpectedButXFound,
|
errOnOrOffExpectedButXFound, errOnOffOrListExpectedButXFound,
|
||||||
|
errNoneBoehmRefcExpectedButXFound,
|
||||||
errNoneSpeedOrSizeExpectedButXFound, errGuiConsoleOrLibExpectedButXFound,
|
errNoneSpeedOrSizeExpectedButXFound, errGuiConsoleOrLibExpectedButXFound,
|
||||||
errUnknownOS, errUnknownCPU, errGenOutExpectedButXFound,
|
errUnknownOS, errUnknownCPU, errGenOutExpectedButXFound,
|
||||||
errArgsNeedRunOption, errInvalidMultipleAsgn, errColonOrEqualsExpected,
|
errArgsNeedRunOption, errInvalidMultipleAsgn, errColonOrEqualsExpected,
|
||||||
|
|
@ -181,6 +182,7 @@ const
|
||||||
errUnknownVar: "unknown variable: \'$1\'",
|
errUnknownVar: "unknown variable: \'$1\'",
|
||||||
errUnknownCcompiler: "unknown C compiler: \'$1\'",
|
errUnknownCcompiler: "unknown C compiler: \'$1\'",
|
||||||
errOnOrOffExpectedButXFound: "\'on\' or \'off\' expected, but \'$1\' found",
|
errOnOrOffExpectedButXFound: "\'on\' or \'off\' expected, but \'$1\' found",
|
||||||
|
errOnOffOrListExpectedButXFound: "\'on\', \'off\' or \'list\' expected, but \'$1\' found",
|
||||||
errNoneBoehmRefcExpectedButXFound: "'none', 'boehm' or 'refc' expected, but '$1' found",
|
errNoneBoehmRefcExpectedButXFound: "'none', 'boehm' or 'refc' expected, but '$1' found",
|
||||||
errNoneSpeedOrSizeExpectedButXFound: "'none', 'speed' or 'size' expected, but '$1' found",
|
errNoneSpeedOrSizeExpectedButXFound: "'none', 'speed' or 'size' expected, but '$1' found",
|
||||||
errGuiConsoleOrLibExpectedButXFound: "'gui', 'console' or 'lib' expected, but '$1' found",
|
errGuiConsoleOrLibExpectedButXFound: "'gui', 'console' or 'lib' expected, but '$1' found",
|
||||||
|
|
@ -973,6 +975,22 @@ ropes.errorHandler = proc (err: RopesError, msg: string, useWarning: bool) =
|
||||||
of rCannotOpenFile:
|
of rCannotOpenFile:
|
||||||
rawMessage(if useWarning: warnCannotOpenFile else: errCannotOpenFile, msg)
|
rawMessage(if useWarning: warnCannotOpenFile else: errCannotOpenFile, msg)
|
||||||
|
|
||||||
|
proc listWarnings*() =
|
||||||
|
msgWriteln("Warnings:")
|
||||||
|
for warn in warnMin..warnMax:
|
||||||
|
msgWriteln(" [$1] $2" % [
|
||||||
|
if warn in gNotes: "x" else: " ",
|
||||||
|
msgs.WarningsToStr[ord(warn) - ord(warnMin)]
|
||||||
|
])
|
||||||
|
|
||||||
|
proc listHints*() =
|
||||||
|
msgWriteln("Hints:")
|
||||||
|
for hint in hintMin..hintMax:
|
||||||
|
msgWriteln(" [$1] $2" % [
|
||||||
|
if hint in gNotes: "x" else: " ",
|
||||||
|
msgs.HintsToStr[ord(hint) - ord(hintMin)]
|
||||||
|
])
|
||||||
|
|
||||||
# enable colors by default on terminals
|
# enable colors by default on terminals
|
||||||
if terminal.isatty(stdout):
|
if terminal.isatty(stdout):
|
||||||
incl(gGlobalOptions, optUseColors)
|
incl(gGlobalOptions, optUseColors)
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,10 @@ Advanced options:
|
||||||
--stdout output to stdout
|
--stdout output to stdout
|
||||||
--colors:on|off turn compiler messages coloring on|off
|
--colors:on|off turn compiler messages coloring on|off
|
||||||
--listFullPaths list full paths in messages
|
--listFullPaths list full paths in messages
|
||||||
-w, --warnings:on|off turn all warnings on|off
|
-w:on|off|list, --warnings:on|off|list
|
||||||
|
turn all warnings on|off or list all available
|
||||||
--warning[X]:on|off turn specific warning X on|off
|
--warning[X]:on|off turn specific warning X on|off
|
||||||
--hints:on|off turn all hints on|off
|
--hints:on|off|list turn all hints on|off or list all available
|
||||||
--hint[X]:on|off turn specific hint X on|off
|
--hint[X]:on|off turn specific hint X on|off
|
||||||
--lib:PATH set the system library path
|
--lib:PATH set the system library path
|
||||||
--import:PATH add an automatically imported module
|
--import:PATH add an automatically imported module
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue