From 1d7317e60a63842f5e2fadb4f11e472cd3af0039 Mon Sep 17 00:00:00 2001 From: fennecdjay Date: Tue, 24 Sep 2019 14:02:40 +0200 Subject: [PATCH] :art: Make gw_xxx() void --- ast | 2 +- include/parse.h | 8 ++++---- src/parse/check.c | 24 ++++++++++++++++++++---- util | 2 +- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/ast b/ast index 4b0056d3..a80647e2 160000 --- a/ast +++ b/ast @@ -1 +1 @@ -Subproject commit 4b0056d3f830edb2cd22eb66ac8e47e483464f1b +Subproject commit a80647e2685d3a1650acde3096a180c3888888ca diff --git a/include/parse.h b/include/parse.h index 295963a6..a3da97f2 100644 --- a/include/parse.h +++ b/include/parse.h @@ -41,14 +41,14 @@ static const _exp_func section_func[] = { (_exp_func)prefix##_enum_def, (_exp_func)prefix##_union_def, \ (_exp_func)prefix##_fptr_def, (_exp_func)prefix##_type_def \ }; \ -ANN static inline m_bool prefix##_section(const void* a, /* const */ Section* section) { GWDEBUG_EXE \ - void* d = §ion->d.stmt_list; \ +ANN static inline m_bool prefix##_section(const void* a, /* const */ Section* section) { \ + void* d = §ion->d.stmt_list; \ return section_func[section->section_type](a, *(void**)d); \ } #define HANDLE_EXP_FUNC(prefix, type, ret) \ DECL_EXP_FUNC(prefix) \ -ANN type prefix##_exp(const Env env, Exp exp) { GWDEBUG_EXE \ +ANN type prefix##_exp(const Env env, Exp exp) { \ do CHECK_BB(exp_func[exp->exp_type](env, &exp->d)) \ while((exp = exp->next)); \ return ret; \ @@ -57,7 +57,7 @@ ANN m_bool scan1_exp(const Env, Exp); ANN m_bool scan2_exp(const Env, Exp); #define describe_stmt_func(prefix, name, type, prolog, exp) \ -ANN static m_bool prefix##_stmt_##name(const Env env, const type stmt) { GWDEBUG_EXE \ +ANN static m_bool prefix##_stmt_##name(const Env env, const type stmt) { \ RET_NSPC(exp) \ } diff --git a/src/parse/check.c b/src/parse/check.c index 33b194fb..b8cca619 100644 --- a/src/parse/check.c +++ b/src/parse/check.c @@ -627,17 +627,27 @@ ANN Func find_template_match(const Env env, const Value value, const Exp_Call* e ERR_O(exp_self(exp)->pos, _("arguments do not match for template call")) } +#define next_arg(type) \ +ANN static inline type next_arg_##type(const type e) { \ + const type next = e->next; \ + if(next) \ + gw_err(","); \ + return next; \ +} +next_arg(Exp) +next_arg(Arg_List) + ANN static void print_current_args(Exp e) { gw_err(_("and not\n ")); do gw_err(" \033[32m%s\033[0m", e->type->name); - while((e = e->next) && gw_err(",")); + while((e = next_arg_Exp(e))); gw_err("\n"); } ANN static void print_arg(Arg_List e) { do gw_err(" \033[32m%s\033[0m \033[1m%s\033[0m", e->type ? e->type->name : NULL, e->var_decl->xid ? s_name(e->var_decl->xid) : ""); - while((e = e->next) && gw_err(",")); + while((e = next_arg_Arg_List(e))); } ANN2(1) static void function_alternative(const Env env, const Type f, const Exp args, const loc_t pos){ @@ -646,10 +656,16 @@ ANN2(1) static void function_alternative(const Env env, const Type f, const Exp do { gw_err("(%s) ", up->name); const Arg_List e = up->def->base->args; - e ? print_arg(e) : (void)gw_err("\033[32mvoid\033[0m"); + if(e) + print_arg(e); + else + gw_err("\033[32mvoid\033[0m"); gw_err("\n"); } while((up = up->next)); - args ? print_current_args(args) : (void)gw_err(_("and not:\n \033[32mvoid\033[0m\n")); + if(args) + print_current_args(args); + else + gw_err(_("and not:\n \033[32mvoid\033[0m\n")); } ANN static m_uint get_type_number(ID_List list) { diff --git a/util b/util index b84961d2..3d2be8fd 160000 --- a/util +++ b/util @@ -1 +1 @@ -Subproject commit b84961d25c2ae0b31eae301d211d72159ce945e7 +Subproject commit 3d2be8fdf552bdded221ddb266d55043c288da4a -- 2.43.0