0
0
Fork 0
mirror of https://git.code.sf.net/p/quake/quakeforge synced 2025-03-21 18:01:15 +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:
Bill Currie 2018-10-12 13:57:59 +09:00
parent 3656cb966c
commit 3bd9f96b07
2 changed files with 6 additions and 3 deletions
tools/qfcc

View file

@ -47,8 +47,10 @@ extern diagnostic_hook notice_hook;
struct expr_s *error (struct expr_s *e, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3)));
void
internal_error (struct expr_s *e, const char *fmt, ...)
__attribute__ ((format (printf, 2, 3), noreturn));
_internal_error (struct expr_s *e, const char *file, int line,
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, ...)
__attribute__ ((format (printf, 2, 3)));
struct expr_s *notice (struct expr_s *e, const char *fmt, ...)

View file

@ -200,7 +200,7 @@ warning (expr_t *e, const char *fmt, ...)
}
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;
@ -211,6 +211,7 @@ internal_error (expr_t *e, const char *fmt, ...)
dstring_t *message = dstring_new ();
format_message (message, "internal error", e, fmt, args);
dasprintf (message, " (%s:%d)", file, line);
fprintf (stderr, "%s\n", message->str);
dstring_delete (message);
}