diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2019-08-29 18:44:59 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2019-08-29 18:44:59 -0400 |
commit | a1e9fe04ad8384b6dfa9a99d10cf65630f299b10 (patch) | |
tree | 5e6a4fd4cbbfbce815940222f5e01e6b5e91b783 /util | |
parent | 7c790561cca382660081dfae3a6fe50fc31ad2a5 (diff) |
More constant expressions
Diffstat (limited to 'util')
-rw-r--r-- | util/err.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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); |