mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-06-01 09:02:08 +00:00
Make internal error messages a little more helpful.
They now include the file and line of the compiler as well.
This commit is contained in:
parent
3656cb966c
commit
3bd9f96b07
2 changed files with 6 additions and 3 deletions
|
@ -47,8 +47,10 @@ extern diagnostic_hook notice_hook;
|
||||||
struct expr_s *error (struct expr_s *e, const char *fmt, ...)
|
struct expr_s *error (struct expr_s *e, const char *fmt, ...)
|
||||||
__attribute__ ((format (printf, 2, 3)));
|
__attribute__ ((format (printf, 2, 3)));
|
||||||
void
|
void
|
||||||
internal_error (struct expr_s *e, const char *fmt, ...)
|
_internal_error (struct expr_s *e, const char *file, int line,
|
||||||
__attribute__ ((format (printf, 2, 3), noreturn));
|
const char *fmt, ...)
|
||||||
|
__attribute__ ((format (printf, 4, 5), noreturn));
|
||||||
|
#define internal_error(e, fmt...) _internal_error(e, __FILE__, __LINE__, fmt)
|
||||||
struct expr_s *warning (struct expr_s *e, const char *fmt, ...)
|
struct expr_s *warning (struct expr_s *e, const char *fmt, ...)
|
||||||
__attribute__ ((format (printf, 2, 3)));
|
__attribute__ ((format (printf, 2, 3)));
|
||||||
struct expr_s *notice (struct expr_s *e, const char *fmt, ...)
|
struct expr_s *notice (struct expr_s *e, const char *fmt, ...)
|
||||||
|
|
|
@ -200,7 +200,7 @@ warning (expr_t *e, const char *fmt, ...)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
internal_error (expr_t *e, const char *fmt, ...)
|
_internal_error (expr_t *e, const char *file, int line, const char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
|
@ -211,6 +211,7 @@ internal_error (expr_t *e, const char *fmt, ...)
|
||||||
dstring_t *message = dstring_new ();
|
dstring_t *message = dstring_new ();
|
||||||
|
|
||||||
format_message (message, "internal error", e, fmt, args);
|
format_message (message, "internal error", e, fmt, args);
|
||||||
|
dasprintf (message, " (%s:%d)", file, line);
|
||||||
fprintf (stderr, "%s\n", message->str);
|
fprintf (stderr, "%s\n", message->str);
|
||||||
dstring_delete (message);
|
dstring_delete (message);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue