summary refs log tree commit diff stats
path: root/compiler/msgs.nim
diff options
context:
space:
mode:
authorAraq <rumpf_a@web.de>2013-06-04 21:58:39 +0200
committerAraq <rumpf_a@web.de>2013-06-04 21:58:39 +0200
commit2aaa8f7909e51eb3d971e197f152e247c64362e9 (patch)
treedef61be7039f3154d61efca75f996c7e1ccdf1cf /compiler/msgs.nim
parentf7c0cc976ddb4e86e2341352b0674b9787005a4a (diff)
downloadNim-2aaa8f7909e51eb3d971e197f152e247c64362e9.tar.gz
implemented dataflow analysis; activate via --warning[Uninit]:on
Diffstat (limited to 'compiler/msgs.nim')
-rw-r--r--compiler/msgs.nim11
1 files changed, 7 insertions, 4 deletions
diff --git a/compiler/msgs.nim b/compiler/msgs.nim
index 16ef06b61..f75aec0d5 100644
--- a/compiler/msgs.nim
+++ b/compiler/msgs.nim
@@ -106,7 +106,7 @@ type
     warnUnknownSubstitutionX, warnLanguageXNotSupported, warnCommentXIgnored, 
     warnNilStatement, warnAnalysisLoophole,
     warnDifferentHeaps, warnWriteToForeignHeap, warnImplicitClosure,
-    warnEachIdentIsTuple, warnShadowIdent, warnUser,
+    warnEachIdentIsTuple, warnShadowIdent, warnUninit, warnUser,
     hintSuccess, hintSuccessX, 
     hintLineTooLong, hintXDeclaredButNotUsed, hintConvToBaseNotNeeded, 
     hintConvFromXtoItselfNotNeeded, hintExprAlwaysX, hintQuitCalled, 
@@ -355,6 +355,7 @@ const
     warnImplicitClosure: "implicit closure convention: '$1' [ImplicitClosure]",
     warnEachIdentIsTuple: "each identifier is a tuple [EachIdentIsTuple]",
     warnShadowIdent: "shadowed identifier: '$1' [ShadowIdent]",
+    warnUninit: "read from potentially uninitialized variable: '$1' [Uninit]",
     warnUser: "$1 [User]", 
     hintSuccess: "operation successful [Success]", 
     hintSuccessX: "operation successful ($# lines compiled; $# sec total; $#) [SuccessX]", 
@@ -374,14 +375,15 @@ const
     hintUser: "$1 [User]"]
 
 const
-  WarningsToStr*: array[0..19, string] = ["CannotOpenFile", "OctalEscape", 
+  WarningsToStr*: array[0..20, string] = ["CannotOpenFile", "OctalEscape", 
     "XIsNeverRead", "XmightNotBeenInit",
     "Deprecated", "ConfigDeprecated",
     "SmallLshouldNotBeUsed", "UnknownMagic", 
     "RedefinitionOfLabel", "UnknownSubstitutionX", "LanguageXNotSupported", 
     "CommentXIgnored", "NilStmt",
     "AnalysisLoophole", "DifferentHeaps", "WriteToForeignHeap",
-    "ImplicitClosure", "EachIdentIsTuple", "ShadowIdent", "User"]
+    "ImplicitClosure", "EachIdentIsTuple", "ShadowIdent", "Uninit",
+    "User"]
 
   HintsToStr*: array[0..15, string] = ["Success", "SuccessX", "LineTooLong", 
     "XDeclaredButNotUsed", "ConvToBaseNotNeeded", "ConvFromXtoItselfNotNeeded", 
@@ -512,7 +514,8 @@ proc raiseRecoverableError*(msg: string) {.noinline, noreturn.} =
 proc sourceLine*(i: TLineInfo): PRope
 
 var
-  gNotes*: TNoteKinds = {low(TNoteKind)..high(TNoteKind)} - {warnShadowIdent}
+  gNotes*: TNoteKinds = {low(TNoteKind)..high(TNoteKind)} - 
+                        {warnShadowIdent, warnUninit}
   gErrorCounter*: int = 0     # counts the number of errors
   gHintCounter*: int = 0
   gWarnCounter*: int = 0