/* */
/* */
/* */
-/* (C) 1998-2000 Ullrich von Bassewitz */
-/* Wacholderweg 14 */
-/* D-70597 Stuttgart */
-/* EMail: uz@musoftware.de */
+/* (C) 1998-2009, Ullrich von Bassewitz */
+/* Roemerstrasse 52 */
+/* D-70794 Filderstadt */
+/* EMail: uz@cc65.org */
/* */
/* */
/* This software is provided 'as-is', without any expressed or implied */
-static void IntWarning (const char* Filename, unsigned Line, const char* Msg, va_list ap)
+static void IntWarning (const char* Filename, unsigned LineNo, const char* Msg, va_list ap)
/* Print warning message - internal function. */
{
- if (!NoWarn) {
- fprintf (stderr, "%s(%u): Warning: ", Filename, Line);
+ if (!IS_Get (&WarnDisable)) {
+ fprintf (stderr, "%s(%u): Warning: ", Filename, LineNo);
vfprintf (stderr, Msg, ap);
fprintf (stderr, "\n");
- Print (stderr, 1, "Line: %s\n", line);
- ++WarningCount;
+ if (Line) {
+ Print (stderr, 1, "Input: %.*s\n", (int) SB_GetLen (Line), SB_GetConstBuf (Line));
+ }
+ ++WarningCount;
}
}
+void LIWarning (const LineInfo* LI, const char* Format, ...)
+/* Print a warning message with the line info given explicitly */
+{
+ va_list ap;
+ va_start (ap, Format);
+ IntWarning (GetInputName (LI), GetInputLine (LI), Format, ap);
+ va_end (ap);
+}
+
+
+
void PPWarning (const char* Format, ...)
/* Print warning message. For use within the preprocessor. */
{
-static void IntError (const char* Filename, unsigned Line, const char* Msg, va_list ap)
+static void IntError (const char* Filename, unsigned LineNo, const char* Msg, va_list ap)
/* Print an error message - internal function*/
{
- fprintf (stderr, "%s(%u): Error: ", Filename, Line);
+ fprintf (stderr, "%s(%u): Error: ", Filename, LineNo);
vfprintf (stderr, Msg, ap);
fprintf (stderr, "\n");
- Print (stderr, 1, "Line: %s\n", line);
+ if (Line) {
+ Print (stderr, 1, "Input: %.*s\n", (int) SB_GetLen (Line), SB_GetConstBuf (Line));
+ }
++ErrorCount;
if (ErrorCount > 10) {
Fatal ("Too many errors");
+void LIError (const LineInfo* LI, const char* Format, ...)
+/* Print an error message with the line info given explicitly */
+{
+ va_list ap;
+ va_start (ap, Format);
+ IntError (GetInputName (LI), GetInputLine (LI), Format, ap);
+ va_end (ap);
+}
+
+
+
void PPError (const char* Format, ...)
/* Print an error message. For use within the preprocessor. */
{
const char* FileName;
unsigned LineNum;
if (CurTok.LI) {
- FileName = GetInputName (CurTok.LI);
- LineNum = GetInputLine (CurTok.LI);
+ FileName = GetInputName (CurTok.LI);
+ LineNum = GetInputLine (CurTok.LI);
} else {
- FileName = GetCurrentFile ();
- LineNum = GetCurrentLine ();
+ FileName = GetCurrentFile ();
+ LineNum = GetCurrentLine ();
}
fprintf (stderr, "%s(%u): Fatal: ", FileName, LineNum);
va_end (ap);
fprintf (stderr, "\n");
- Print (stderr, 1, "Line: %s\n", line);
+ if (Line) {
+ Print (stderr, 1, "Input: %.*s\n", (int) SB_GetLen (Line), SB_GetConstBuf (Line));
+ }
exit (EXIT_FAILURE);
}
const char* FileName;
unsigned LineNum;
if (CurTok.LI) {
- FileName = GetInputName (CurTok.LI);
- LineNum = GetInputLine (CurTok.LI);
+ FileName = GetInputName (CurTok.LI);
+ LineNum = GetInputLine (CurTok.LI);
} else {
- FileName = GetCurrentFile ();
- LineNum = GetCurrentLine ();
+ FileName = GetCurrentFile ();
+ LineNum = GetCurrentLine ();
}
fprintf (stderr, "%s(%u): Internal compiler error:\n",
- FileName, LineNum);
+ FileName, LineNum);
va_start (ap, Format);
vfprintf (stderr, Format, ap);
va_end (ap);
- fprintf (stderr, "\nLine: %s\n", line);
+ fprintf (stderr, "\n");
+
+ if (Line) {
+ fprintf (stderr, "\nInput: %.*s\n", (int) SB_GetLen (Line), SB_GetConstBuf (Line));
+ }
/* Use abort to create a core dump */
abort ();
-}
+}
void ErrorReport (void)
/* Report errors (called at end of compile) */
{
- if (ErrorCount == 0 && Verbosity > 0) {
- printf ("No errors.\n");
- }
+ Print (stdout, 1, "%u errors, %u warnings\n", ErrorCount, WarningCount);
}
-
-