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
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);

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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('\\');