summaryrefslogtreecommitdiff
path: root/err.c
diff options
context:
space:
mode:
Diffstat (limited to 'err.c')
-rw-r--r--err.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/err.c b/err.c
index a8289cb..85d386a 100644
--- a/err.c
+++ b/err.c
@@ -38,15 +38,15 @@ static void err_vfprint(const char *fmt, va_list args) {
}
static void err_print_header_(Location where) {
- err_fprint(TEXT_ERROR("error:") " at line %lu of %s:\n", (unsigned long)where.line, where.filename);
+ err_fprint(TEXT_ERROR("error:") " at line %lu of %s:\n", (unsigned long)where.line, where.ctx->filename);
}
static void info_print_header_(Location where) {
- err_fprint(TEXT_INFO("info:") " at line %lu of %s:\n", (unsigned long)where.line, where.filename);
+ err_fprint(TEXT_INFO("info:") " at line %lu of %s:\n", (unsigned long)where.line, where.ctx->filename);
}
static void warn_print_header_(Location where) {
- err_fprint(TEXT_WARN("warning:") " at line %lu of %s:\n", (unsigned long)where.line, where.filename);
+ err_fprint(TEXT_WARN("warning:") " at line %lu of %s:\n", (unsigned long)where.line, where.ctx->filename);
}
static void err_print_footer_(const char *context) {
@@ -66,6 +66,7 @@ static void err_print_footer_(const char *context) {
static void err_vprint(Location where, const char *fmt, va_list args) {
+ if (!where.ctx->enabled) return;
err_print_header_(where);
err_vfprint(fmt, args);
err_print_footer_(where.code);
@@ -73,6 +74,7 @@ static void err_vprint(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 (!where.ctx->enabled) return;
if (file)
err_fprint("Generated by line %d of %s:\n", line, file);
va_start(args, fmt);
@@ -84,6 +86,7 @@ static void err_print_(int line, const char *file, Location where, const char *f
static void info_print(Location where, const char *fmt, ...) {
va_list args;
+ if (!where.ctx->enabled) return;
va_start(args, fmt);
info_print_header_(where);
err_vfprint(fmt, args);
@@ -93,6 +96,7 @@ static void info_print(Location where, const char *fmt, ...) {
static void warn_print(Location where, const char *fmt, ...) {
va_list args;
+ if (!where.ctx->enabled) return;
va_start(args, fmt);
warn_print_header_(where);
err_vfprint(fmt, args);