chibipub

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 47166a2b14176d09ea27a8758db9c6321f5db35a
parent 9a39254b3de99148c6509e7c4d52f769a303e255
Author: William Casarin <jb55@jb55.com>
Date:   Sun, 17 Jan 2021 11:26:18 -0800

errs: record depth

Diffstat:
Msrc/errors.h | 3+++
1 file changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/errors.h b/src/errors.h @@ -8,6 +8,7 @@ struct errors { int record; + int depth; }; static inline void copy_errors(struct errors *src, struct errors *dst) @@ -18,6 +19,7 @@ static inline void copy_errors(struct errors *src, struct errors *dst) static inline void init_errors(struct errors *errs) { errs->record = 1; + errs->depth = 0; } static inline void note_error_(struct errors *errs, const char *fmt, ...) @@ -28,6 +30,7 @@ static inline void note_error_(struct errors *errs, const char *fmt, ...) va_list ap; va_start(ap, fmt); + fprintf(stderr, "[%d] ", errs->depth++); vfprintf(stderr, fmt, ap); va_end(ap); }