Skip to content

Commit 9bb1ce6

Browse files
committed
fixup
1 parent 49d9f72 commit 9bb1ce6

File tree

7 files changed

+36
-23
lines changed

7 files changed

+36
-23
lines changed

changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,8 @@
343343

344344
- Added `--filenames:abs|canonical|magic` which replaces --listFullPaths:on|off
345345

346+
- Added `--processing:dots|filenames|off` which customizes `hintProcessing`
347+
346348
- Source+Edit links now appear on top of every docgen'd page when
347349
`nim doc --git.url:url ...` is given.
348350

compiler/ccgtypes.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ proc genTypeInfoAuxBase(m: BModule; typ, origType: PType;
10181018
var flags = 0
10191019
if not containsGarbageCollectedRef(typ): flags = flags or 1
10201020
if not canFormAcycle(typ): flags = flags or 2
1021-
#else MessageOut("can contain a cycle: " & typeToString(typ))
1021+
#else echo("can contain a cycle: " & typeToString(typ))
10221022
if flags != 0:
10231023
m.s[cfsTypeInit3].addf("$1.flags = $2;$n", [nameHcr, rope(flags)])
10241024
discard cgsym(m, "TNimType")

compiler/commands.nim

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,16 @@ proc processSwitch*(switch, arg: string, pass: TCmdLinePass, info: TLineInfo;
900900
of "canonical": conf.filenameOption = foCanonical
901901
of "legacyrelproj": conf.filenameOption = foLegacyRelProj
902902
else: localError(conf, info, "expected: abs|canonical|legacyRelProj, got: $1" % arg)
903+
of "processing":
904+
incl(conf.notes, hintProcessing)
905+
incl(conf.mainPackageNotes, hintProcessing)
906+
case arg.normalize
907+
of "dots": conf.hintProcessingDots = true
908+
of "filenames": conf.hintProcessingDots = false
909+
of "off":
910+
excl(conf.notes, hintProcessing)
911+
excl(conf.mainPackageNotes, hintProcessing)
912+
else: localError(conf, info, "expected: dots|filenames|off, got: $1" % arg)
903913
of "listfullpaths":
904914
# xxx in future work, use `warningDeprecated`
905915
conf.filenameOption = if switchOn(arg): foAbs else: foCanonical

compiler/msgs.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -545,7 +545,7 @@ proc liMessage*(conf: ConfigRef; info: TLineInfo, msg: TMsgKind, arg: string,
545545
if conf.structuredErrorHook != nil:
546546
conf.structuredErrorHook(conf, info, s & kindmsg, sev)
547547
if not ignoreMsgBecauseOfIdeTools(conf, msg):
548-
if msg == hintProcessing:
548+
if msg == hintProcessing and conf.hintProcessingDots:
549549
msgWrite(conf, ".")
550550
else:
551551
styledMsgWriteln(styleBright, loc, resetStyle, color, title, resetStyle, s, KindColor, kindmsg,

compiler/options.nim

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,7 @@ type
287287
implicitCmd*: bool # whether some flag triggered an implicit `command`
288288
selectedGC*: TGCMode # the selected GC (+)
289289
exc*: ExceptionSystem
290+
hintProcessingDots*: bool # true for dots, false for filenames
290291
verbosity*: int # how verbose the compiler is
291292
numberOfProcessors*: int # number of processors
292293
lastCmdTime*: float # when caas is enabled, we measure each command
@@ -458,20 +459,25 @@ proc isDefined*(conf: ConfigRef; symbol: string): bool
458459
when defined(nimDebugUtils):
459460
import debugutils
460461

462+
proc initConfigRefCommon(conf: ConfigRef) =
463+
conf.selectedGC = gcRefc
464+
conf.verbosity = 1
465+
conf.hintProcessingDots = true
466+
conf.options = DefaultOptions
467+
conf.globalOptions = DefaultGlobalOptions
468+
conf.filenameOption = foAbs
469+
conf.foreignPackageNotes = foreignPackageNotesDefault
470+
conf.notes = NotesVerbosity[1]
471+
conf.mainPackageNotes = NotesVerbosity[1]
472+
461473
proc newConfigRef*(): ConfigRef =
462474
result = ConfigRef(
463-
selectedGC: gcRefc,
464475
cCompiler: ccGcc,
465-
verbosity: 1,
466-
options: DefaultOptions,
467-
globalOptions: DefaultGlobalOptions,
468476
macrosToExpand: newStringTable(modeStyleInsensitive),
469477
arcToExpand: newStringTable(modeStyleInsensitive),
470478
m: initMsgConfig(),
471-
filenameOption: foAbs,
472479
cppDefines: initHashSet[string](),
473-
headerFile: "", features: {}, legacyFeatures: {}, foreignPackageNotes: foreignPackageNotesDefault,
474-
notes: NotesVerbosity[1], mainPackageNotes: NotesVerbosity[1],
480+
headerFile: "", features: {}, legacyFeatures: {},
475481
configVars: newStringTable(modeStyleInsensitive),
476482
symbols: newStringTable(modeStyleInsensitive),
477483
packageCache: newPackageCache(),
@@ -513,6 +519,7 @@ proc newConfigRef*(): ConfigRef =
513519
vmProfileData: newProfileData(),
514520
spellSuggestMax: spellSuggestSecretSauce,
515521
)
522+
initConfigRefCommon(result)
516523
setTargetFromSystem(result.target)
517524
# enable colors by default on terminals
518525
if terminal.isatty(stderr):
@@ -522,18 +529,11 @@ proc newConfigRef*(): ConfigRef =
522529

523530
proc newPartialConfigRef*(): ConfigRef =
524531
## create a new ConfigRef that is only good enough for error reporting.
525-
# xxx FACTOR with `newConfigRef`
526532
when defined(nimDebugUtils):
527533
result = getConfigRef()
528534
else:
529-
result = ConfigRef(
530-
selectedGC: gcRefc,
531-
verbosity: 1,
532-
options: DefaultOptions,
533-
globalOptions: DefaultGlobalOptions,
534-
filenameOption: foAbs,
535-
foreignPackageNotes: foreignPackageNotesDefault,
536-
notes: NotesVerbosity[1], mainPackageNotes: NotesVerbosity[1])
535+
result = ConfigRef()
536+
initConfigRefCommon(result)
537537

538538
proc cppDefine*(c: ConfigRef; define: string) =
539539
c.cppDefines.incl define

compiler/passaux.nim

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ type
1919
config: ConfigRef
2020

2121
proc verboseOpen(graph: ModuleGraph; s: PSym; idgen: IdGenerator): PPassContext =
22-
#MessageOut('compiling ' + s.name.s);
23-
let flag = if optListFullPaths in graph.config.globalOptions: foAbs else: foShort
24-
let fname = graph.config.toFilenameOption(s.position.FileIndex, flag)
25-
result = VerboseRef(config: graph.config, idgen: idgen)
26-
rawMessage(graph.config, hintProcessing, fname)
22+
let conf = graph.config
23+
result = VerboseRef(config: conf, idgen: idgen)
24+
let path = toFilenameOption(conf, s.position.FileIndex, conf.filenameOption)
25+
rawMessage(conf, hintProcessing, path)
2726

2827
proc verboseProcess(context: PPassContext, n: PNode): PNode =
2928
result = n

doc/advopt.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ Advanced options:
3939
--filenames:abs|canonical|legacyRelProj
4040
customize how filenames are rendered in compiler messages,
4141
defaults to `abs` (absolute)
42+
--processing:dots|filenames|off
43+
show files as they're being processed by nim compiler
4244
--declaredLocs:on|off show declaration locations in messages
4345
--spellSuggest|:num show at most `num >= 0` spelling suggestions on typos.
4446
if `num` is not specified (or `auto`), return

0 commit comments

Comments
 (0)