summaryrefslogtreecommitdiff
path: root/util
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2019-08-29 18:44:59 -0400
committerLeo Tenenbaum <pommicket@gmail.com>2019-08-29 18:44:59 -0400
commita1e9fe04ad8384b6dfa9a99d10cf65630f299b10 (patch)
tree5e6a4fd4cbbfbce815940222f5e01e6b5e91b783 /util
parent7c790561cca382660081dfae3a6fe50fc31ad2a5 (diff)
More constant expressions
Diffstat (limited to 'util')
-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);