Added a function to output notifications.

This commit is contained in:
Kugel Fuhr
2025-07-06 10:39:29 +02:00
parent bcd29de443
commit 45a326750c
2 changed files with 24 additions and 15 deletions

View File

@@ -108,18 +108,6 @@ static void VPrintMsg (const FilePos* Pos, const char* Desc,
static void PrintMsg (const FilePos* Pos, const char* Desc,
const char* Format, ...)
/* Format and output an error/warning message. */
{
va_list ap;
va_start (ap, Format);
VPrintMsg (Pos, Desc, Format, ap);
va_end (ap);
}
static void AddNotifications (const Collection* LineInfos)
/* Output additional notifications for an error or warning */
{
@@ -165,7 +153,7 @@ static void AddNotifications (const Collection* LineInfos)
/* Output until an upper limit of messages is reached */
if (Msg) {
if (Output < MAX_NOTES) {
PrintMsg (GetSourcePos (LI), "Note", "%s", Msg);
PNotification (GetSourcePos (LI), "%s", Msg);
++Output;
} else {
++Skipped;
@@ -176,13 +164,31 @@ static void AddNotifications (const Collection* LineInfos)
/* 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);
PNotification (GetSourcePos (LI), "Dropping %u additional line infos",
Skipped);
}
}
/*****************************************************************************/
/* Notifications */
/*****************************************************************************/
void PNotification (const FilePos* Pos, const char* Format, ...)
/* Print a notification message. */
{
/* Output the message */
va_list ap;
va_start (ap, Format);
VPrintMsg (Pos, "Note", Format, ap);
va_end (ap);
}
/*****************************************************************************/
/* Warnings */
/*****************************************************************************/

View File

@@ -72,6 +72,9 @@ extern unsigned WarningCount;
void PNotification (const FilePos* Pos, const char* Format, ...) attribute ((format (printf, 2, 3)));
/* Print a notification message. */
void Warning (unsigned Level, const char* Format, ...) attribute ((format (printf, 2, 3)));
/* Print warning message. */