use UNUSED macro

This commit is contained in:
Yuichi Nishiwaki 2014-01-30 18:15:59 +09:00
parent 8ae55bd9b6
commit 173d4dcf07
7 changed files with 119 additions and 103 deletions

View File

@ -1495,114 +1495,116 @@ pic_set(pic_state *pic, const char *name, pic_value value)
void void
print_code(pic_state *pic, struct pic_code c) print_code(pic_state *pic, struct pic_code c)
{ {
printf("[%2d] ", c.insn); UNUSED(pic);
switch (c.insn) {
case OP_POP: printf("[%2d] ", c.insn);
puts("OP_POP"); switch (c.insn) {
break; case OP_POP:
case OP_PUSHNIL: puts("OP_POP");
puts("OP_PUSHNIL"); break;
break; case OP_PUSHNIL:
case OP_PUSHTRUE: puts("OP_PUSHNIL");
puts("OP_PUSHTRUE"); break;
break; case OP_PUSHTRUE:
case OP_PUSHFALSE: puts("OP_PUSHTRUE");
puts("OP_PUSHFALSE"); break;
break; case OP_PUSHFALSE:
case OP_PUSHFLOAT: puts("OP_PUSHFALSE");
printf("OP_PUSHFLOAT\t%f\n", c.u.f); break;
break; case OP_PUSHFLOAT:
case OP_PUSHINT: printf("OP_PUSHFLOAT\t%f\n", c.u.f);
printf("OP_PUSHINT\t%d\n", c.u.i); break;
break; case OP_PUSHINT:
case OP_PUSHCHAR: printf("OP_PUSHINT\t%d\n", c.u.i);
printf("OP_PUSHCHAR\t%c\n", c.u.c); break;
break; case OP_PUSHCHAR:
case OP_PUSHCONST: printf("OP_PUSHCHAR\t%c\n", c.u.c);
printf("OP_PUSHCONST\t%d\n", c.u.i); break;
break; case OP_PUSHCONST:
case OP_GREF: printf("OP_PUSHCONST\t%d\n", c.u.i);
printf("OP_GREF\t%i\n", c.u.i); break;
break; case OP_GREF:
case OP_GSET: printf("OP_GREF\t%i\n", c.u.i);
printf("OP_GSET\t%i\n", c.u.i); break;
break; case OP_GSET:
case OP_LREF: printf("OP_GSET\t%i\n", c.u.i);
printf("OP_LREF\t%d\n", c.u.i); break;
break; case OP_LREF:
case OP_LSET: printf("OP_LREF\t%d\n", c.u.i);
printf("OP_LSET\t%d\n", c.u.i); break;
break; case OP_LSET:
case OP_CREF: printf("OP_LSET\t%d\n", c.u.i);
printf("OP_CREF\t%d\t%d\n", c.u.r.depth, c.u.r.idx); break;
break; case OP_CREF:
case OP_CSET: printf("OP_CREF\t%d\t%d\n", c.u.r.depth, c.u.r.idx);
printf("OP_CSET\t%d\t%d\n", c.u.r.depth, c.u.r.idx); break;
break; case OP_CSET:
case OP_JMP: printf("OP_CSET\t%d\t%d\n", c.u.r.depth, c.u.r.idx);
printf("OP_JMP\t%d\n", c.u.i); break;
break; case OP_JMP:
case OP_JMPIF: printf("OP_JMP\t%d\n", c.u.i);
printf("OP_JMPIF\t%d\n", c.u.i); break;
break; case OP_JMPIF:
case OP_CALL: printf("OP_JMPIF\t%d\n", c.u.i);
printf("OP_CALL\t%d\n", c.u.i); break;
break; case OP_CALL:
case OP_TAILCALL: printf("OP_CALL\t%d\n", c.u.i);
printf("OP_TAILCALL\t%d\n", c.u.i); break;
break; case OP_TAILCALL:
case OP_RET: printf("OP_TAILCALL\t%d\n", c.u.i);
puts("OP_RET"); break;
break; case OP_RET:
case OP_LAMBDA: puts("OP_RET");
printf("OP_LAMBDA\t%d\n", c.u.i); break;
break; case OP_LAMBDA:
case OP_CONS: printf("OP_LAMBDA\t%d\n", c.u.i);
puts("OP_CONS"); break;
break; case OP_CONS:
case OP_CAR: puts("OP_CONS");
puts("OP_CAR"); break;
break; case OP_CAR:
case OP_NILP: puts("OP_CAR");
puts("OP_NILP"); break;
break; case OP_NILP:
case OP_CDR: puts("OP_NILP");
puts("OP_CDR"); break;
break; case OP_CDR:
case OP_ADD: puts("OP_CDR");
puts("OP_ADD"); break;
break; case OP_ADD:
case OP_SUB: puts("OP_ADD");
puts("OP_SUB"); break;
break; case OP_SUB:
case OP_MUL: puts("OP_SUB");
puts("OP_MUL"); break;
break; case OP_MUL:
case OP_DIV: puts("OP_MUL");
puts("OP_DIV"); break;
break; case OP_DIV:
case OP_MINUS: puts("OP_DIV");
puts("OP_MINUS"); break;
break; case OP_MINUS:
case OP_EQ: puts("OP_MINUS");
puts("OP_EQ"); break;
break; case OP_EQ:
case OP_LT: puts("OP_EQ");
puts("OP_LT"); break;
break; case OP_LT:
case OP_LE: puts("OP_LT");
puts("OP_LE"); break;
break; case OP_LE:
case OP_STOP: puts("OP_LE");
puts("OP_STOP"); break;
break; case OP_STOP:
} puts("OP_STOP");
break;
}
} }
void void
pic_dump_irep(pic_state *pic, struct pic_irep *irep) pic_dump_irep(pic_state *pic, struct pic_irep *irep)
{ {
int i; unsigned i;
printf("## irep %p\n", (void *)irep); printf("## irep %p\n", (void *)irep);
printf("[clen = %zd, argc = %d, localc = %d]\n", irep->clen, irep->argc, irep->localc); printf("[clen = %zd, argc = %d, localc = %d]\n", irep->clen, irep->argc, irep->localc);

View File

@ -25,12 +25,15 @@ pic_error(pic_state *pic, const char *msg)
void void
pic_errorf(pic_state *pic, const char *msg, size_t n, ...) pic_errorf(pic_state *pic, const char *msg, size_t n, ...)
{ {
UNUSED(n);
pic_error(pic, msg); pic_error(pic, msg);
} }
void void
pic_abort(pic_state *pic, const char *msg) pic_abort(pic_state *pic, const char *msg)
{ {
UNUSED(pic);
fprintf(stderr, "abort: %s\n", msg); fprintf(stderr, "abort: %s\n", msg);
fflush(stderr); fflush(stderr);
abort(); abort();
@ -39,6 +42,8 @@ pic_abort(pic_state *pic, const char *msg)
void void
pic_warn(pic_state *pic, const char *msg) pic_warn(pic_state *pic, const char *msg)
{ {
UNUSED(pic);
fprintf(stderr, "warn: %s\n", msg); fprintf(stderr, "warn: %s\n", msg);
} }

View File

@ -121,6 +121,8 @@ pic_calloc(pic_state *pic, size_t count, size_t size)
void void
pic_free(pic_state *pic, void *ptr) pic_free(pic_state *pic, void *ptr)
{ {
UNUSED(pic);
free(ptr); free(ptr);
} }

View File

@ -48,6 +48,8 @@ pic_cdr(pic_state *pic, pic_value obj)
bool bool
pic_list_p(pic_state *pic, pic_value obj) pic_list_p(pic_state *pic, pic_value obj)
{ {
UNUSED(pic);
while (pic_pair_p(obj)) { while (pic_pair_p(obj)) {
obj = pic_pair_ptr(obj)->cdr; obj = pic_pair_ptr(obj)->cdr;
} }

View File

@ -50,6 +50,7 @@ pic_proc_cv_init(pic_state *pic, struct pic_proc *proc, size_t cv_size)
int int
pic_proc_cv_size(pic_state *pic, struct pic_proc *proc) pic_proc_cv_size(pic_state *pic, struct pic_proc *proc)
{ {
UNUSED(pic);
return proc->env ? proc->env->valuec : 0; return proc->env ? proc->env->valuec : 0;
} }

View File

@ -27,6 +27,7 @@ pic_var_new(pic_state *pic, pic_value init, struct pic_proc *conv /* = NULL */)
pic_value pic_value
pic_var_ref(pic_state *pic, struct pic_var *var) pic_var_ref(pic_state *pic, struct pic_var *var)
{ {
UNUSED(pic);
return var->value; return var->value;
} }
@ -42,6 +43,7 @@ pic_var_set(pic_state *pic, struct pic_var *var, pic_value value)
void void
pic_var_set_force(pic_state *pic, struct pic_var *var, pic_value value) pic_var_set_force(pic_state *pic, struct pic_var *var, pic_value value)
{ {
UNUSED(pic);
var->value = value; var->value = value;
} }

View File

@ -33,6 +33,8 @@ write_str(pic_state *pic, struct pic_string *str)
size_t i; size_t i;
const char *cstr = str->str; const char *cstr = str->str;
UNUSED(pic);
for (i = 0; i < str->len; ++i) { for (i = 0; i < str->len; ++i) {
if (cstr[i] == '"' || cstr[i] == '\\') { if (cstr[i] == '"' || cstr[i] == '\\') {
putchar('\\'); putchar('\\');