[qfcc] Make print_operand usable from gdb

It not emitting a \n made life difficult, especially whenever gdb
decided to make access to printf or puts awkward.
This commit is contained in:
Bill Currie 2020-03-16 20:20:07 +09:00
parent b544a052bf
commit db06300ddd

View file

@ -158,8 +158,8 @@ operand_string (operand_t *op)
return ("??");
}
void
print_operand (operand_t *op)
static void
_print_operand (operand_t *op)
{
switch (op->op_type) {
case op_def:
@ -224,7 +224,7 @@ print_operand (operand_t *op)
break;
case op_alias:
printf ("alias(%s,", pr_type_name[op->type->type]);
print_operand (op->o.alias);
_print_operand (op->o.alias);
printf (")");
break;
case op_nil:
@ -233,18 +233,25 @@ print_operand (operand_t *op)
}
}
void
print_operand (operand_t *op)
{
_print_operand (op);
puts ("");
}
void
print_statement (statement_t *s)
{
printf ("(%s, ", s->opcode);
if (s->opa)
print_operand (s->opa);
_print_operand (s->opa);
printf (", ");
if (s->opb)
print_operand (s->opb);
_print_operand (s->opb);
printf (", ");
if (s->opc)
print_operand (s->opc);
_print_operand (s->opc);
printf (")\n");
}