Added a function to output notifications.
This commit is contained in:
@@ -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)
|
static void AddNotifications (const Collection* LineInfos)
|
||||||
/* Output additional notifications for an error or warning */
|
/* 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 */
|
/* Output until an upper limit of messages is reached */
|
||||||
if (Msg) {
|
if (Msg) {
|
||||||
if (Output < MAX_NOTES) {
|
if (Output < MAX_NOTES) {
|
||||||
PrintMsg (GetSourcePos (LI), "Note", "%s", Msg);
|
PNotification (GetSourcePos (LI), "%s", Msg);
|
||||||
++Output;
|
++Output;
|
||||||
} else {
|
} else {
|
||||||
++Skipped;
|
++Skipped;
|
||||||
@@ -176,13 +164,31 @@ static void AddNotifications (const Collection* LineInfos)
|
|||||||
/* Add a note if we have more stuff that we won't output */
|
/* Add a note if we have more stuff that we won't output */
|
||||||
if (Skipped > 0) {
|
if (Skipped > 0) {
|
||||||
const LineInfo* LI = CollConstAt (LineInfos, 0);
|
const LineInfo* LI = CollConstAt (LineInfos, 0);
|
||||||
PrintMsg (GetSourcePos (LI), "Note",
|
PNotification (GetSourcePos (LI), "Dropping %u additional line infos",
|
||||||
"Dropping %u additional line infos", Skipped);
|
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 */
|
/* Warnings */
|
||||||
/*****************************************************************************/
|
/*****************************************************************************/
|
||||||
|
|||||||
@@ -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)));
|
void Warning (unsigned Level, const char* Format, ...) attribute ((format (printf, 2, 3)));
|
||||||
/* Print warning message. */
|
/* Print warning message. */
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user