]> git.sur5r.net Git - cc65/blobdiff - src/ca65/error.c
Finished implemenation of commands to delete macros. Added the new commands to
[cc65] / src / ca65 / error.c
index f647fee43ed711e99a18d43ff8d9274c71f61921..53e4bc5c00f0dfaec86d6464b1a2fe649ffc8bf6 100644 (file)
@@ -120,13 +120,20 @@ static void PrintMsg (const FilePos* Pos, const char* Desc,
 static void AddNotifications (const Collection* LineInfos)
 /* Output additional notifications for an error or warning */
 {
+    unsigned I;
+    unsigned Skipped;
+
     /* The basic line info is always in slot zero. It has been used to
      * output the actual error or warning. The following slots may contain
-     * more information. Check them and additional notifications if they're
-     * present.
+     * more information. Check them and print additional notifications if
+     * they're present, but limit the number to a reasonable value.
      */
-    unsigned I;
-    for (I = 1; I < CollCount (LineInfos); ++I) {
+    unsigned MaxCount = CollCount (LineInfos);
+    if (MaxCount > 6) {
+        MaxCount = 6;
+    }
+    Skipped = CollCount (LineInfos) - MaxCount;
+    for (I = 1; I < MaxCount; ++I) {
         /* Get next line info */
         const LineInfo* LI = CollConstAt (LineInfos, I);
         /* Check the type and output an appropriate note */
@@ -139,6 +146,13 @@ static void AddNotifications (const Collection* LineInfos)
                       "Macro was defined here");
         }
     }
+
+    /* Add a note if we have more stuff that we won't output */
+    if (Skipped > 0) {
+        const LineInfo* LI = CollConstAt (LineInfos, 0);
+        PrintMsg (GetSourcePos (LI), "Note",
+                  "Dropping %u additional line infos", Skipped);
+    }
 }