mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
add --processing:dots|filenames|off to customize hintProcessing (#17817)
This commit is contained in:
@@ -1018,7 +1018,7 @@ proc genTypeInfoAuxBase(m: BModule; typ, origType: PType;
|
||||
var flags = 0
|
||||
if not containsGarbageCollectedRef(typ): flags = flags or 1
|
||||
if not canFormAcycle(typ): flags = flags or 2
|
||||
#else MessageOut("can contain a cycle: " & typeToString(typ))
|
||||
#else echo("can contain a cycle: " & typeToString(typ))
|
||||
if flags != 0:
|
||||
m.s[cfsTypeInit3].addf("$1.flags = $2;$n", [nameHcr, rope(flags)])
|
||||
discard cgsym(m, "TNimType")
|
||||
|
||||
@@ -900,6 +900,16 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
|
||||
of "canonical": conf.filenameOption = foCanonical
|
||||
of "legacyrelproj": conf.filenameOption = foLegacyRelProj
|
||||
else: localError(conf, info, "expected: abs|canonical|legacyRelProj, got: $1" % arg)
|
||||
of "processing":
|
||||
incl(conf.notes, hintProcessing)
|
||||
incl(conf.mainPackageNotes, hintProcessing)
|
||||
case arg.normalize
|
||||
of "dots": conf.hintProcessingDots = true
|
||||
of "filenames": conf.hintProcessingDots = false
|
||||
of "off":
|
||||
excl(conf.notes, hintProcessing)
|
||||
excl(conf.mainPackageNotes, hintProcessing)
|
||||
else: localError(conf, info, "expected: dots|filenames|off, got: $1" % arg)
|
||||
of "listfullpaths":
|
||||
# xxx in future work, use `warningDeprecated`
|
||||
conf.filenameOption = if switchOn(arg): foAbs else: foCanonical
|
||||
|
||||
@@ -545,7 +545,7 @@ proc liMessage*(conf: ConfigRef; info: TLineInfo, msg: TMsgKind, arg: string,
|
||||
if conf.structuredErrorHook != nil:
|
||||
conf.structuredErrorHook(conf, info, s & kindmsg, sev)
|
||||
if not ignoreMsgBecauseOfIdeTools(conf, msg):
|
||||
if msg == hintProcessing:
|
||||
if msg == hintProcessing and conf.hintProcessingDots:
|
||||
msgWrite(conf, ".")
|
||||
else:
|
||||
styledMsgWriteln(styleBright, loc, resetStyle, color, title, resetStyle, s, KindColor, kindmsg,
|
||||
|
||||
@@ -287,6 +287,7 @@ type
|
||||
implicitCmd*: bool # whether some flag triggered an implicit `command`
|
||||
selectedGC*: TGCMode # the selected GC (+)
|
||||
exc*: ExceptionSystem
|
||||
hintProcessingDots*: bool # true for dots, false for filenames
|
||||
verbosity*: int # how verbose the compiler is
|
||||
numberOfProcessors*: int # number of processors
|
||||
lastCmdTime*: float # when caas is enabled, we measure each command
|
||||
@@ -458,20 +459,25 @@ proc isDefined*(conf: ConfigRef; symbol: string): bool
|
||||
when defined(nimDebugUtils):
|
||||
import debugutils
|
||||
|
||||
proc initConfigRefCommon(conf: ConfigRef) =
|
||||
conf.selectedGC = gcRefc
|
||||
conf.verbosity = 1
|
||||
conf.hintProcessingDots = true
|
||||
conf.options = DefaultOptions
|
||||
conf.globalOptions = DefaultGlobalOptions
|
||||
conf.filenameOption = foAbs
|
||||
conf.foreignPackageNotes = foreignPackageNotesDefault
|
||||
conf.notes = NotesVerbosity[1]
|
||||
conf.mainPackageNotes = NotesVerbosity[1]
|
||||
|
||||
proc newConfigRef*(): ConfigRef =
|
||||
result = ConfigRef(
|
||||
selectedGC: gcRefc,
|
||||
cCompiler: ccGcc,
|
||||
verbosity: 1,
|
||||
options: DefaultOptions,
|
||||
globalOptions: DefaultGlobalOptions,
|
||||
macrosToExpand: newStringTable(modeStyleInsensitive),
|
||||
arcToExpand: newStringTable(modeStyleInsensitive),
|
||||
m: initMsgConfig(),
|
||||
filenameOption: foAbs,
|
||||
cppDefines: initHashSet[string](),
|
||||
headerFile: "", features: {}, legacyFeatures: {}, foreignPackageNotes: foreignPackageNotesDefault,
|
||||
notes: NotesVerbosity[1], mainPackageNotes: NotesVerbosity[1],
|
||||
headerFile: "", features: {}, legacyFeatures: {},
|
||||
configVars: newStringTable(modeStyleInsensitive),
|
||||
symbols: newStringTable(modeStyleInsensitive),
|
||||
packageCache: newPackageCache(),
|
||||
@@ -513,6 +519,7 @@ proc newConfigRef*(): ConfigRef =
|
||||
vmProfileData: newProfileData(),
|
||||
spellSuggestMax: spellSuggestSecretSauce,
|
||||
)
|
||||
initConfigRefCommon(result)
|
||||
setTargetFromSystem(result.target)
|
||||
# enable colors by default on terminals
|
||||
if terminal.isatty(stderr):
|
||||
@@ -522,18 +529,11 @@ proc newConfigRef*(): ConfigRef =
|
||||
|
||||
proc newPartialConfigRef*(): ConfigRef =
|
||||
## create a new ConfigRef that is only good enough for error reporting.
|
||||
# xxx FACTOR with `newConfigRef`
|
||||
when defined(nimDebugUtils):
|
||||
result = getConfigRef()
|
||||
else:
|
||||
result = ConfigRef(
|
||||
selectedGC: gcRefc,
|
||||
verbosity: 1,
|
||||
options: DefaultOptions,
|
||||
globalOptions: DefaultGlobalOptions,
|
||||
filenameOption: foAbs,
|
||||
foreignPackageNotes: foreignPackageNotesDefault,
|
||||
notes: NotesVerbosity[1], mainPackageNotes: NotesVerbosity[1])
|
||||
result = ConfigRef()
|
||||
initConfigRefCommon(result)
|
||||
|
||||
proc cppDefine*(c: ConfigRef; define: string) =
|
||||
c.cppDefines.incl define
|
||||
|
||||
@@ -19,9 +19,10 @@ type
|
||||
config: ConfigRef
|
||||
|
||||
proc verboseOpen(graph: ModuleGraph; s: PSym; idgen: IdGenerator): PPassContext =
|
||||
#MessageOut('compiling ' + s.name.s);
|
||||
result = VerboseRef(config: graph.config, idgen: idgen)
|
||||
rawMessage(graph.config, hintProcessing, s.name.s)
|
||||
let conf = graph.config
|
||||
result = VerboseRef(config: conf, idgen: idgen)
|
||||
let path = toFilenameOption(conf, s.position.FileIndex, conf.filenameOption)
|
||||
rawMessage(conf, hintProcessing, path)
|
||||
|
||||
proc verboseProcess(context: PPassContext, n: PNode): PNode =
|
||||
result = n
|
||||
|
||||
Reference in New Issue
Block a user