summaryrefslogtreecommitdiff
path: root/util/err.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/err.c')
-rw-r--r--util/err.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/util/err.c b/util/err.c
index 0bd6424..5ff28ad 100644
--- a/util/err.c
+++ b/util/err.c
@@ -72,13 +72,17 @@ static void err_vprint(Location where, const char *fmt, va_list args) {
err_print_footer_(where.code);
}
-static void err_print(Location where, const char *fmt, ...) {
- va_list args;
+static void err_print_(int line, const char *file, Location where, const char *fmt, ...) {
+ va_list args;
+ if (file)
+ err_fprint("Generated by line %d of %s:\n", line, file);
va_start(args, fmt);
err_vprint(where, fmt, args);
va_end(args);
}
+#define err_print(...) err_print_(__LINE__, __FILE__, __VA_ARGS__)
+
static void info_print(Location where, const char *fmt, ...) {
va_list args;
va_start(args, fmt);