/* Report error msg at l */ void verror_with_location(location l, const char *format, va_list args) { count_error(FALSE); report_error_function(l->filename); pfile_and_line(stderr, l); vfprintf(stderr, format, args); putc('\n', stderr); }
/* Report warning msg at l */ void vwarning_with_location(location l, const char *format, va_list args) { if (count_error(TRUE)) { report_error_function(l->filename); pfile_and_line(stderr, l); fprintf(stderr, "warning: "); vfprintf(stderr, format, args); putc('\n', stderr); } }
void ffebad_finish () { #define MAX_SPACES 132 static const char *const spaces = "...>\ \040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\ \040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\ \040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\ \040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\ \040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\ \040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\ \040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\ \040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\040\ \040\040\040"; /* MAX_SPACES - 1 spaces. */ ffewhereLineNumber last_line_num; ffewhereLineNumber ln; ffewhereLineNumber rn; ffewhereColumnNumber last_col_num; ffewhereColumnNumber cn; ffewhereColumnNumber cnt; ffewhereLine l; ffebadIndex bi; unsigned short i; char pointer; unsigned char c; unsigned const char *s; const char *fn; static char buf[1024]; int bufi; int index; if (ffebad_is_temp_inhibited_) return; switch (ffebad_severity_) { case FFEBAD_severityINFORMATIONAL: s = _("note:"); break; case FFEBAD_severityWARNING: s = _("warning:"); break; case FFEBAD_severitySEVERE: s = _("fatal:"); break; default: s = ""; break; } /* Display the annoying source references. */ last_line_num = 0; last_col_num = 0; for (bi = 0; bi < ffebad_places_; ++bi) { if (ffebad_places_ == 1) pointer = '^'; else pointer = '1' + bi; l = ffebad_here_[ffebad_order_[bi]].line; ln = ffewhere_line_number (l); rn = ffewhere_line_filelinenum (l); cn = ffewhere_column_number (ffebad_here_[ffebad_order_[bi]].col); fn = ffewhere_line_filename (l); if (ln != last_line_num) { if (bi != 0) fputc ('\n', stderr); report_error_function (fn); fprintf (stderr, /* the trailing space on the <file>:<line>: line fools emacs19 compilation mode into finding the report */ "%s:%" ffewhereLineNumber_f "u: %s\n %s\n %s%c", fn, rn, s, ffewhere_line_content (l), &spaces[cn > MAX_SPACES ? 0 : MAX_SPACES - cn + 4], pointer); last_line_num = ln; last_col_num = cn; s = _("(continued):"); } else { cnt = cn - last_col_num; fprintf (stderr, "%s%c", &spaces[cnt > MAX_SPACES ? 0 : MAX_SPACES - cnt + 4], pointer); last_col_num = cn; } } if (ffebad_places_ == 0) { /* Didn't output "warning:" string, capitalize it for message. */ if (s[0] != '\0') { char c; c = TOUPPER (s[0]); fprintf (stderr, "%c%s ", c, &s[1]); } else if (s[0] != '\0') fprintf (stderr, "%s ", s); } else fputc ('\n', stderr); /* Release the ffewhere info. */ for (bi = 0; bi < FFEBAD_MAX_; ++bi) { ffewhere_line_kill (ffebad_here_[bi].line); ffewhere_column_kill (ffebad_here_[bi].col); } /* Now display the message. */ bufi = 0; for (i = 0; (c = ffebad_message_[i]) != '\0'; ++i) { if (c == '%') { c = ffebad_message_[++i]; if (ISUPPER (c)) { index = c - 'A'; if ((index < 0) || (index >= FFEBAD_MAX_)) { bufi = ffebad_bufputs_ (buf, bufi, _("[REPORT BUG!!] %")); bufi = ffebad_bufputc_ (buf, bufi, c); } else { s = ffebad_string_[index]; if (s == NULL) bufi = ffebad_bufputs_ (buf, bufi, _("[REPORT BUG!!]")); else bufi = ffebad_bufputs_ (buf, bufi, s); } } else if (ISDIGIT (c)) { index = c - '0'; if ((index < 0) || (index >= FFEBAD_MAX_)) { bufi = ffebad_bufputs_ (buf, bufi, _("[REPORT BUG!!] %")); bufi = ffebad_bufputc_ (buf, bufi, c); } else { pointer = ffebad_here_[index].tag + '1'; if (pointer == FFEBAD_MAX_ + '1') pointer = '?'; else if (ffebad_places_ == 1) pointer = '^'; bufi = ffebad_bufputc_ (buf, bufi, '('); bufi = ffebad_bufputc_ (buf, bufi, pointer); bufi = ffebad_bufputc_ (buf, bufi, ')'); } } else if (c == '\0') break; else if (c == '%') bufi = ffebad_bufputc_ (buf, bufi, '%'); else { bufi = ffebad_bufputs_ (buf, bufi, _("[REPORT BUG!!]")); bufi = ffebad_bufputc_ (buf, bufi, '%'); bufi = ffebad_bufputc_ (buf, bufi, c); } } else bufi = ffebad_bufputc_ (buf, bufi, c); } bufi = ffebad_bufputc_ (buf, bufi, '\n'); bufi = ffebad_bufflush_ (buf, bufi); }