diff options
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/condsyms.nim | 1 | ||||
-rw-r--r-- | compiler/modules.nim | 1 | ||||
-rw-r--r-- | compiler/pragmas.nim | 2 | ||||
-rw-r--r-- | compiler/renderer.nim | 5 | ||||
-rw-r--r-- | compiler/sem.nim | 3 |
5 files changed, 9 insertions, 3 deletions
diff --git a/compiler/condsyms.nim b/compiler/condsyms.nim index ce295c8b9..15a625472 100644 --- a/compiler/condsyms.nim +++ b/compiler/condsyms.nim @@ -97,3 +97,4 @@ proc initDefines*(symbols: StringTableRef) = defineSymbol("nimFixedOwned") defineSymbol("nimHasStyleChecks") + defineSymbol("nimHasUsed") diff --git a/compiler/modules.nim b/compiler/modules.nim index 13845e6e9..02b4d8ac4 100644 --- a/compiler/modules.nim +++ b/compiler/modules.nim @@ -50,7 +50,6 @@ proc partialInitModule(result: PSym; graph: ModuleGraph; fileIdx: FileIndex; fil setLen(graph.modules, int(fileIdx) + 1) graph.modules[result.position] = result - incl(result.flags, sfUsed) initStrTable(result.tab) strTableAdd(result.tab, result) # a module knows itself strTableAdd(packSym.tab, result) diff --git a/compiler/pragmas.nim b/compiler/pragmas.nim index 9e3976e73..12b0cff87 100644 --- a/compiler/pragmas.nim +++ b/compiler/pragmas.nim @@ -49,7 +49,7 @@ const wDeprecated, wFloatChecks, wInfChecks, wNanChecks, wPragma, wEmit, wUnroll, wLinearScanEnd, wPatterns, wTrMacros, wEffects, wNoForward, wReorder, wComputedGoto, - wInjectStmt, wDeprecated, wExperimental, wThis} + wInjectStmt, wDeprecated, wExperimental, wThis, wUsed} lambdaPragmas* = {FirstCallConv..LastCallConv, wImportc, wExportc, wNodecl, wNoSideEffect, wSideEffect, wNoreturn, wDynlib, wHeader, wDeprecated, wExtern, wThread, wImportCpp, wImportObjC, wAsmNoStackFrame, diff --git a/compiler/renderer.nim b/compiler/renderer.nim index cfc414aaf..dfe66de03 100644 --- a/compiler/renderer.nim +++ b/compiler/renderer.nim @@ -9,6 +9,11 @@ # This module implements the renderer of the standard Nim representation. +when defined(nimHasUsed): + # 'import renderer' is so useful for debugging + # that Nim shouldn't produce a warning for that: + {.used.} + import lexer, options, idents, strutils, ast, msgs, lineinfos diff --git a/compiler/sem.nim b/compiler/sem.nim index 119393e25..a13fd138b 100644 --- a/compiler/sem.nim +++ b/compiler/sem.nim @@ -614,7 +614,8 @@ proc myProcess(context: PPassContext, n: PNode): PNode = proc reportUnusedModules(c: PContext) = for i in 0..high(c.unusedImports): - message(c.config, c.unusedImports[i][1], warnUnusedImportX, c.unusedImports[i][0].name.s) + if sfUsed notin c.unusedImports[i][0].flags: + message(c.config, c.unusedImports[i][1], warnUnusedImportX, c.unusedImports[i][0].name.s) proc myClose(graph: ModuleGraph; context: PPassContext, n: PNode): PNode = var c = PContext(context) |