Add a non-error diagnostic that can't be silenced.

It is inteded for flagging buggy conditions in the compiler, particularly
after having fixed the original bug (in case something comes back from the
dead).
This commit is contained in:
Bill Currie 2012-05-03 13:24:24 +09:00
parent 3306039da2
commit 5f676c367f
2 changed files with 22 additions and 0 deletions

View file

@ -49,6 +49,8 @@ struct expr_s *notice (struct expr_s *e, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
void debug (struct expr_s *e, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
void bug (struct expr_s *e, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
//@}

View file

@ -121,6 +121,26 @@ debug (expr_t *e, const char *fmt, ...)
va_end (args);
}
void
bug (expr_t *e, const char *fmt, ...)
{
va_list args;
string_t file = pr.source_file;
int line = pr.source_line;
va_start (args, fmt);
report_function (e);
if (e) {
file = e->file;
line = e->line;
}
fprintf (stderr, "%s:%d: BUG: ", GETSTR (file), line);
vfprintf (stderr, fmt, args);
fputs ("\n", stderr);
va_end (args);
}
expr_t *
notice (expr_t *e, const char *fmt, ...)
{