From a1e9fe04ad8384b6dfa9a99d10cf65630f299b10 Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Thu, 29 Aug 2019 18:44:59 -0400 Subject: More constant expressions --- util/err.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'util') 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); -- cgit v1.2.3