From 173d4dcf0733284c8a4515ea0af714d963377f76 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Thu, 30 Jan 2014 18:15:59 +0900 Subject: [PATCH] use UNUSED macro --- src/codegen.c | 208 +++++++++++++++++++++++++------------------------- src/error.c | 5 ++ src/gc.c | 2 + src/pair.c | 2 + src/proc.c | 1 + src/var.c | 2 + src/write.c | 2 + 7 files changed, 119 insertions(+), 103 deletions(-) diff --git a/src/codegen.c b/src/codegen.c index 356fba0d..74d5f8d8 100644 --- a/src/codegen.c +++ b/src/codegen.c @@ -1495,114 +1495,116 @@ pic_set(pic_state *pic, const char *name, pic_value value) void print_code(pic_state *pic, struct pic_code c) { - printf("[%2d] ", c.insn); - switch (c.insn) { - case OP_POP: - puts("OP_POP"); - break; - case OP_PUSHNIL: - puts("OP_PUSHNIL"); - break; - case OP_PUSHTRUE: - puts("OP_PUSHTRUE"); - break; - case OP_PUSHFALSE: - puts("OP_PUSHFALSE"); - break; - case OP_PUSHFLOAT: - printf("OP_PUSHFLOAT\t%f\n", c.u.f); - break; - case OP_PUSHINT: - printf("OP_PUSHINT\t%d\n", c.u.i); - break; - case OP_PUSHCHAR: - printf("OP_PUSHCHAR\t%c\n", c.u.c); - break; - case OP_PUSHCONST: - printf("OP_PUSHCONST\t%d\n", c.u.i); - break; - case OP_GREF: - printf("OP_GREF\t%i\n", c.u.i); - break; - case OP_GSET: - printf("OP_GSET\t%i\n", c.u.i); - break; - case OP_LREF: - printf("OP_LREF\t%d\n", c.u.i); - break; - case OP_LSET: - printf("OP_LSET\t%d\n", c.u.i); - break; - case OP_CREF: - printf("OP_CREF\t%d\t%d\n", c.u.r.depth, c.u.r.idx); - break; - case OP_CSET: - printf("OP_CSET\t%d\t%d\n", c.u.r.depth, c.u.r.idx); - break; - case OP_JMP: - printf("OP_JMP\t%d\n", c.u.i); - break; - case OP_JMPIF: - printf("OP_JMPIF\t%d\n", c.u.i); - break; - case OP_CALL: - printf("OP_CALL\t%d\n", c.u.i); - break; - case OP_TAILCALL: - printf("OP_TAILCALL\t%d\n", c.u.i); - break; - case OP_RET: - puts("OP_RET"); - break; - case OP_LAMBDA: - printf("OP_LAMBDA\t%d\n", c.u.i); - break; - case OP_CONS: - puts("OP_CONS"); - break; - case OP_CAR: - puts("OP_CAR"); - break; - case OP_NILP: - puts("OP_NILP"); - break; - case OP_CDR: - puts("OP_CDR"); - break; - case OP_ADD: - puts("OP_ADD"); - break; - case OP_SUB: - puts("OP_SUB"); - break; - case OP_MUL: - puts("OP_MUL"); - break; - case OP_DIV: - puts("OP_DIV"); - break; - case OP_MINUS: - puts("OP_MINUS"); - break; - case OP_EQ: - puts("OP_EQ"); - break; - case OP_LT: - puts("OP_LT"); - break; - case OP_LE: - puts("OP_LE"); - break; - case OP_STOP: - puts("OP_STOP"); - break; - } + UNUSED(pic); + + printf("[%2d] ", c.insn); + switch (c.insn) { + case OP_POP: + puts("OP_POP"); + break; + case OP_PUSHNIL: + puts("OP_PUSHNIL"); + break; + case OP_PUSHTRUE: + puts("OP_PUSHTRUE"); + break; + case OP_PUSHFALSE: + puts("OP_PUSHFALSE"); + break; + case OP_PUSHFLOAT: + printf("OP_PUSHFLOAT\t%f\n", c.u.f); + break; + case OP_PUSHINT: + printf("OP_PUSHINT\t%d\n", c.u.i); + break; + case OP_PUSHCHAR: + printf("OP_PUSHCHAR\t%c\n", c.u.c); + break; + case OP_PUSHCONST: + printf("OP_PUSHCONST\t%d\n", c.u.i); + break; + case OP_GREF: + printf("OP_GREF\t%i\n", c.u.i); + break; + case OP_GSET: + printf("OP_GSET\t%i\n", c.u.i); + break; + case OP_LREF: + printf("OP_LREF\t%d\n", c.u.i); + break; + case OP_LSET: + printf("OP_LSET\t%d\n", c.u.i); + break; + case OP_CREF: + printf("OP_CREF\t%d\t%d\n", c.u.r.depth, c.u.r.idx); + break; + case OP_CSET: + printf("OP_CSET\t%d\t%d\n", c.u.r.depth, c.u.r.idx); + break; + case OP_JMP: + printf("OP_JMP\t%d\n", c.u.i); + break; + case OP_JMPIF: + printf("OP_JMPIF\t%d\n", c.u.i); + break; + case OP_CALL: + printf("OP_CALL\t%d\n", c.u.i); + break; + case OP_TAILCALL: + printf("OP_TAILCALL\t%d\n", c.u.i); + break; + case OP_RET: + puts("OP_RET"); + break; + case OP_LAMBDA: + printf("OP_LAMBDA\t%d\n", c.u.i); + break; + case OP_CONS: + puts("OP_CONS"); + break; + case OP_CAR: + puts("OP_CAR"); + break; + case OP_NILP: + puts("OP_NILP"); + break; + case OP_CDR: + puts("OP_CDR"); + break; + case OP_ADD: + puts("OP_ADD"); + break; + case OP_SUB: + puts("OP_SUB"); + break; + case OP_MUL: + puts("OP_MUL"); + break; + case OP_DIV: + puts("OP_DIV"); + break; + case OP_MINUS: + puts("OP_MINUS"); + break; + case OP_EQ: + puts("OP_EQ"); + break; + case OP_LT: + puts("OP_LT"); + break; + case OP_LE: + puts("OP_LE"); + break; + case OP_STOP: + puts("OP_STOP"); + break; + } } void pic_dump_irep(pic_state *pic, struct pic_irep *irep) { - int i; + unsigned i; printf("## irep %p\n", (void *)irep); printf("[clen = %zd, argc = %d, localc = %d]\n", irep->clen, irep->argc, irep->localc); diff --git a/src/error.c b/src/error.c index e849026b..6203a767 100644 --- a/src/error.c +++ b/src/error.c @@ -25,12 +25,15 @@ pic_error(pic_state *pic, const char *msg) void pic_errorf(pic_state *pic, const char *msg, size_t n, ...) { + UNUSED(n); pic_error(pic, msg); } void pic_abort(pic_state *pic, const char *msg) { + UNUSED(pic); + fprintf(stderr, "abort: %s\n", msg); fflush(stderr); abort(); @@ -39,6 +42,8 @@ pic_abort(pic_state *pic, const char *msg) void pic_warn(pic_state *pic, const char *msg) { + UNUSED(pic); + fprintf(stderr, "warn: %s\n", msg); } diff --git a/src/gc.c b/src/gc.c index a71af550..1b61d4f1 100644 --- a/src/gc.c +++ b/src/gc.c @@ -121,6 +121,8 @@ pic_calloc(pic_state *pic, size_t count, size_t size) void pic_free(pic_state *pic, void *ptr) { + UNUSED(pic); + free(ptr); } diff --git a/src/pair.c b/src/pair.c index 4495b641..2016c362 100644 --- a/src/pair.c +++ b/src/pair.c @@ -48,6 +48,8 @@ pic_cdr(pic_state *pic, pic_value obj) bool pic_list_p(pic_state *pic, pic_value obj) { + UNUSED(pic); + while (pic_pair_p(obj)) { obj = pic_pair_ptr(obj)->cdr; } diff --git a/src/proc.c b/src/proc.c index 3509d479..fa2cabbb 100644 --- a/src/proc.c +++ b/src/proc.c @@ -50,6 +50,7 @@ pic_proc_cv_init(pic_state *pic, struct pic_proc *proc, size_t cv_size) int pic_proc_cv_size(pic_state *pic, struct pic_proc *proc) { + UNUSED(pic); return proc->env ? proc->env->valuec : 0; } diff --git a/src/var.c b/src/var.c index 92afb717..6bbd0331 100644 --- a/src/var.c +++ b/src/var.c @@ -27,6 +27,7 @@ pic_var_new(pic_state *pic, pic_value init, struct pic_proc *conv /* = NULL */) pic_value pic_var_ref(pic_state *pic, struct pic_var *var) { + UNUSED(pic); return var->value; } @@ -42,6 +43,7 @@ pic_var_set(pic_state *pic, struct pic_var *var, pic_value value) void pic_var_set_force(pic_state *pic, struct pic_var *var, pic_value value) { + UNUSED(pic); var->value = value; } diff --git a/src/write.c b/src/write.c index 614fcb9e..e4ced267 100644 --- a/src/write.c +++ b/src/write.c @@ -33,6 +33,8 @@ write_str(pic_state *pic, struct pic_string *str) size_t i; const char *cstr = str->str; + UNUSED(pic); + for (i = 0; i < str->len; ++i) { if (cstr[i] == '"' || cstr[i] == '\\') { putchar('\\');