Skip to content

Commit

Permalink
fix nim-lang#13218: avoid some irrelevant warnings for nim doc,rst2html
Browse files Browse the repository at this point in the history
  • Loading branch information
timotheecour committed Mar 3, 2020
1 parent 31332bc commit 1c1afd7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions compiler/main.nim
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ proc mainCommand*(graph: ModuleGraph) =
loadConfigs(DocConfig, cache, conf)
commandDoc(cache, conf)
of "doc2", "doc":
conf.setNoteDefaults(warnLockLevel, false) # issue #13218
when defined(leanCompiler):
quit "compiler wasn't built with documentation generator"
else:
Expand All @@ -233,6 +234,7 @@ proc mainCommand*(graph: ModuleGraph) =
defineSymbol(conf.symbols, "nimdoc")
commandDoc2(graph, false)
of "rst2html":
conf.setNoteDefaults(warnRedefinitionOfLabel, false) # similar to issue #13218
when defined(leanCompiler):
quit "compiler wasn't built with documentation generator"
else:
Expand Down
8 changes: 8 additions & 0 deletions compiler/options.nim
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,15 @@ type
severity: Severity) {.closure, gcsafe.}
cppCustomNamespace*: string

proc setNoteDefaults*(conf: ConfigRef, note: TNoteKind, enabled = true) =
template fun(op) =
conf.notes.op note
conf.mainPackageNotes.op note
conf.foreignPackageNotes.op note
if enabled: fun(incl) else: fun(excl)

proc setNote*(conf: ConfigRef, note: TNoteKind, enabled = true) =
# see also `prepareConfigNotes` which sets notes
if note notin conf.cmdlineNotes:
if enabled: incl(conf.notes, note) else: excl(conf.notes, note)

Expand Down

0 comments on commit 1c1afd7

Please sign in to comment.