From 1c1afd73eb1a78c4ee6fae692f3fe35c0352efa1 Mon Sep 17 00:00:00 2001 From: Timothee Cour Date: Sat, 29 Feb 2020 16:54:35 -0800 Subject: [PATCH] fix #13218: avoid some irrelevant warnings for nim doc,rst2html --- compiler/main.nim | 2 ++ compiler/options.nim | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/compiler/main.nim b/compiler/main.nim index c8bdc94475660..e573f77cb5b10 100644 --- a/compiler/main.nim +++ b/compiler/main.nim @@ -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: @@ -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: diff --git a/compiler/options.nim b/compiler/options.nim index c93fc06484e44..78d04f1072f2c 100644 --- a/compiler/options.nim +++ b/compiler/options.nim @@ -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)