diff --git a/tools/qfcc/include/diagnostic.h b/tools/qfcc/include/diagnostic.h index 6c28ccd41..1c0ee51bc 100644 --- a/tools/qfcc/include/diagnostic.h +++ b/tools/qfcc/include/diagnostic.h @@ -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, ...) diff --git a/tools/qfcc/source/diagnostic.c b/tools/qfcc/source/diagnostic.c index e2511a837..dbf71142c 100644 --- a/tools/qfcc/source/diagnostic.c +++ b/tools/qfcc/source/diagnostic.c @@ -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); }