]> Nishi Git Mirror - gwion.git/commitdiff
:art: Make gw_xxx() void
authorfennecdjay <astor.jeremie@wanadoo.fr>
Tue, 24 Sep 2019 12:02:40 +0000 (14:02 +0200)
committerfennecdjay <astor.jeremie@wanadoo.fr>
Tue, 24 Sep 2019 12:02:40 +0000 (14:02 +0200)
ast
include/parse.h
src/parse/check.c
util

diff --git a/ast b/ast
index 4b0056d3f830edb2cd22eb66ac8e47e483464f1b..a80647e2685d3a1650acde3096a180c3888888ca 160000 (submodule)
--- a/ast
+++ b/ast
@@ -1 +1 @@
-Subproject commit 4b0056d3f830edb2cd22eb66ac8e47e483464f1b
+Subproject commit a80647e2685d3a1650acde3096a180c3888888ca
index 295963a6c87dfa2273614dbd0bab27c712b59ecd..a3da97f2fd8ef3a14467cdc53ac4397fae812bea 100644 (file)
@@ -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 = &section->d.stmt_list;                            \
+ANN static inline m_bool prefix##_section(const void* a, /* const */ Section* section) {                                                  \
+  void* d = &section->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) \
 }
 
index 33b194fbfafc0a703adb7cc2f070015a1a5dac5c..b8cca619c92d577631db3702906843e644670b01 100644 (file)
@@ -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 b84961d25c2ae0b31eae301d211d72159ce945e7..3d2be8fdf552bdded221ddb266d55043c288da4a 160000 (submodule)
--- a/util
+++ b/util
@@ -1 +1 @@
-Subproject commit b84961d25c2ae0b31eae301d211d72159ce945e7
+Subproject commit 3d2be8fdf552bdded221ddb266d55043c288da4a