1
0
mirror of https://github.com/cc65/cc65.git synced 2024-06-30 16:29:58 +00:00

The message "Dropping x additional line infos" had been displayed even if

there weren't any more line infos to display, because they had the wrong type.


git-svn-id: svn://svn.cc65.org/cc65/trunk@5882 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
uz 2012-10-27 19:16:35 +00:00
parent 0cbc81161c
commit 757b400aa1

View File

@ -61,6 +61,9 @@ unsigned WarnLevel = 1;
unsigned ErrorCount = 0; unsigned ErrorCount = 0;
unsigned WarningCount = 0; unsigned WarningCount = 0;
/* Maximum number of additional notifications */
#define MAX_NOTES 6
/*****************************************************************************/ /*****************************************************************************/
@ -121,6 +124,7 @@ static void AddNotifications (const Collection* LineInfos)
/* Output additional notifications for an error or warning */ /* Output additional notifications for an error or warning */
{ {
unsigned I; unsigned I;
unsigned Output;
unsigned Skipped; unsigned Skipped;
/* The basic line info is always in slot zero. It has been used to /* The basic line info is always in slot zero. It has been used to
@ -128,22 +132,36 @@ static void AddNotifications (const Collection* LineInfos)
* more information. Check them and print additional notifications if * more information. Check them and print additional notifications if
* they're present, but limit the number to a reasonable value. * they're present, but limit the number to a reasonable value.
*/ */
unsigned MaxCount = CollCount (LineInfos); for (I = 1, Output = 0, Skipped = 0; I < CollCount (LineInfos); ++I) {
if (MaxCount > 6) {
MaxCount = 6;
}
Skipped = CollCount (LineInfos) - MaxCount;
for (I = 1; I < MaxCount; ++I) {
/* Get next line info */ /* Get next line info */
const LineInfo* LI = CollConstAt (LineInfos, I); const LineInfo* LI = CollConstAt (LineInfos, I);
/* Check the type and output an appropriate note */ /* Check the type and output an appropriate note */
unsigned Type = GetLineInfoType (LI); const char* Msg;
if (Type == LI_TYPE_EXT) { switch (GetLineInfoType (LI)) {
PrintMsg (GetSourcePos (LI), "Note",
"Assembler code generated from this line"); case LI_TYPE_EXT:
} else if (Type == LI_TYPE_MACRO) { Msg = "Assembler code generated from this line";
PrintMsg (GetSourcePos (LI), "Note", break;
"Macro was defined here");
case LI_TYPE_MACRO:
Msg = "Macro was defined here";
break;
default:
/* No output */
Msg = 0;
break;
}
/* Output until an upper limit of messages is reached */
if (Msg) {
if (Output < MAX_NOTES) {
PrintMsg (GetSourcePos (LI), "Note", "%s", Msg);
++Output;
} else {
++Skipped;
}
} }
} }
@ -158,7 +176,7 @@ static void AddNotifications (const Collection* LineInfos)
/*****************************************************************************/ /*****************************************************************************/
/* Warnings */ /* Warnings */
/*****************************************************************************/ /*****************************************************************************/