From cc3cf3353f23dd2f87412d42f8c3d52f873711dd Mon Sep 17 00:00:00 2001 From: Kimplul Date: Sat, 25 Mar 2023 22:47:46 +0200 Subject: add formatter --- src/debug.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/debug.c') diff --git a/src/debug.c b/src/debug.c index e18ae70..2bb4af4 100644 --- a/src/debug.c +++ b/src/debug.c @@ -1,3 +1,5 @@ +/* SPDX-License-Identifier: GPL-3.0-or-later */ + #include #include #include @@ -40,7 +42,8 @@ static const char *find_lineno(const char *buf, size_t no) static void _issue(struct src_issue issue, const char *fmt, va_list args) { /* get start and end of current line in buffer */ - const char *line_start = find_lineno(issue.fctx.fbuf, issue.loc.first_line); + const char *line_start = find_lineno(issue.fctx.fbuf, + issue.loc.first_line); const char *line_end = strchr(line_start, '\n'); if (!line_end) line_end = strchr(line_start, 0); @@ -48,9 +51,9 @@ static void _issue(struct src_issue issue, const char *fmt, va_list args) const int line_len = line_end - line_start; fprintf(stderr, "%s:%i:%i: %s: ", issue.fctx.fname, - issue.loc.first_line, - issue.loc.first_col, - issue_level_str(issue.level)); + issue.loc.first_line, + issue.loc.first_col, + issue_level_str(issue.level)); vfprintf(stderr, fmt, args); fputc('\n', stderr); @@ -89,7 +92,8 @@ void src_issue(struct src_issue issue, const char *err_msg, ...) /* TODO: should really implement these better, the bad error messages are * starting to play a role in debugging */ -void semantic_error(struct file_ctx fctx, struct ast_node *node, const char *fmt, ...) +void semantic_error(struct file_ctx fctx, struct ast_node *node, + const char *fmt, ...) { va_list args; va_start(args, fmt); @@ -101,7 +105,8 @@ void semantic_error(struct file_ctx fctx, struct ast_node *node, const char *fmt va_end(args); } -void semantic_warn(struct file_ctx fctx, struct ast_node *node, const char *fmt, ...) +void semantic_warn(struct file_ctx fctx, struct ast_node *node, const char *fmt, + ...) { va_list args; va_start(args, fmt); @@ -113,7 +118,8 @@ void semantic_warn(struct file_ctx fctx, struct ast_node *node, const char *fmt, va_end(args); } -void semantic_info(struct file_ctx fctx, struct ast_node *node, const char *fmt, ...) +void semantic_info(struct file_ctx fctx, struct ast_node *node, const char *fmt, + ...) { va_list args; va_start(args, fmt); -- cgit v1.3