From 45a326750cc0d2a8810461282613247ebf69de1e Mon Sep 17 00:00:00 2001 From: Kugel Fuhr <98353208+kugelfuhr@users.noreply.github.com> Date: Sun, 6 Jul 2025 10:39:29 +0200 Subject: [PATCH] Added a function to output notifications. --- src/ca65/error.c | 36 +++++++++++++++++++++--------------- src/ca65/error.h | 3 +++ 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src/ca65/error.c b/src/ca65/error.c index 78941b5c2..28ff6aa59 100644 --- a/src/ca65/error.c +++ b/src/ca65/error.c @@ -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 */ /*****************************************************************************/ diff --git a/src/ca65/error.h b/src/ca65/error.h index c6fb4f44e..a55ceb8e4 100644 --- a/src/ca65/error.h +++ b/src/ca65/error.h @@ -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. */