From 73d3ee1e6ea9e65ae39cd58743188d933a73e4d9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Astor?= Date: Sun, 27 Mar 2022 22:12:14 +0200 Subject: [PATCH] :art: Fix a few warnings --- include/traverse.h | 2 +- src/lib/prim.c | 4 ++-- src/lib/ptr.c | 9 ++++----- src/lib/ugen.c | 4 +--- src/parse/scan2.c | 6 +++--- src/parse/traverse.c | 2 +- 6 files changed, 12 insertions(+), 15 deletions(-) diff --git a/include/traverse.h b/include/traverse.h index 4941b92b..18447fc7 100644 --- a/include/traverse.h +++ b/include/traverse.h @@ -1,6 +1,6 @@ #ifndef __TRAVERSE #define __TRAVERSE -ANN m_bool traverse_ast(const Env, const Ast*); +ANN m_bool traverse_ast(const Env, Ast *const); ANN m_bool traverse_class_def(const Env, const Class_Def); ANN m_bool traverse_func_def(const Env, const Func_Def); ANN m_bool traverse_union_def(const Env, const Union_Def); diff --git a/src/lib/prim.c b/src/lib/prim.c index c9fc80c0..fcaab1fa 100644 --- a/src/lib/prim.c +++ b/src/lib/prim.c @@ -299,13 +299,13 @@ static OP_CHECK(opck_cast_f2i) { } return env->gwion->type[et_int]; } - +/* ANN static void tofloat(Exp e, const m_int i) { e->exp_type = ae_exp_primary; e->d.prim.prim_type = ae_prim_float; e->d.prim.d.fnum = i; } - +*/ static OP_CHECK(opck_cast_i2f) { Exp_Cast *cast = (Exp_Cast*)data; if(is_prim_int(cast->exp)) { diff --git a/src/lib/ptr.c b/src/lib/ptr.c index ce0ab9b1..55c2495b 100644 --- a/src/lib/ptr.c +++ b/src/lib/ptr.c @@ -21,9 +21,8 @@ static m_bool ptr_access(const Env env, const Exp e) { ERR_B(e->pos, _("operand is %s"), access); } -ANN static inline Type ptr_base(const Env env, const Type t) { +ANN static inline Type ptr_base(const Type t) { return (Type)vector_front(&t->info->tuple->types); -// return known_type(env, *mp_vector_at(t->info->cdef->base.tmpl->call, Type_Decl*, 0)); } static OP_CHECK(opck_ptr_assign) { @@ -36,7 +35,7 @@ static OP_CHECK(opck_ptr_assign) { do { Type u = bin->rhs->type; do { - const Type base = ptr_base(env, u); + const Type base = ptr_base(u); if (isa(t, base) > 0) return bin->rhs->type; } while ((u = u->info->parent) && u->info->cdef->base.tmpl->call); } while ((t = t->info->parent)); @@ -54,7 +53,7 @@ static OP_EMIT(opem_ptr_assign) { static OP_CHECK(opck_ptr_deref) { const Exp_Unary *unary = (Exp_Unary *)data; - return ptr_base(env, unary->exp->type); + return ptr_base(unary->exp->type); } static OP_CHECK(opck_ptr_cast) { @@ -73,7 +72,7 @@ static OP_CHECK(opck_ptr_cast) { static OP_CHECK(opck_ptr_implicit) { const struct Implicit *imp = (struct Implicit *)data; const Exp e = imp->e; - const Type base = ptr_base(env, imp->t); + const Type base = ptr_base(imp->t); if (isa(e->type, base) > 0) { const m_str access = exp_access(e); if (access) ERR_N(e->pos, _("can't cast %s value to Ptr"), access); diff --git a/src/lib/ugen.c b/src/lib/ugen.c index d0e1f425..417e693a 100644 --- a/src/lib/ugen.c +++ b/src/lib/ugen.c @@ -373,11 +373,9 @@ ANN static UGen add_ugen(const Gwi gwi, struct ugen_importer *imp) { } static GWION_IMPORT(global_ugens) { - const VM * vm = gwi_vm(gwi); + VM *const vm = gwi_vm(gwi); struct ugen_importer imp_hole = {vm, compute_mono, "blackhole", 1}; const UGen hole = add_ugen(gwi, &imp_hole); - struct ugen_importer imp_dac = {vm, dac_tick, "dac", vm->bbq->si->out}; - // dac needs to have *multi* const M_Object dac = new_M_UGen(gwi->gwion); const UGen u = UGEN(dac); diff --git a/src/parse/scan2.c b/src/parse/scan2.c index 6a426cd8..f706fe69 100644 --- a/src/parse/scan2.c +++ b/src/parse/scan2.c @@ -46,7 +46,7 @@ ANN m_bool scan2_exp_decl(const Env env, const Exp_Decl *decl) { return ret; } -ANN static m_bool scan2_args(const Env env, const Func_Def f) { +ANN static m_bool scan2_args(const Func_Def f) { Arg_List args = f->base->args; const bool global = GET_FLAG(f->base, global); for(uint32_t i = 0; i < args->len; i++) { @@ -80,7 +80,7 @@ ANN static Value scan2_func_assign(const Env env, const Func_Def d, ANN m_bool scan2_fptr_def(const Env env NUSED, const Fptr_Def fptr) { if (!tmpl_base(fptr->base->tmpl)) { const Func_Def def = fptr->type->info->func->def; - if (def->base->args) { RET_NSPC(scan2_args(env, def)) } + if (def->base->args) { RET_NSPC(scan2_args(def)) } } else set_tflag(fptr->type, tflag_ftmpl); return GW_OK; @@ -514,7 +514,7 @@ m_bool scan2_fdef_std(const Env env, const Func_Def f, const Value overload) { CHECK_OB(func_create(env, f, overload, name)); else f->base->func = base; - if (f->base->args) CHECK_BB(scan2_args(env, f)); + if (f->base->args) CHECK_BB(scan2_args(f)); if (!f->builtin && f->d.code) CHECK_BB(scan2_func_def_code(env, f)); if (!base) { if (fbflag(f->base, fbflag_op)) CHECK_BB(scan2_func_def_op(env, f)); diff --git a/src/parse/traverse.c b/src/parse/traverse.c index 4289cacb..04bd6351 100644 --- a/src/parse/traverse.c +++ b/src/parse/traverse.c @@ -3,7 +3,7 @@ #include "gwion_env.h" #include "traverse.h" -ANN m_bool traverse_ast(const Env env, const Ast *ast) { +ANN m_bool traverse_ast(const Env env, Ast *const ast) { CHECK_BB(scan0_ast(env, ast)); CHECK_BB(scan1_ast(env, ast)); CHECK_BB(scan2_ast(env, ast)); -- 2.43.0